SA-MP Forums Archive
Cone - 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: Cone (/showthread.php?tid=497194)



Cone - TLN - 25.02.2014

Well, I made this command /cone, but it creates the cone in air..


pawn Код:
stock CreateCone(playerid, Float:x, Float:y, Float:z, Float:Angle)
{
    for(new i = 0; i < sizeof(cInfo); i++)
    {
        if(cInfo[i][cCreated] == 0)
        {
            cInfo[i][cCreated] = 1;
            cInfo[i][cOwner] = playerid;
            cInfo[i][cObject] = CreateObject(1238, x, y, z, 0.0, 0.0, Angle);
            return 1;
        }
    }
    return 0;
}



Re: Cone - MattTucker - 25.02.2014

Just add
pawn Код:
GetPlayerPos(playerid, x,y,z);
GetPlayerFacingAngle(playerid,angle);
On top of "cInfo[i][created] = 1;" thing.


Respuesta: Cone - CuervO - 25.02.2014

Assuming you're using a player's position, player's Z position is not exactly the ground, it's always a unit or two higher than the ground, where the center of the body is actually at.

Lower the object you're trying to place.


Re: Cone - TLN - 25.02.2014

Added what you said above still the same problem.

I have this in the /cone command.
pawn Код:
GetPlayerPos(playerid, X, Y, Z);
    GetPlayerFacingAngle(playerid, A);
    CreateCone(playerid, X, Y, Z, A);



Re: Cone - Patrick - 25.02.2014

He means, decrease the Object Pos Z, because GetPlayerPos gets the position from the players body, try this code, if it's too low increase it, just do some experiment.

pawn Код:
stock CreateCone(playerid, Float:x, Float:y, Float:z, Float:Angle)
{
    for(new i = 0; i < sizeof(cInfo); i++)
    {
        if(!cInfo[i][cCreated])
        {
            cInfo[ i ][ cCreated ] = 1;
            cInfo[ i ][ cOwner ] = playerid;
            cInfo[ i ][ cObject ] = CreateObject(1238, x, y, z - 0.8, 0.0, 0.0, Angle);
            return 1;
        }
    }
    return 0;
}



Re: Cone - TLN - 25.02.2014

Oh well, I'll increase it a bit, but works and thank you guys.