14.01.2011, 15:51
I need help with "IsPlayerInRangeOfPoint"
When i im close to a spike, then i can delete it...
When i im close to a spike, then i can delete it...
pawn Code:
#include <a_samp>
new Spike[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mspike", cmdtext, true, 10) == 0)
{
PlaceSpike(playerid); //Places a spike
SendClientMessage(playerid, 0xFF0000FF, "Spike Placed");
return 1;
}
if (strcmp("/rspike", cmdtext, true, 10) == 0)
{
if(!IsPlayerInRangeOfPoint(playerid, 1.0, 0, 0, 0)) return SendClientMessage(playerid, 0xFF0000FF, "You is not close to ant spikes");
{
RemoveSpike(playerid); //Remove the spike he is close to.
SendClientMessage(playerid, 0xFF0000FF, "Spike Removed");
return 1;
}
}
if (strcmp("/rallspike", cmdtext, true, 10) == 0)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
RemoveSpike(i); //Removes all spikes
SendClientMessage(playerid, 0xFF0000FF, "All spikes have been removed");
return 1;
}
}
return 0;
}
stock PlaceSpike(playerid)
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
Spike[playerid] = CreateObject(1593, X, Y, Z, 0.0, 0.0, 0.0);
PlayerPlaySound(playerid, 1137, X, Y, Z);
}
stock RemoveSpike(playerid)
{
Spike[playerid] = DestroyObject(Spike[playerid]);
}