/spike help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /spike help (
/showthread.php?tid=340963)
/spike help -
calin1996 - 09.05.2012
If i put a spike,when i take it with /rask or /rsk,the spike is still there...
Comands:
pawn Code:
if(strcmp(cmd, "///spikema", true) ==0 || strcmp(cmd, "///skma", true) ==0)
{
if(IsPlayerConnected(playerid))
{
if(IsACop(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_GREY, " Nu poti intinde banda de tepi din masina!");
return 1;
}
new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
GetPlayerPos(playerid, plocx, plocy, plocz);
GetPlayerFacingAngle(playerid,ploca);
CreateStrip(plocx,plocy,plocz,ploca);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Nu esti politist!");
}
}
}
if(strcmp(cmd, "/removespikes", true) ==0 || strcmp(cmd, "/rsk", true) ==0)
{
if(IsPlayerConnected(playerid))
{
if(IsACop(playerid))
{
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid, COLOR_GREY, " Nu poti inlatura banda de tepi din masina!");
return 1;
}
DeleteClosestStrip(playerid);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Nu esti politist!");
}
}
}
if(strcmp(cmd, "/remallspikes", true) ==0 || strcmp(cmd, "/rask", true) ==0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pRank] >= 5 && IsACop(playerid))
{
DeleteAllStrip();
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "DISPECER: Toate blocajele cu tepi din zona aiu fost scoase din ordinul lui %s.", sendername);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(IsACop(i))
{
SendClientMessage(i, TEAM_BLUE_COLOR, string);
}
}
}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Nu esti politist si sa ai peste grad 5!");
}
}
}
And the include:
pawn Code:
#include <a_samp>
#define MAX_SPIKESTRIPS 200
enum sInfo
{
sCreated,
Float:sX,
Float:sY,
Float:sZ,
sObject,
};
new SpikeInfo[MAX_SPIKESTRIPS][sInfo];
stock CreateStrip(Float:x,Float:y,Float:z,Float:Angle)
{
for(new i = 0; i < sizeof(SpikeInfo); i++)
{
if(SpikeInfo[i][sCreated] == 0)
{
SpikeInfo[i][sCreated]=1;
SpikeInfo[i][sX]=x;
SpikeInfo[i][sY]=y;
SpikeInfo[i][sZ]=z-0.7;
SpikeInfo[i][sObject] = CreateDynamicObject(2899, x, y, z-0.9, 0, 0, Angle-90,-1, -1, -1, 500);
//SpikeInfo[i][sObject] = CreateObject(1593, x, y, z-0.9, 0, 0, Angle-90);
//SpikeInfo[i][sObject] = CreateObject(2892, x, y, z-0.9, 0, 0, Angle-90);
return 1;
}
}
return 0;
}
stock DeleteAllStrip()
{
for(new i = 0; i < sizeof(SpikeInfo); i++)
{
if(SpikeInfo[i][sCreated] == 1)
{
SpikeInfo[i][sCreated]=0;
SpikeInfo[i][sX]=0.0;
SpikeInfo[i][sY]=0.0;
SpikeInfo[i][sZ]=0.0;
DestroyObject(SpikeInfo[i][sObject]);
}
}
return 0;
}
stock DeleteClosestStrip(playerid)
{
for(new i = 0; i < sizeof(SpikeInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, SpikeInfo[i][sX], SpikeInfo[i][sY], SpikeInfo[i][sZ]))
{
if(SpikeInfo[i][sCreated] == 1)
{
SpikeInfo[i][sCreated]=0;
SpikeInfo[i][sX]=0.0;
SpikeInfo[i][sY]=0.0;
SpikeInfo[i][sZ]=0.0;
DestroyObject(SpikeInfo[i][sObject]);
return 1;
}
}
}
return 0;
}
encode_tires(tires1, tires2, tires3, tires4) {
return tires1 | (tires2 << 1) | (tires3 << 2) | (tires4 << 3);
}