/slap command
#5

pawn Код:
COMMAND:slap(playerid, params[])
{
    new string[208 + MAX_PLAYER_NAME],PlayerN[MAX_PLAYER_NAME],OtherN[MAX_PLAYER_NAME];
    new Float:x, Float:y, Float:z;
    if(AccountInfo[playerid][AdminLevel] >= 1)
    {
        new targetid,String[156];
        if(sscanf(params,"us", targetid,String)) return SendClientMessage(playerid, COLOR_WHITE, ""WHITE"Usage: "GREEN"/slap "WHITE"[playerid] [REASON]");
        if(targetid == playerid) return SendClientMessage(playerid, COLOR_RED, "You Can't Slap Yourself !");
        if(AccountInfo[playerid][AdminLevel] < AccountInfo[targetid][AdminLevel]) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You can't use this command on A Higher Level Admin Then You!");
        if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid PlayerID"RED"(Player Not Connected)!");
        if(String <= 4) return SendClientMessage(playerid, COLOR_RED, "Your Reason Needs To Be More Than 4 Characters");
        GetPlayerName(playerid,PlayerN,sizeof(PlayerN));
        GetPlayerName(targetid,OtherN,sizeof(OtherN));
        GetPlayerPos(OtherN,x,y,z);
        SetPlayerPos(OtherN,z,y,z +5);
        format(string, sizeof(string), ""BLUE"\"%s\""RED" Was Slaped By Admin "BLUE"\"%s\""RED" Reason: %s", OtherN, PlayerN,String);
        SendClientMessageToAll(COLOR_BRIGHTRED, string);
        printf("\"%s\"Was Slapped By Admin \"%s\" Reason %s",OtherN, PlayerN,String);
    }
    else
    {
        SendClientMessage(playerid,COLOE_WHITE,"You Are Not Hight Enough level to use this Command");
    }
    return 1;
}
Could it be because of these?

pawn Код:
if(AccountInfo[playerid][AdminLevel] < AccountInfo[playerid][AdminLevel]) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You can't use this command on A Higher Level Admin Then You!");

//and

if(String[0] <= 4) return SendClientMessage(playerid, COLOR_RED, "Your Reason Needs To Be More Than 4 Characters");
Why would you check if your admin level is lower then your admin level? Changed the playerid to a targetid.

And not positive, haven't scripted in a while, but why would you write String[0] if the string length is already defined.

Plus, you made the player/target name variables [MAX_PLAYERS] when it should be [MAX_PLAYER_NAME] I presume.

EDIT: Just saw your new post, it should be:

pawn Код:
GetPlayerPos(targetid,x,y,z);
SetPlayerPos(targetid,z,y,z +5);
Why would you place a name in there?
Reply


Messages In This Thread
/slap command - by [D]ry[D]esert - 08.05.2012, 15:03
Re: /slap command - by [D]ry[D]esert - 08.05.2012, 16:19
Re: /slap command - by doreto - 08.05.2012, 16:24
Re: /slap command - by [D]ry[D]esert - 08.05.2012, 16:27
Re: /slap command - by Kindred - 08.05.2012, 16:28
Re: /slap command - by DamienWalter - 15.05.2012, 12:37
Re: /slap command - by ricardo178 - 15.05.2012, 12:49

Forum Jump:


Users browsing this thread: 7 Guest(s)