simple question
#1

is there any way to detect if there is no player on the server have pGamemode=1
Playerid[playerid][ pGamemode ] == 1
?
i need help asap please !
Reply
#2

try:
PHP код:
CMD:gamemode(playerid,params[])
{
  for(new 
0MAX_PLAYERSi++) {
     if(
PlayerInfo[i][pGamemode] == 1) {
      new 
pname[32],string[128];
      
GetPlayerName(i,pname,32);
      
SendClientMessage(playerid,-1,"Online Gamemode Members:");
      
format(string,sizeof(string)," %s ,pname");
      
SendClientMessage(playerid,-1,string);
      } else 
SendClientMessage(playerid,-1,"There are no Gamemode Member Online.");
   }
  return 
1;

Reply
#3

ik that but i need it to detect if there is no players in the gm to stops maps loading
if you know what i mean
Reply
#4

pawn Код:
enum gameinfo
{
       pCounter,
       pCount,
};
new gInfo[gameinfo];
simply use a global variable that is directed to a timer that checks every seconds if their are zero players, not the most efficient way but it does the job.
Reply
#5

maybe
PHP код:
 for(new 0MAX_PLAYERSi++) { if(!PlayerInfo[i][pGamemode]) return 0
Reply
#6

Quote:
Originally Posted by DarkLored
Посмотреть сообщение
pawn Код:
enum gameinfo
{
       pCounter,
       pCount,
};
new gInfo[gameinfo];
simply use a global variable that is directed to a timer that checks every seconds if their are zero players, not the most efficient way but it does the job.
can you please write the code you mean as i didn't understand
Reply
#7

Alright

pawn Код:
forward ServerVars();

enum gameinfo
{
       pCount,
};
new gInfo[gameinfo];

public OnGamemodeInit()
{
        SetTimer("ServerVars", 1000, true);
        return 1;
}

public OnPlayerConnect(playerid)
{
        pCount += 1;
        return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
         pCount -= 1;
         return 1;
}

public ServerVars()
{
       if(gInfo[pCount] == 0)
       {
            //code here
           return 1;
       }
      return 1;
}
Hopefully this is enough information, if you want to destroy the objects then use a loop inside the if statement.
Reply
#8

I guess u didn't understand me
im my gamemode theres is pgamemode 0 wich is the lobby or selection of the gm and 1 is dm race so i want to make when there is no player with pgamemode 1 stop loading map progressformap false because without that the map loadimg and it shows for players in the lobby
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)