server unknown command -
dilldb - 13.02.2012
Hi I'm getting an unknown command error
I made this game mode early 2010 and I'm just reopening it. When I type /rank I get the server unknown command message. It used to work in 2010 idk why it doesn't now. Any help would be great.
Код:
if (strcmp("/rank", cmdtext, true, 10) == 0)
{
new string[128];
new PlayerDeaths = PlayerInfo[playerid][Deaths];
new PlayerKills = PlayerInfo[playerid][Kills];
new PlayerRanks = PlayerInfo[playerid][Rank];
new PlayerPoints = PlayerInfo[playerid][Points];
new KDR = PlayerKills * 100 / PlayerDeaths / 100;
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "-%s's Rank-", name);
SendClientMessageToAll(COLOR_GREEN, string);
format(string, sizeof(string), "Rank: %d Points: %d Kills: %d Deaths: %d KDR: %d", PlayerRanks, PlayerPoints, PlayerKills, PlayerDeaths, KDR);
SendClientMessageToAll(COLOR_GREEN, string);
return 1;
}
Re: server unknown command -
Nuke547 - 13.02.2012
Loose indentation?
Re: server unknown command -
2KY - 13.02.2012
if(!strcmp...
Try that.
Re: server unknown command -
dilldb - 13.02.2012
I get no errors or warnings when I compile.
Re: server unknown command -
dilldb - 13.02.2012
Quote:
Originally Posted by 2KY
if(!strcmp...
Try that.
|
hmm when I try
if (!strcmp("/rank", cmdtext, true, 10) == 0)
I get
C:\Users\Dillon\Desktop\sa-mp server\gamemodes\sidm.pwn(657) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Warning.
when I try
if (!strcmp("/rank", cmdtext, true, 10))
then /gmx and possibly other commands stops working =S
Re: server unknown command -
[ABK]Antonio - 13.02.2012
It's probably because of the %d in the K/D ratio - if their kills or deaths are 0, it's going to try to inevitably divide by 0 (also it would become a float)
What's the reason for multiplying it by 100 btw?
Re: server unknown command -
dilldb - 13.02.2012
Quote:
Originally Posted by [ABK]Antonio
It's probably because of the %d in the K/D ratio - if their kills or deaths are 0, it's going to try to inevitably divide by 0 (also it would become a float)
What's the reason for multiplying it by 100 btw?
|
haha I have no idea.
I edited my user file so it had 5 kills 2 deaths and it works! Thanks man!
Now that I know the problem I'll have to find a solution. I haven't done pawno in 2 years :P
But yeah thanks for the help guys I don't think I would of found it anytime soon.
Re: server unknown command -
MP2 - 13.02.2012
Do this:
if(player deaths == 0) player deaths = 1
But only for the division.
Re: server unknown command -
dilldb - 13.02.2012
Quote:
Originally Posted by MP2
Do this:
if(player deaths == 0) player deaths = 1
But only for the division.
|
I did this so that a player wouldn't automatically get a death in their ranks if they had none but thanks man
Код:
new KDR;
if(PlayerDeaths != 0)
{
KDR = PlayerKills / PlayerDeaths;
return 1;
}