Problem with slap command
#1

Okay here is a slap command dropped from Ladmin. The problem is that when i type slap it slaps me. I dont see the USE . I tried to do this and i see the USE but i cant slap anyone.
Код:
if(strlen(params)) return SendClientMessage(playerid, red, "USE: /slap [playerid] [reason/with]");
pawn Код:
COMMAND:slap(playerid, params[])
{
   if(PlayerInfo[playerid][LoggedIn] == 1)
   {
        if(PlayerInfo[playerid][Level] >= 2)
        {
            new tmp[256], tmp2[256], Index;     tmp = strtok(params,Index), tmp2 = strtok(params,Index);
            if(!strlen(params)) return SendClientMessage(playerid, red, "USE: /slap [playerid] [reason/with]");
            new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
            player1 = strval(tmp);
           
            if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
             {
                GetPlayerName(player1, playername, sizeof(playername));
                GetPlayerName(playerid, adminname, sizeof(adminname));
                new Float:Health;
                new Float:x, Float:y, Float:z;
                GetPlayerHealth(player1,Health);
                SetPlayerHealth(player1,Health-25);
                GetPlayerPos(player1,x,y,z);
                SetPlayerPos(player1,x,y,z+5);
                PlayerPlaySound(playerid,1190,0.0,0.0,0.0);
                PlayerPlaySound(player1,1190,0.0,0.0,0.0);

                if(strlen(tmp2))
                {
                format(string,sizeof(string),"* You have been slapped by %s Reason%s",adminname,params[2]);
                SendClientMessage(player1,COLOR_LRED,string);
                format(string,sizeof(string),"You have slapped: %s Reason:%s)",playername,params[2]);
                return SendClientMessage(playerid,red,string);
                }
                else
                {
                format(string,sizeof(string),"You have been slapped by %s ",adminname);
                SendClientMessage(player1,red,string);
                format(string,sizeof(string),"You have slapped: %s ",playername);
                return SendClientMessage(playerid,orag,string);
                }
            }
            else return SendClientMessage(playerid, red, "Player is not connected.");
        }
        else return SendClientMessage(playerid,red,"You are not admin");
    }
    else return SendClientMessage(playerid,red,"You are not logged into your account.");
}
Reply


Messages In This Thread
Problem with slap command - by ZamaXor - 26.10.2010, 21:16
Re: Problem with slap command - by [L3th4l] - 26.10.2010, 21:26
Re: Problem with slap command - by Crayon - 26.10.2010, 22:25
Re: Problem with slap command - by Crayon - 26.10.2010, 23:49

Forum Jump:


Users browsing this thread: 1 Guest(s)