Id 0 cant use command everyone else can
#1

Hey again guys,i made a slap command and it works fine but id 0 can`t use it,it keeps saying 'You cannot fishslap yourself!'

Here is my script please help ....

if(strcmp(cmd, "/fishslap", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(gTeam[playerid] == CIVILIAN)
{
if(playerid != strval(tmp))
{

if(GetDistanceBetweenPlayers(playerid, strval(tmp)) <= 4)
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerSpawned(playerid))
{
if(IsPlayerSpawned(strval(tmp)))
{
if(!IsPlayerInAnyVehicle(playerid))
{
if(!IsPlayerInAnyVehicle(strval(tmp)))
{
new ID;
new Float:health;
new Float, Float:y, Float:z, string[100];
if(GetPVarInt(playerid,"CMDABUSE1")>GetTickCount() ) return SendClientMessage(playerid,0xFF0000AA,"Please Wait Before Fish Slapping Someone Again.");
SetPVarInt(playerid,"CMDABUSE1",GetTickCount()+600 00);
GetPlayerPos(ID, x, y, z);
SetPlayerPos(ID, x, y, z+1.5);
GetPlayerHealth(ID,health);
SetPlayerHealth(ID, health-5);
PlayerPlaySound(playerid,1190,0.0,0.0,0.0);
PlayerPlaySound(ID,1190,0.0,0.0,0.0);
format(string, 100, "You have Used Fishslap", name, ID);
SendClientMessage(playerid, COLOR_YELLOW, string);
SetPlayerWantedLevel(playerid,GetPlayerWantedLevel (playerid)+ 1);
return true;
}
else
{
new errormsg[250];
new blown[MAX_PLAYER_NAME];
GetPlayerName(strval(tmp), blown, sizeof(blown));
format(errormsg, sizeof(errormsg), "%s[ID:%d] is in a Vehicle. You cannot fishslap the person inside a vehicle.", blown, strval(tmp));
SendClientMessage(playerid, ERROR, errormsg);
return true;
}
}
else return SendClientMessage(playerid, ERROR, "You cannot fishslap anyone from inside a vehicle.");
}
else
{
new errormsg[250];
new blown[MAX_PLAYER_NAME];
GetPlayerName(strval(tmp), blown, sizeof(blown));
format(errormsg, sizeof(errormsg), "%s[ID:%d] is dead.", blown, strval(tmp));
SendClientMessage(playerid, ERROR, errormsg);
return true;
}
}
else return SendClientMessage(playerid, ERROR, "You are dead.");
}
else return SendClientMessage(playerid, ERROR, "This player is too far away.");
}
else return SendClientMessage(playerid, ERROR, "You cannot fishslap yourself!");
}
else return SendClientMessage(playerid, ERROR, "Only CIVILIANS can fishslap people.");
}
Reply
#2

how to get in the pawn code view?I don't want it to be too frustrating.
Reply
#3

For codes, use: [pawn]
Reply
#4

pawn Код:
if(strcmp(cmd, "/fishslap", true) == 0)
{
     tmp = strtok(cmdtext, idx);
     if(gTeam[playerid] == CIVILIAN)
     {
           if(playerid != strval(tmp))
           {
                if(GetDistanceBetweenPlayers(playerid, strval(tmp)) <= 4)
                for(new i; i < MAX_PLAYERS; i++)
                {
                     if(IsPlayerSpawned(playerid))
                     {
                          if(IsPlayerSpawned(strval(tmp)))
                          {
                               if(!IsPlayerInAnyVehicle(playerid))
                               {
                                    if(!IsPlayerInAnyVehicle(strval(tmp)))
                                    {
                                          new ID;
                                          new Float:health;
                                          new Float, Float:y, Float:z, string[100];
                                          if(GetPVarInt(playerid,"CMDABUSE1")>GetTickCount() ) return                                  SendClientMessage(playerid,0xFF0000AA,"Please Wait Before Fish Slapping Someone Again.");
                                          SetPVarInt(playerid,"CMDABUSE1",GetTickCount()+600 00);
                                          GetPlayerPos(ID, x, y, z);
                                          SetPlayerPos(ID, x, y, z+1.5);
                                          GetPlayerHealth(ID,health);
                                          SetPlayerHealth(ID, health-5);
                                          PlayerPlaySound(playerid,1190,0.0,0.0,0.0);
                                          PlayerPlaySound(ID,1190,0.0,0.0,0.0);
                                          format(string, 100, "You have Used Fishslap", name, ID);
                                          SendClientMessage(playerid, COLOR_YELLOW, string);
                                          SetPlayerWantedLevel(playerid,GetPlayerWantedLevel (playerid)+ 1);
                                          return true;
                           }
                                else
                           {
                            new errormsg[250];
                            new blown[MAX_PLAYER_NAME];
                            GetPlayerName(strval(tmp), blown, sizeof(blown));
                            format(errormsg, sizeof(errormsg), "%s[ID:%d] is in a Vehicle. You cannot fishslap the person inside a vehicle.", blown, strval(tmp));
                            SendClientMessage(playerid, ERROR, errormsg);
                            return true;
                       }
                  }
                  else return SendClientMessage(playerid, ERROR, "You cannot fishslap anyone from inside a vehicle.");
                  }
                  else
                  {
                  new errormsg[250];
                  new blown[MAX_PLAYER_NAME];
                  GetPlayerName(strval(tmp), blown, sizeof(blown));
                  format(errormsg, sizeof(errormsg), "%s[ID:%d] is dead.", blown, strval(tmp));
                  SendClientMessage(playerid, ERROR, errormsg);
                  return true;
             }
     }
     else return SendClientMessage(playerid, ERROR, "You are dead.");
     }
     else return SendClientMessage(playerid, ERROR, "This player is too far away.");
     }
     else return SendClientMessage(playerid, ERROR, "You cannot fishslap yourself!");
     }
else return SendClientMessage(playerid, ERROR, "Only CIVILIANS can fishslap people.");
}
Best I could do, use tags next please.
Reply
#5

TY for the pawn code,still need help though lol
Reply
#6

none of that even says anything like 'You cannot fishslap yourself!'
so its prob not this bit of code do you have something else maybe at the start of all your commands that
wont let any command be used on the user?
Reply
#7

yes it does lol, it sais it at the bottom.
Reply
#8

pawn Код:
if(playerid != strval(tmp))
Before using this, check if the player even entered something after the command, /bitchslap is now the same as /bitchslap 0

pawn Код:
if(IsPlayerSpawned(playerid))
...
if(!IsPlayerInAnyVehicle(playerid))
Don't check them in a loop, once is enough ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)