Spawning objects infront of player
#1

Hello SA-MP community,

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

thanks.
Reply
#2

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);
Reply
#3

show me how it looks please.
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)