Virtual Worlds help
#1

is there anything like

GetAllPlayersVirtualWorlds; ?

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?
Reply
#2

pawn Код:
CMD:vworld0forall(playerid, params[])
{
   for(new i=0; i<MAX_PLAYERS; i++)
   {
      SetPlayerVirtualWorld(i, 0);
   }

   return 1;
}
Reply
#3

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?
Reply
#4

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.
Reply
#5

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.
Reply
#6

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;
}
Reply
#7

ok got it thanks ******
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)