SA-MP Forums Archive
Creating Spike Strips 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Creating Spike Strips problem. (/showthread.php?tid=269617)



Creating Spike Strips problem. - Jack_Leslie - 17.07.2011

So I have a /deployspikes command, everything works fine because I get the confirmation message that I've planted a Spike Strip, but it doesn't actually create and appear.

Here's the code when you do /deployspikes:
pawn Код:
new Float:plocx,Float:plocy,Float:plocz,Float:ploca;
        GetPlayerPos(playerid,plocx,plocy,plocz);
        GetPlayerFacingAngle(playerid,ploca);
        new location[MAX_ZONE_NAME];
        GetPlayer2DZone(playerid, location, MAX_ZONE_NAME);
        new Float:x, Float:y, Float:z, Float:angle;
        GetPlayerFacingAngle(playerid, angle);
        GetPlayerPos(playerid, x, y, z);
          CreateStrip(x, y, z, angle);
        format(string, sizeof(string), "HQ: %s %s has placed a spike strip at %s",      GetPlayerRank(playerid),PlayerName(playerid), location);
        SendRadioMessage(1, TEAM_BLUE_COLOR, string);
        SendRadioMessage(2, TEAM_BLUE_COLOR, string);
        SendRadioMessage(3, TEAM_BLUE_COLOR, string);
        SendRadioMessage(5, TEAM_BLUE_COLOR, string);
        ApplyAnimation(playerid, "BOMBER","BOM_Plant_Loop",4.0,0,0,0,0,0); // Plant bomb
        GetPlayerFacingAngle(playerid,ploca);
        CreateStrip(plocx,plocy,plocz,ploca);
Here's the stock for CreateStrip:
pawn Код:
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;
}



Re: Creating Spike Strips problem. - Jochemd - 17.07.2011

Use a streamer such as Incognito's Streamer Plugin, maybe it'll work then.

Linkylink


Re: Creating Spike Strips problem. - Jack_Leslie - 17.07.2011

Yeah, I'm using that.


Re: Creating Spike Strips problem. - Jochemd - 17.07.2011

Use it in that stock too..

pawn Код:
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,100.0);
            break;
        }
    }
    return 0;
}
At least I recommend you to break the stock, or it may continue with the loop when you created the spike strip


Re: Creating Spike Strips problem. - Jack_Leslie - 17.07.2011

How do you use a plugin in a stock? ^_^


Re: Creating Spike Strips problem. - Jochemd - 17.07.2011

Try the code I posted above, it may work now.


Re: Creating Spike Strips problem. - Jack_Leslie - 17.07.2011

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
Try the code I posted above, it may work now.
Oh yah didn't see that, I'll test it now, sec.

EDIT:

Nope.


Re: Creating Spike Strips problem. - Jochemd - 17.07.2011

I guess you create it under the ground... Try removing that -0.7 from Z


Re: Creating Spike Strips problem. - Jack_Leslie - 17.07.2011

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
I guess you create it under the ground... Try removing that -0.7 from Z
Did, didn't change anything.


Re: Creating Spike Strips problem. - Jochemd - 17.07.2011

Then I do not know anymore :S