Author Topic: My 1st script!  (Read 492 times)

Offline Lordz

  • Beta Tester
  • Sr. Member
  • ****
  • Posts: 1238
  • Location: Earth
    • RBTDM
Re: My 1st script!
« on: April 21, 2013, 10:44:51 am »
Yes, please remove the codes as you created for YG. And, I've a suggestion too:

It would be good if player gets back to his position on /exit command rather than on the spawn point.
Also if player is alone in DMs, it's better not to give that "Coward" xD. But yes, it must too be there. So creating a loop and getting how many people joined or is in the DM would be good.

Example:
Code: [Select]

new Float:pXpos[MAX_PLAYERS],
        Float:pYpos[MAX_PLAYERS],
        Float:pZpos[MAX_PLAYERS],
        pInterior[MAX_PLAYERS];

//Whenever the go on DMing.
CMD:mgcommands(playerid, params[])
{
 GetPlayerPos(playerid, pXpos[playerid], pYpos[playerid], pZpos[playerid]);
 pInterior[playerid] = GetPlayerInterior(playerid);
 //Other DM stuffs
 return 1;
}

CMD:exit(playerid, params[])
{
 new Count = 0;
 for(new i; i< GetMaxPlayers(); i++)
 {
  if(!IsPlayerConnected(i)) continue;
  if(InDM[i] == 1) {
  Count++;
  break;
  }
 }
 if(Count == 1) {
 //Then he's leaving because there are no players in DM, except him.
 }
 else
 {
 //There are...
 }
 SetPlayerPos(playerid, pXpos[playerid], pYpos[playerid], pZpos[playerid]);
 SetPlayerInterior(playerid, pInterior[playerid]);
 return 1;
}

Just an example to show you, I haven't tested it. So if mistakes, sorry. Once again, nice work. Keep it up! :)