SA-MP Forums Archive
Help Me! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help Me! (/showthread.php?tid=238698)



Help Me! - Roomeo - 12.03.2011

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



Re: Help Me! - arti - 12.03.2011

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


Re: Help Me! - MP2 - 12.03.2011

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.


Re: Help Me! - HyperZ - 12.03.2011

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



Re: Help Me! - Roomeo - 12.03.2011

when i type /stats Server Unkown Comamnd Still


Re: Help Me! - iMonk3y - 12.03.2011

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!


Re: Help Me! - Roomeo - 12.03.2011

I Already Have ZCMD


Re: Help Me! - iMonk3y - 12.03.2011

Then why isn't your command converted into ZMCD?


Re: Help Me! - Montis123 - 12.03.2011

Maybe change string 128 to 256


Re: Help Me! - iMonk3y - 12.03.2011

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