ID 0 problem :(
#1

Hi Again guys i was wondering to make my command without putting an ID(for eg. /fishslap 1),i was wondering how to make it just 'fishslap' and it will find the player id,plus i was getting a problem with id 0,each time i try to use this command it works on id 0(player) no one else. Here is my script help will be greatly appreciated : D


if(strcmp(cmd, "/fishslap", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(strlen(tmp) == 0) return SendClientMessage(playerid, ERROR, "Use: /fishslap [ID]");
if(gTeam[playerid] == CIVILIAN)
{
if(playerid != strval(tmp))
{
if(GetDistanceBetweenPlayers(playerid, strval(tmp)) <= 4)
{
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+2);
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


Forum Jump:


Users browsing this thread: 1 Guest(s)