Tire popping problem. - 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: Tire popping problem. (
/showthread.php?tid=385039)
Tire popping problem. -
tsonn1 - 14.10.2012
Hi!
I've got a little problem with my spikestrip function.
When I type /spike, the strip doesn't appear.
The stock function:
pawn Код:
stock CreateStrip(Float:x,Float:y,Float:z,Float:Angle)
{
for(new i = 0; i < sizeof(SpikeInfo); i++)
{
if(SpikeInfo[i][sCreated] == 1)
{
SpikeInfo[i][sCreated]=1;
SpikeInfo[i][sX]=x;
SpikeInfo[i][sY]=y;
SpikeInfo[i][sZ]=z-0.7;
SpikeInfo[i][sObject] = CreateObject(2892, x, y, z-0.9, 0, 0, Angle-90);
return 1;
}
}
return 0;
}
The enum:
pawn Код:
enum zsInfo
{
sCreated,
Float:sX,
Float:sY,
Float:sZ,
sObject,
};
new SpikeInfo[MAX_SPIKESTRIPS][zsInfo];
encode_tires(tires1, tires2, tires3, tires4) {
return tires1 | (tires2 << 1) | (tires3 << 2) | (tires4 << 3);
}
The command:
pawn Код:
CMD:spike(playerid, params[])
{
new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
GetPlayerPos(playerid, plocx, plocy, plocz);
GetPlayerFacingAngle(playerid,ploca);
CreateStrip(plocx,plocy,plocz,ploca);
return 1;
}
Re: Tire popping problem. -
ikkentim - 14.10.2012
if(SpikeInfo[i][sCreated] == 1)
That line is the issue. Change the 1 to 0
Re: Tire popping problem. -
RedJohn - 14.10.2012
PHP код:
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(2892, x, y, z - 0.9, 0, 0, Angle-90);
return 1;
}
}
return 0;
}
enum zsInfo
{
sCreated,
Float:sX,
Float:sY,
Float:sZ,
sObject,
};
new SpikeInfo[MAX_SPIKESTRIPS][zsInfo];
encode_tires(tires1, tires2, tires3, tires4)
{
return tires1 | (tires2 << 1) | (tires3 << 2) | (tires4 << 3);
}
CMD:spike(playerid, params[])
{
new Float: plocx, Float: plocy, Float: plocz, Float: ploca;
GetPlayerPos(playerid, plocx, plocy, plocz);
GetPlayerFacingAngle(playerid, ploca);
CreateStrip(plocx, plocy, plocz, ploca);
return 1;
}
Re: Tire popping problem. -
tsonn1 - 14.10.2012
Thanks. I can't believe, I missed that little thing.