server unknown command
#1

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

Loose indentation?
Reply
#3

if(!strcmp...

Try that.
Reply
#4

I get no errors or warnings when I compile.
Reply
#5

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

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

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

Do this:

if(player deaths == 0) player deaths = 1
But only for the division.
Reply
#9

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


Forum Jump:


Users browsing this thread: 1 Guest(s)