slap command
#3

I'm not mature with commands OnPlayerCommandText, So I used Zcmd and sscanf, Here you go
pawn Код:
CMD:slap(playerid, params[])
{
    new id, reason[30];
    if(sscanf(params, "is[30]", id, reason)) return SendClientMessage(playerid, -1, "Usage: /Slap [id] [reason]");
    if(strlen(reason) < 1 || strlen(reason) > 30) return SendClientMessage(playerid, -1, "reason length must be between 1 - 30 characters");

    if (PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GRAD1, "Your level isn't high enough to use this command");
    if(!IsPlayerConnected(id) || id != INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_GRAD1, "Nemate pristup ovoj komandi!");

    new Name[2][MAX_PLAYER_NAME],
        Float:H,
        Float:Pos[3],
        string[128];
       
    GetPlayerName(playerid, Name[0], MAX_PLAYER_NAME);
    GetPlayerName(id, Name[1], MAX_PLAYER_NAME);
   
    GetPlayerHealth(id, H);
    SetPlayerHealth(id, H-5);
   
    GetPlayerPos(id, Pos[0], Pos[1], Pos[2]);
    SetPlayerPos(id, Pos[0], Pos[1], Pos[2]+5);
    PlayerPlaySound(id, 1130, Pos[0], Pos[1], Pos[2]+5);
    printf("[SLAP] %s je osamaren od strane Admina.",Name[0], Name[1]);
    format(string, sizeof(string), "[SLAP] %s je osamaren od strane Admina ",Name[1], Name[0]);
    BroadCast(COLOR_LIGHTRED,string);
    return 1;
}
Reply


Messages In This Thread
slap command - by Felipee - 28.11.2013, 17:07
Re: slap command - by Felipee - 30.11.2013, 13:06
Re: slap command - by xVIP3Rx - 30.11.2013, 13:27
Re: slap command - by ReApZ - 30.11.2013, 14:10
Re: slap command - by newbie scripter - 30.11.2013, 14:26

Forum Jump:


Users browsing this thread: 1 Guest(s)