CMD PROPLEM - 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)
+--- Thread: CMD PROPLEM (
/showthread.php?tid=582352)
CMD PROPLEM -
Andy5 - 20.07.2015
The Code
Quote:
CMD:akill(playerid, params[])
{
new str[128];
if(PlayerInfo[playerid][pAdmin] >= 1)
{
new playerb;
if(sscanf(params,"u",playerb)) return SendClientMessage(playerid, COLOR_GREEN, "[USAGE]: /akill [player id]");
if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_RED, "[ERROR] Invalid player id.");
SetPlayerHealth(playerid,0.0);
format(str,sizeof(str), "[NOTIFICATION] Admin %s has used /akill on %s.", Name(playerid), Name(playerb));
SendAdminMessage(COLOR_YELLOW,str);
}
return 1;
}
|
Proplem
When I use it , im who got killed , Not the player that i choosed , can anyone help me ?
Respuesta: CMD PROPLEM -
ghost556 - 20.07.2015
Код:
CMD:akill(playerid, params[])
{
new str[128];
if(PlayerInfo[playerid][pAdmin] >= 1)
{
new playerb;
if(sscanf(params,"u",playerb)) return SendClientMessage(playerid, COLOR_GREEN, "[USAGE]: /akill [player id]");
if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_RED, "[ERROR] Invalid player id.");
SetPlayerHealth(playerb,0.0);
format(str,sizeof(str), "[NOTIFICATION] Admin %s has used /akill on %s.", Name(playerid), Name(playerb));
SendAdminMessage(COLOR_YELLOW,str);
}
return 1;
}
Try that
Edit: At
Код:
SetPlayerHealth(playerb,0.0);
you had 'playerid' at 'playerb' meaning it will kill who uses the script instead of the id that was inputted.
Re: CMD PROPLEM -
Andy5 - 20.07.2015
ok thanks , i will try it and i will tell you if its working
Re: CMD PROPLEM -
liquor - 20.07.2015
It will work, as you had it like;
pawn Код:
SetPlayerHealth(playerid,0.0);
and 'playerid' returns YOUR playerid since YOU executed the command, but you specified the target id as 'playerb' in the sscanf function :P
Re: CMD PROPLEM -
Andy5 - 20.07.2015
Quote:
Originally Posted by liquor
It will work, as you had it like;
pawn Код:
SetPlayerHealth(playerid,0.0);
and 'playerid' returns YOUR playerid since YOU executed the command, but you specified the target id as 'playerb' in the sscanf function :P
|
ahaa , You Are Right , Thanks