New porbleeeem
#1

He guys. i've got a new problem.
I have a script that when you you /lspds you see how much lspd members are online.

This is the command:
Код:
if (strcmp("/lspds", cmdtext, true, 10) == 0)
	{

  new lspd_online = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
{
	if(PlayerInfo[playerid][LSPDLEVEL] >= 1)
	{
		lspd_online++;
	}
}
But when I use that and there is just 1 LSPD member online it says there are 500 lspd members online.

And when there are 2 members online it also say that there are 500?...

Please help
This is another command for LSPD.
Код:
dcmd_setlspd(playerid,params[])
{
new giveplayerid,level;
if(sscanf(params, "ud", giveplayerid,level)) return SendClientMessage(playerid,red, "Usage: /Setlspd [Playerid/Partname] [Level]");
else if(PlayerInfo[playerid][LSPDLEVEL] < 8) return SendClientMessage(playerid,red,"You Need To Be 8+ Lspd Level To Use This Command");
else if(PlayerInfo[giveplayerid][LSPDLEVEL] == 0) return SendClientMessage(playerid,red,"That Player Need To Be Your Member");
else
{
new string[128],string2[128],gpiname[24],pNamE[24]; GetPlayerName(playerid,pNamE,24); GetPlayerName(giveplayerid,gpiname,24);
format(string,sizeof(string),"You Have Made %s Rank %d",gpiname,level);
SendClientMessage(playerid,red,string);
format(string2,sizeof(string2),"%s Made You Rank %d",pNamE,level);
SendClientMessage(giveplayerid,red,string2);
PlayerInfo[giveplayerid][LSPDLEVEL] = level;
}
return 1;
}
And this:
Код:
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;
}
That 2 commands are working fine

Thanks In ADVANCE!
Reply
#2

Hai.

pawn Код:
if (strcmp("/lspds", cmdtext, true, 10) == 0)
{
  new lspd_online = 0;
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
    if(PlayerInfo[i][LSPDLEVEL] >= 1)
    {
        lspd_online++;
    }
  }
   //Rest of the command
Try it.
Reply
#3

But then no message will show up:O
Reply
#4

pawn Код:
if (strcmp("/lspds", cmdtext, true, 10) == 0)
{
new lspd_online = 0;
for(new i = 0; i < MAX_PLAYERS; i++)
  {
    if(PlayerInfo[i][LSPDLEVEL] >= 1)
    {
        lspd_online++;
    }
  }
new string[128];
format(string, sizeof(string), "Current LSPD members: %d !, lspd_online);
SendClientMessage(playerid, 0xFF00FFFF, string);
return 1;
}
Thats it. Try it out.
Reply
#5

Jeffry you are my hero:
It is working smooth

Thankyaaa
Reply
#6

Btw, Do you think I also can make it in a list dialog?

So you will see a list dialog and in that list you see:
Lspd Members:[amount]
?

EDIT:
Woops.
I noticed that I dubbleposted. Sorry!
Reply
#7

Hm, never worked with dialogs.
But I will check it out for you tomorrow.

Quote:
Originally Posted by bartje01
Jeffry you are my hero:

No problem.
Reply
#8

alright
Reply
#9

Here we go with a dialog:

pawn Код:
if (strcmp("/lspds", cmdtext, true, 10) == 0)
    {
    new lspd_online = 0;
    for(new i = 0; i < MAX_PLAYERS; i++)
      {
        if(PlayerInfo[i][LSPDLEVEL] >= 1)
        {
            lspd_online++;
        }
      }
    new string[128];
    format(string, sizeof(string), "Current LSPD members: %d !", lspd_online);
    ShowPlayerDialog(playerid,250,DIALOG_STYLE_MSGBOX ,"Members:",string,"Quit","Quit"); // 250 is just the dialogs ID
    return 1;
    }
I hope this is what you wanted.

Greetings,
Jeffry.
Reply
#10

Jeffry I'm very sorry that I didn't told you I did it myself
I have a really cool dialog now. made by myself. I'm sorry to let you make this.
I didn't knew I would be able to do this my self.

Deepest apologizes.

Thanks for helping!!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)