Command /a slap [id] -
Luicy. - 21.05.2016
Hi, Somehow I can't use /a slap 0, It returns sscanf error in game(SCM),
Pastebin:
http://pastebin.com/gJic2rGg
Re: Command /a slap [id] -
SyS - 21.05.2016
that code is a giant mess man
Re: Command /a slap [id] -
Luicy. - 21.05.2016
Quote:
Originally Posted by Sreyas
that code is a giant mess man
|
Sorry but that's the way I code.
Re: Command /a slap [id] -
SyS - 21.05.2016
PHP код:
CMD:slap(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
new id,Float:x,Float:y,Float:z,name[MAX_PLAYER_NAME],msg[128];
if(sscanf(params,"u",id)) return SendClientMessage(playerid,-1,"Usage: /slap [id]");
else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"Player is not connected anymore!");
else
{
SendClientMessage(playerid,-1,"You have been successful slapped that player!");
GetPlayerPos(id,x,y,z);
SetPlayerPos(id,x,y,z+4);
GetPlayerName(playerid,name,sizeof(name));
format(msg,sizeof(msg),"AdmCmd: You have been slapped by Admin %s",name);
SendClientMessage(id,-1,msg);
}
}
else
{
SendClientMessage(playerid,0x800000FF,"You are not authorized to use this command!");
}
return 1;
}
try those
Re: Command /a slap [id] -
maximthepain - 21.05.2016
Код:
new target;
if(!sscanf(params, "s[255]i", target))
Whats with the s[255]i ? Theres no string in this check. Only integer. Better do it:
Код:
new target;
if(!sscanf(params, "i", target))
I can tell you that the sscanf error in the game is obviously because you made alot of mess with the sscanf checks...
And by the way the fastest thing to do is to check all the parameters in one sscanf.. for example:
Код:
if(sscanf(params, "dds[32]", giveplayerid, moneys, detail)) return Mensaje(playerid, COLOR_WHITE, "USE: /contract [ID] [amount] [details]");
Re: Command /a slap [id] -
Sjn - 21.05.2016
A small correction, the specifier should be "u" instead of "i"
Re: Command /a slap [id] -
GhostHacker - 21.05.2016
look @ what sreyas posted it is correct and more optimised