Object destroys when other player spawns the object - 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: Object destroys when other player spawns the object (
/showthread.php?tid=426283)
Object destroys when other player spawns the object -
Admigo - 28.03.2013
Hi all,
I am using a spikestrip include and i modifed it.
But now when i place a spikestrip and someone else place one to mine spikestrip will be destroyed.
Include:
pawn Код:
#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] = CreateObject(2899, 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 DeleteStrip(playerid)
{
for(new i = 0; i < sizeof(SpikeInfo); i++)
{
if(IsPlayerInRangeOfPoint(playerid, 20000.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;
}
Command:
pawn Код:
dcmd_spikestrip(playerid,params[])
{
#pragma unused params
if(gTeam[playerid]!=TEAM_COP)
{
SendClientMessage(playerid,COLOR_RED,"Only Police Officers can place Spikestrips!");
return 1;
}
else if(gTeam[playerid]==TEAM_COP)
{
if(HasPlacedSpikestripRecently[playerid]>=1)
{
SendClientMessage(playerid,COLOR_RED,"Please wait before placing a spikestrip again.");
return 1;
}
DeleteStrip(playerid);
new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
GetPlayerPos(playerid, plocx, plocy, plocz);
GetPlayerFacingAngle(playerid,ploca);
CreateStrip(plocx,plocy,plocz,ploca);
HasPlacedSpikestripRecently[playerid]=60;
return 1;
}
return 1;
}
How can i fix this?
Admigo
Re: Object destroys when other player spawns the object -
Admigo - 29.03.2013
Anyone?