Help please
#1

Well guys, I'm going to work on somethnig I never did before.

I have a question about it.
How can I get the maxplayers that have this?
Код:
if(PlayerInfo[playerid][LSPDLEVEL] >= 1)
Can anyone make an example like this?:

There are [LSPD amount] lspd members online now.


ANd that will show up when you type /lspds.

And you guys should know that this [LSPDLEVEL] >= 1
means that if you are a lspd rank 1 or higher :P
PLease tell me if you don't get my point.
I really need this.

Regards!


Thanks In Advance.
Reply
#2

I don't understand correctly.

You're trying to figure out how to tell if an array like
pawn Код:
PlayerInfo[playerid][LSPDLEVEL]
is created and used?
Reply
#3

Yea this is a command i'm using:
Код:
dcmd_lspdleader(playerid, params[])
{
 if(PlayerInfo[playerid][Level] >= 1)
  {
   new tmp[256], tmp2[256], Index;
   tmp = strtok(params,Index),
   tmp2 = strtok(params,Index);
   if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /lspdleader [playerid]");
   new player1,playername[MAX_PLAYER_NAME], string[128];
   player1 = strval(tmp);
   if(!strlen(tmp2)) return SendClientMessage(playerid, red, "USAGE: /lspdleader [playerid]");

   GetPlayerName(player1,playername,sizeof(playername));

  format(string,sizeof(string),"You have made %s LSPD leader",playername);
  SendClientMessage(playerid,red,string);
	PlayerInfo[player1][LSPDLEVEL] = 10;
	SendClientMessage(player1,red,"You are now lspd leader");
  }
  else SendClientMessage(playerid,red,"You are not an admin");

	return 1;
}
Reply
#4

Код:
new lspd_online = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
	if(PlayerInfo[playerid][LSPDLEVEL] >= 1)
	{
		lspd_online++;
	}
}
format(string, sizeof(string), "There are %d lspd members online now.", lspd_online);
SendClientMessage(playerid, 0xFFFF00AA, string);
I think this is what you are looking for? I didn't test this, but I hope it helps!
Reply
#5

I understand tha tyou have to put this at onpalyerconnect hm? xD

And on onplayerisconnect the same but then not + but -
Reply
#6

Nope. You would put it under OnPlayerCommandText
Reply
#7

Well, it depends when you want the message to be sent. If you want it to happen every time someone enters the server, then yes, under OnPlayerConnect().
Reply
#8

WWell but when you use that ni a command.
Like /lspds
You get + one player every time you use that command :P
Reply
#9

Quote:

for(new i = 0; i < MAX_PLAYERS; i++)

Above goes through each player. Below checks to see if the player has >= 1 LSPDLEVEL

Quote:

if(PlayerInfo[playerid][LSPDLEVEL] >= 1)

If that's the case, then it adds 1 lspd_online++

The amount it returns is based on the players online that have >= 1 LSPDLEVEL... not how many times to type the command.
Reply
#10

Код:
so this whole code?
Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
	if(PlayerInfo[playerid][LSPDLEVEL] >= 1)
	{
		lspd_online++;
	}
}
format(string, sizeof(string), "There are %d lspd members online now.", lspd_online);
SendClientMessage(playerid, 0xFFFF00AA, string);
at onplayercommandtext?

I was more like. the counts at onplayerconnect

SO at onplayerconnect:
Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
	if(PlayerInfo[playerid][LSPDLEVEL] >= 1)
	{
		lspd_online++;
	}
}
Onplayercommandtext:
Код:
commandblabablablal
format(string, sizeof(string), "There are %d lspd members online now.", lspd_online);
SendClientMessage(playerid, 0xFFFF00AA, string);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)