Help Me!
#1

Well, Guys I've Added /Stats Command But when in game i type /stats it says SERVER UNKOWN COMMAND
pawn Код:
if(strcmp(cmdtext, "/stats", true) == 0)
{
new string[128];
new Float:health;
GetPlayerHealth(playerid,health);
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(string,128,"|STATS|Name:[%s] Money:[%d] Score:[%d] Health:[%d]",pName,GetPlayerMoney(playerid),GetPlayerScore(playerid),health);
SendClientMessage(playerid,COLOR_PURPLE,string);
return 1;
}
Reply
#2

take away "return 1" and write it down at the end of public OnPlayerCommandText
Reply
#3

Quote:
Originally Posted by arti
Посмотреть сообщение
take away "return 1" and write it down at the end of public OnPlayerCommandText
That will break it for sure. You don't know what you're talking about.

Put debug messages between each line. 'debug 1' 'debug 2' etc - go ingame and see which is the last to be shown. If it's debug 2 that means the line after that is the problem.

Plus health is %f not %d.
Reply
#4

Try This:
pawn Код:
if (strcmp("/stats", cmdtext, true, 10) == 0)
{
    new string[128], Float:pHealth, pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    GetPlayerHealth(playerid,pHealth);
    format(string,128,"|STATS|Name:[%s] Money:[%d] Score:[%d] Health:[%0.2f]",pName, GetPlayerMoney(playerid), GetPlayerScore(playerid), pHealth);
    SendClientMessage(playerid,COLOR_PURPLE,string);
    return 1;
}
Reply
#5

when i type /stats Server Unkown Comamnd Still
Reply
#6

Switch to ZCMD or YCMD. You will only benefit:

1) Server Unknown command message will most undoubtedly be gone!
2) Much faster solution (either one!)

Good luck!
Reply
#7

I Already Have ZCMD
Reply
#8

Then why isn't your command converted into ZMCD?
Reply
#9

Maybe change string 128 to 256
Reply
#10

Quote:
Originally Posted by Montis123
Посмотреть сообщение
Maybe change string 128 to 256
You're not serious
https://sampforum.blast.hk/showthread.php?tid=55261
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)