16.08.2014, 07:31
hey guys, i'm making a command that shows how noob a player is in percentage.
it's just a random command that is used for fun.
command: /hownoob -id-
in chat: OMG! Player(1) is 94 Percent Noob!
I have ran into a little problem though, if I put in an invalid id, it says: OMG! (65535) is 10 Percent Noob!
i'm pretty sure i've made it so that if an invalid id is used, it should send back an error message, but that doesnt seem to be the case, also i get sscanf invalid parameter errors in my server console :/
here is my code
it's just a random command that is used for fun.
command: /hownoob -id-
in chat: OMG! Player(1) is 94 Percent Noob!
I have ran into a little problem though, if I put in an invalid id, it says: OMG! (65535) is 10 Percent Noob!
i'm pretty sure i've made it so that if an invalid id is used, it should send back an error message, but that doesnt seem to be the case, also i get sscanf invalid parameter errors in my server console :/
here is my code
PHP код:
CMD:hownoob(playerid, params[])
{
new pname[MAX_PLAYER_NAME];
new noob = random(101);
new string[64];
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, RED, "Invalid ID.");
if(sscanf(params, "us[128]", playerid)) return SendClientMessage(playerid, RED, "Syntax: /hownoob (id)");
if(GetPVarInt(playerid,"HOWNOOB_TIMER")>GetTickCount())return SendClientMessage(playerid,0xFFFFFFFF,"Please Wait Before Being Noob Again!");
SetPVarInt(playerid,"HOWNOOB_TIMER",GetTickCount()+60000);
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "OMG! %s(%d) is %i Percent Noob!", pname, playerid, noob);
SendClientMessageToAll(PINK, string);
return 1;
}