Id 0 cant use command everyone else can -
MWhite_005 - 22.07.2011
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.");
}
Re: Id 0 cant use command everyone else can -
MWhite_005 - 22.07.2011
how to get in the pawn code view?I don't want it to be too frustrating.
Re: Id 0 cant use command everyone else can -
Adil - 22.07.2011
For codes, use: [pawn]
Re: Id 0 cant use command everyone else can -
X3nZ - 22.07.2011
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.
Re: Id 0 cant use command everyone else can -
MWhite_005 - 22.07.2011
TY for the pawn code,still need help though lol
Re: Id 0 cant use command everyone else can -
(SF)Noobanatior - 22.07.2011
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?
Re : Id 0 cant use command everyone else can -
rbcrp - 29.01.2012
yes it does lol, it sais it at the bottom.
AW: Id 0 cant use command everyone else can -
Rimeau - 29.01.2012
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 ^^