Tire popping problem.
#1

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;
}
Reply
#2

if(SpikeInfo[i][sCreated] == 1)


That line is the issue. Change the 1 to 0
Reply
#3

PHP код:
stock CreateStrip(Float:x,Float:y,Float:z,Float:Angle)
{
    for(new 
0sizeof(SpikeInfo); i++)
    {
        if(
SpikeInfo[i][sCreated] == 0)
        {
            
SpikeInfo[i][sCreated] = 1;
            
SpikeInfo[i][sX] = x;
            
SpikeInfo[i][sY] = y;
            
SpikeInfo[i][sZ] = 0.7;
            
SpikeInfo[i][sObject] = CreateObject(2892xy0.900Angle-90);
            return 
1;
        }
    }
    return 
0;
}
enum zsInfo
{
    
sCreated,
    
Float:sX,
    
Float:sY,
    
Float:sZ,
    
sObject,
};
new 
SpikeInfo[MAX_SPIKESTRIPS][zsInfo];
encode_tires(tires1tires2tires3tires4)
{
    return 
tires1 | (tires2 << 1) | (tires3 << 2) | (tires4 << 3);
}
CMD:spike(playeridparams[])
{
    new 
FloatplocxFloatplocyFloatploczFloatploca;
    
GetPlayerPos(playeridplocxplocyplocz);
    
GetPlayerFacingAngle(playeridploca);
    
CreateStrip(plocxplocyploczploca);
    return 
1;

Reply
#4

Thanks. I can't believe, I missed that little thing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)