CMD PROPLEM
#1

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 ?
Reply
#2

Код:
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.
Reply
#3

ok thanks , i will try it and i will tell you if its working
Reply
#4

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
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)