help with code
#1

will this code do that if i will do /kill it will kill me but if i will do /kill [ID] it will kill another players?
(without any special includes or stocks)
:
pawn Код:
if(strcmp(cmd, "/kill",true) == 0)
    {
        new sid[256], id;
        sid = strtok(cmdtext,idx);
        if(!strlen(sid))
        {
            SetPlayerHealth(playerid, 0);
            return 1;
        }
        id = ReturnID(sid);
        SetPlayerHealth(id, 0);
        return 1;
    }
Reply
#2

i use zcmd+sscanf for it

pawn Код:
CMD:kill(playerid,params[])
{
    new pID;
    if(!IsPlayerAdmin(playerid)
    {
        SetPlayerHealth(playerid,0.00);
    }
        if(sscanf(params,"d",pID)) return SendClientMessage(playerid,-1,"use /kill id");
        {
            SetPlayerHealth(pID,0.0);
        }
    }
     return 1;
}
not tested and sry for noob struc but i write it with my xperia
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)