#1

My /slap command is bugged, when i type /slap it always slap myself.
Doesn't matter who type /slap (only admins ofc) will be slapping themselves not others players.

Here's the command:

pawn Код:
if(strcmp(cmd, "/slap", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
            if (PlayerInfo[playerid][pAdmin] >= 1)
            {
                new Float:slx, Float:sly, Float:slz;
                GetPlayerPos(playerid, slx, sly, slz);
                SetPlayerPos(playerid, slx, sly, slz+5);
                PlayerPlaySound(playerid, 1130, slx, sly, slz+5);
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "You are not an administrator");
            }
        }
        return 1;
    }
Reply
#2

Lol, it's because you're slapping yourself...
GetPlayerPos(playerid, slx, sly, slz);
SetPlayerPos(playerid, slx, sly, slz+5);
PlayerPlaySound(playerid, 1130, slx, sly, slz+5);

pawn Код:
if(strcmp(cmdtext, "/slap", true) == 0)
   {
       if (PlayerInfo[playerid][pAdmin] < 1)
           return SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "You are not an administrator");
       if(cmdtext[5] != 32 || cmdtext[6] == EOS)
           return SendClientMessage(playerid, COLOR_RED, "USAGE: \"* LarzI slaps [playerid] around a bit with a large trout.\"");
       if(!IsPlayerConnected(strval(cmdtext[6])))
           return SendClientMessage(playerid, COLOR_RED, "Invalid ID!");
       new Float:slx, Float:sly, Float:slz;
       GetPlayerPos(strval(cmdtext[6]), slx, sly, slz);
       SetPlayerPos(strval(cmdtext[6]), slx, sly, slz+5);
       PlayerPlaySound(strval(cmdtext[6]), 1130, slx, sly, slz+5);
       return 1;
   }
Try that one
Reply
#3

Were do you put the code??!?!? please pm me
Reply
#4

lol, under OnPlayerCommandText
Reply
#5

Quote:
Originally Posted by Madbullet
Were do you put the code??!?!? please pm me
At the same place where it was before.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)