Need help with /slap
#1

Any way to stop slapping myself?


pawn Код:
if(strcmp(cmd, "/slap", true) == 0)// Saurabh
    {
      if(IsPlayerConnected(playerid))
      {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_PINK, "USAGE: /slap [playerid/PartOfName]");
                return 1;
            }
            new playa;
            new Float:i;
            new Float:x, Float:y, Float:z;
            if (PlayerInfo[playerid][pAdmin] >=1)
            {
              if(IsPlayerConnected(playa))
              {
                if(playa != INVALID_PLAYER_ID)
                {
                        GetPlayerHealth(playa, i);
                        SetPlayerHealth(playa, i-10);
                        GetPlayerPos(playa, x, y, z);
                        SetPlayerPos(playa, x, y, z+10);
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_PINK, "  you are not authorized to use that command!");
            }
        }
        return 1;
    }
Reply
#2

He means, he needs to know how to define 'playa' as giveplayerid, not playerid.


Help please
Reply
#3

pawn Код:
new playa = strval(tmp);
Reply
#4

didnt work
Reply
#5

pawn Код:
new Float:i;
new Float:x, Float:y, Float:z;
giveplayerid = strval(tmp);
new tmp[128], string[128], cmd[128], idx, giveplayerid, sendername, giveplayer;
cmd = strtok(cmdtext, idx);
GetPlayerName(playerid, sendername, sizeof(sendername));

if(strcmp(cmd, "/ban", true) == 0)
{
  if (PlayerInfo[playerid][pAdmin] =0) return SendClientMessage(playerid, 0x919191FF, "BE ADMIN!"); // when player isn't admin, don't let to use command
  tmp = strtok(cmdtext, idx); // We assign that we use strtok in this command to 'tmp'
  if(!strlen(tmp)) return SendClientMessage(playerid, 0x919191FF, "USAGE: /slap [id]"); // If no ID is given
  giveplayerid = strval(tmp); // Now we assign the 'giveplayerid'
  if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, 0x919191FF, "That player isn't connected!"); // when 'giveplayerid' isn't online
  GetPlayerHealth(giveplayerid, i);
    SetPlayerHealth(giveplayerid, i-10);
    GetPlayerPos(giveplayerid, x, y, z);
    SetPlayerPos(giveplayerid, x, y, z+10);
  return 1;
}
  }
}
pawn Код:
C:\Users\Saurabh Sharma\Desktop\Extra Stuff\New Folder\gamemodes\Script.pwn(260) : error 017: undefined symbol "giveplayerid"
C:\Users\Saurabh Sharma\Desktop\Extra Stuff\New Folder\gamemodes\Script.pwn(261) : error 021: symbol already defined: "tmp"
C:\Users\Saurabh Sharma\Desktop\Extra Stuff\New Folder\gamemodes\Script.pwn(262) : error 047: array sizes do not match, or destination array is too small
C:\Users\Saurabh Sharma\Desktop\Extra Stuff\New Folder\gamemodes\Script.pwn(263) : error 035: argument type mismatch (argument 2)
C:\Users\Saurabh Sharma\Desktop\Extra Stuff\New Folder\gamemodes\Script.pwn(263) : error 035: argument type mismatch (argument 2)
C:\Users\Saurabh Sharma\Desktop\Extra Stuff\New Folder\gamemodes\Script.pwn(267) : warning 211: possibly unintended assignment
C:\Users\Saurabh Sharma\Desktop\Extra Stuff\New Folder\gamemodes\Script.pwn(268) : error 047: array sizes do not match, or destination array is too small
C:\Users\Saurabh Sharma\Desktop\Extra Stuff\New Folder\gamemodes\Script.pwn(261) : warning 203: symbol is never used: "giveplayer"
C:\Users\Saurabh Sharma\Desktop\Extra Stuff\New Folder\gamemodes\Script.pwn(261) : warning 203: symbol is never used: "sendername"
C:\Users\Saurabh Sharma\Desktop\Extra Stuff\New Folder\gamemodes\Script.pwn(261) : warning 204: symbol is assigned a value that is never used: "string"
C:\Users\Saurabh Sharma\Desktop\Extra Stuff\New Folder\gamemodes\Script.pwn(261 -- 278) : warning 209: function "OnPlayerCommandText" should return a value
C:\Users\Saurabh Sharma\Desktop\Extra Stuff\New Folder\gamemodes\Script.pwn(261 -- 279) : error 054: unmatched closing brace ("}")
C:\Users\Saurabh Sharma\Desktop\Extra Stuff\New Folder\gamemodes\Script.pwn(261 -- 318) : error 010: invalid function or declaration
C:\Users\Saurabh Sharma\Desktop\Extra Stuff\New Folder\gamemodes\Script.pwn(261 -- 318) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)