[HELP] Spike
#7

pawn Code:
#include <a_samp>
enum SPIKE_DATA{
    Float:X,Float:Y,Float:Z,ID};
new Spike[MAX_PLAYERS][SPIKE_DATA];

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, Spike[playerid][X], Spike[playerid][Y], Spike[playerid][Z])) return SendClientMessage(playerid, 0xFF0000FF, "You is not close to ant spikes");
        else {
            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][ID] = CreateObject(1593, X, Y, Z, 0.0, 0.0, 0.0);
    Spike[playerid][X]=X;Spike[playerid][Y]=Y;Spike[playerid][Z]=Z;
    PlayerPlaySound(playerid, 1137, X, Y, Z);
}

stock RemoveSpike(playerid)
{
    Spike[playerid][ID] = DestroyObject(Spike[playerid]);
}
Reply


Messages In This Thread
[HELP] Spike - by Larsey123IsMe - 14.01.2011, 15:51
Re: [HELP] Spike - by RSX - 14.01.2011, 16:00
Re: [HELP] Spike - by Toreno - 14.01.2011, 16:01
Re: [HELP] Spike - by RSX - 14.01.2011, 16:06
Re: [HELP] Spike - by Toreno - 14.01.2011, 16:08
Re: [HELP] Spike - by Larsey123IsMe - 14.01.2011, 16:09
Re: [HELP] Spike - by RSX - 14.01.2011, 16:17
Re: [HELP] Spike - by Larsey123IsMe - 14.01.2011, 16:26
Re: [HELP] Spike - by RSX - 14.01.2011, 16:34
Re: [HELP] Spike - by Larsey123IsMe - 14.01.2011, 16:49

Forum Jump:


Users browsing this thread: 3 Guest(s)