SA-MP Forums Archive
Command not working :P - 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: Command not working :P (/showthread.php?tid=445645)



Command not working :P - San1 - 22.06.2013

This command wont let me enter a ID, everytime i use it, it just kills me and dont let me enter a player id.. idk whats wrong help me plz

pawn Код:
CMD:akill(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 4) return SCM(playerid, COLOR_RED, "You are not authorized to use this command");
    new targetid, string[128], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pname,sizeof(pname));
    if(sscanf(params, "u", targetid)) SendClientMessage(playerid, COLOR_FADE1, "USAGE:kill [playerid]");
    if(!IsPlayerConnected(targetid)) return SCM(playerid, COLOR_RED, "invalid player id!");
    format(string, sizeof(string), "You have admin killed player %s ", pname);
    SendClientMessage(playerid, COLOR_YELLOW, string);
    SetPlayerHealth(targetid,0.0);
    return 1;
}



Re: Command not working :P - Sulps - 22.06.2013

Change
pawn Код:
if(sscanf(params, "u", targetid)) SendClientMessage(playerid, COLOR_FADE1, "USAGE:kill [playerid]");
to
pawn Код:
if(sscanf(params, "us", targetid)) SendClientMessage(playerid, COLOR_FADE1, "USAGE:kill [playerid]");



Re: Command not working :P - San1 - 22.06.2013

Quote:
Originally Posted by Sulps
Посмотреть сообщение
Change
pawn Код:
if(sscanf(params, "u", targetid)) SendClientMessage(playerid, COLOR_FADE1, "USAGE:kill [playerid]");
to
pawn Код:
if(sscanf(params, "us", targetid)) SendClientMessage(playerid, COLOR_FADE1, "USAGE:kill [playerid]");
Still just killing me..


Re: Command not working :P - CaRa - 22.06.2013

Код:
 CMD:akill(playerid, params[])
{

   new string[128], playerto, sendername[MAX_PLAYER_NAME] ,giveplayer[MAX_PLAYER_NAME];
   
   if(sscanf(params, "u", playerto)) return SendClientMessage(playerid, COLOR_ORANGE, "{F97804}USAGE:{B4B5B7}{FFFFFF} /akill [playerid/PartOfName]");
   if(!IsPlayerConnected(playerto)) return SendClientMessage(playerid, COLOR_GRAD1,"Invalid player !");
   GetPlayerName(playerto, giveplayer, sizeof(giveplayer));
   GetPlayerName(playerid, sendername, sizeof(sendername));
   format(string, sizeof(string), "You have admin killed player %s ", sendername);
   SendClientMessage(playerid, COLOR_YELLOW, string);
   SetPlayerHealth(playerto, 0);
   return 1;
}



Re: Command not working :P - Sulps - 22.06.2013

try this
pawn Код:
command(kill, playerid, params[])
{
     new PID;
    if(PlayerInfo[playerid][pAdmin] < 4) return return SCM(playerid, COLOR_RED, "You are not authorized to use this command");
    if(sscanf(params, "u", PID)) return SendClientMessage(playerid, COLOR, "/kill  [ playerid / Name ]");
    return SetPlayerHealth(PID, 0);
}