SA-MP Forums Archive
Cmd about virtual worlds - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Cmd about virtual worlds (/showthread.php?tid=519208)



Cmd about virtual worlds - kesarthakur - 13.06.2014

i want to make a command that when the command is typed
it should set all players Virtualworld to 0 if they are in a specific virtual world eg: 120

is this possible??

if yes please tell me how


Re: Cmd about virtual worlds - Rittik - 13.06.2014

pawn Код:
CMD:setvworld(playerid,params[]) //Created Just Now check if this works or not.
{
 if(IsPlayerAdmin(playerid))
  {
   new vworld;
   if(sscanf(params,"i",vworld))
   {
   SendClientMessage(playerid,-1,"/setvworld [world id]");
   return 1;
   }
   else
   {
   for(new i=0;i<MAX_PLAYERS;i++)
   {
    if(IsPlayerConnected(i))
    {
     if(GetPlayerVirtualWorld(i) == 56) //or any world ID according to your specification.
     {
     SetPlayerVirtualWorld(i,vworld);
     }
    }
   }
   }
  }
  else
  {
   SendClientMessage(playerid,-1,"you are not an admin");
   return 1;
  }
  return 1;
}
EDIT: Specified the Virtual World.


Re: Cmd about virtual worlds - kesarthakur - 13.06.2014

and this command should only work if the player is in specific world like 56 or something

when the command is used the players in world 56 should be set to 0 not all the players.


Re: Cmd about virtual worlds - Rittik - 13.06.2014

Edited the above code.