/killplayer [id] help - 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: /killplayer [id] help (
/showthread.php?tid=189355)
/killplayer [id] help -
Rafa - 11.11.2010
guys i have maked one command /killplayer [id] and its works ( first dcmd command )
but the client messages dont work... :/
when ill tupe just /killplayer i want to show me "USAGE: /killplayer [id]"
and thats not working please someone help me:
pawn Код:
dcmd_killplayer(playerid,params[])
{
new target, TargetName[MAX_PLAYER_NAME];
new id;
new string[128];
if(!sscanf(params, "u", target))
{
if(sscanf(params, "u", id)) SendClientMessage(playerid, RED, "USAGE: /killplayer [id]");
else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, RED, "That player its not connected.");
GetPlayerName(target, TargetName, sizeof(TargetName));
format(string,sizeof(string),"You have killed player %s",TargetName);
SendClientMessage(playerid,GREEN,string);
SetPlayerHealth(target, 0.0);
SendClientMessage(id, GREEN, "You has been killed by server admin.");
}
return 1;
}
Thanks
Re: /killplayer [id] help -
Hiddos - 11.11.2010
Well, you're using sscanf TWO times. This is unnecessary and probably causes the problem. I never looked into the exact way of how sscanf works, but I'd delete one of those lines:
pawn Код:
dcmd_killplayer(playerid,params[])
{
new target, TargetName[MAX_PLAYER_NAME];
new id;
new string[128];
if(sscanf(params, "u", id)) SendClientMessage(playerid, RED, "USAGE: /killplayer [id]");
else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, RED, "That player its not connected.");
GetPlayerName(target, TargetName, sizeof(TargetName));
format(string,sizeof(string),"You have killed player %s",TargetName);
SendClientMessage(playerid,GREEN,string);
SetPlayerHealth(target, 0.0);
SendClientMessage(id, GREEN, "You has been killed by server admin.");
return 1;
}
Re: /killplayer [id] help -
TheHoodRat - 11.11.2010
pawn Код:
dcmd_killplayer(playerid,params[])
{
new target, TargetName[MAX_PLAYER_NAME];
new id;
new string[128];
if(!sscanf(params, "u", id))
{
if (id == INVALID_PLAYER_ID)
return SendClientMessage(playerid, RED, "That player its not connected.");
GetPlayerName(target, TargetName, sizeof(TargetName));
format(string,sizeof(string),"You have killed player %s",TargetName);
SendClientMessage(playerid,GREEN,string);
SetPlayerHealth(target, 0.0);
SendClientMessage(id, GREEN, "You has been killed by server admin.");}}
else SendClientMessage(playerid, RED, "USAGE: /killplayer <playerid>");
return 1;
}