Virtual Worlds help - 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: Virtual Worlds help (
/showthread.php?tid=517494)
Virtual Worlds help -
saikumar - 05.06.2014
is there anything like
GetAllPlayersVirtualWorlds;
![Huh?](images/smilies/confused.gif)
![Huh?](images/smilies/confused.gif)
?
i want to make a function that at specific time if the player is in anyother virtual world except 0 then he will be set to 0
is it possible
![Huh?](images/smilies/confused.gif)
?
Re: Virtual Worlds help -
Adityz - 05.06.2014
pawn Код:
CMD:vworld0forall(playerid, params[])
{
for(new i=0; i<MAX_PLAYERS; i++)
{
SetPlayerVirtualWorld(i, 0);
}
return 1;
}
Re: Virtual Worlds help -
saikumar - 05.06.2014
Quote:
Originally Posted by Adityz
pawn Код:
CMD:vworld0forall(playerid, params[]) { for(new i=0; i<MAX_PLAYERS; i++) SetPlayerVirtualWorld(i, 0); return 1; }
|
Seems like this not what i want.
can u please explain briefly about your code?
Re: Virtual Worlds help -
saikumar - 05.06.2014
Quote:
Originally Posted by ******
I was going to reply to this topic, then I saw that Adityz had already posted a solution that seemed to perfectly answer your question so didn't bother. If you don't think it does, you need to refine and explain your question some more.
|
ok thanks for letting me know ******
Quote:
Originally Posted by Adityz
pawn Код:
CMD:vworld0forall(playerid, params[]) { for(new i=0; i<MAX_PLAYERS; i++) { SetPlayerVirtualWorld(i, 0); }
return 1; }
|
Adityz please explain the code bro.
Re: Virtual Worlds help -
Adityz - 05.06.2014
Quote:
Originally Posted by saikumar
i want to make a function that at specific time if the player is in anyother virtual world except 0 then he will be set to 0
|
If you wanna set everybody's virtual world to 0, why do you even want /getallplayersvirtualworld? The code i posted above simply sets all the players' virtual world to 0 when you type /vworld0forall.
The First Line is a basic for() loop.
new i = 0; // Creates the variable 'i' and sets it to 0
i < MAX_PLAYERS; // If the loop is less than MAX_PLAYERS (X amount of slots on a server) it will continue
i++ // Adds one to i each time
For more info -
https://sampwiki.blast.hk/wiki/Loops
SetPlayerVirtualWorld(i, 0) Sets all the players' virtual world to 0 even if the player is in virtual world 0; which will not affect that player in any manner, but just set the other players' vworld (who are in a virutal world besides 0) to 0.
Your Welcome.
Re: Virtual Worlds help -
saikumar - 05.06.2014
pawn Код:
CMD:vworld0forall(playerid, params[])
{
for(new i=0; i<MAX_PLAYERS; i++) //do this line checks that is every player in virtual world 0 or not???
{
SetPlayerVirtualWorld(i, 0); ///and do this line makes the players virtual world to 0 of all players who are in other worlds???
}
return 1;
}
Re: Virtual Worlds help -
saikumar - 05.06.2014
ok got it thanks ******