SA-MP Forums Archive
Spawning objects infront of player - 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: Spawning objects infront of player (/showthread.php?tid=467271)



Spawning objects infront of player - Voxel - 02.10.2013

Hello SA-MP community,

How do i make it so when a player types /barricade a wall spawns in front of him?

thanks.


Re: Spawning objects infront of player - Tom1412 - 02.10.2013

you use createobject, so you get the x,y,z of the player then use + in the cords for the createobject.

pawn Код:
createobject(objectid, x+5,y,z,a);



Re: Spawning objects infront of player - Voxel - 02.10.2013

show me how it looks please.


Re: Spawning objects infront of player - Tom1412 - 03.10.2013

Here you go, hope this works for you.

pawn Код:
CMD:barricade(playerid,params[])
{
        new Float:x, Float:y, Float:z;
        new Float:a;
    GetPlayerPos(playerid, x, y, z);
    GetPlayerFacingAngle(playerid, a);
    CreateObject(969, x+5,y,z,0,0,a); // change the object id
    SendClientMessage(playerid, -1, "You have spawned a barrier in.");
    return 1;
}