SA-MP Forums Archive
Put an object on players location - 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: Put an object on players location (/showthread.php?tid=518568)



Put an object on players location - XlimitXstudio - 10.06.2014

Hello I want to make a command when player types /house a house will appear next to him. I use CMD.


Re: Put an object on players location - Rufio - 10.06.2014

This is not a script request place, but however I can give you some tips.

Get the house object ID you want to make it appear, then define x,y,z with

pawn Код:
new Float:x,Float:y,Float:z
Then, get the Player's Pos by GetPlayerPos, then create the object on player's coordinates, search wiki for usage of the functions.

These are the URLs:

https://sampwiki.blast.hk/wiki/GetPlayerPos
https://sampwiki.blast.hk/wiki/CreateObject
https://sampwiki.blast.hk/wiki/Floats
https://sampwiki.blast.hk/wiki/Model_ID

Dont forget the put a + to player's pos while creating the object our player might end up getting stuck in the house.


Re: Put an object on players location - Rittik - 10.06.2014

Код:
CMD:house(playerid,params[])
{
 new Float:x,Float:y,Float:z;
 GetPlayerPos(playerid,x,y,z);
 CreateObject(19499, x+10, y+10, z+0.1, 0.0, 0.0, 96.0,250.0);
 return 1;
}



Re: Put an object on players location - XlimitXstudio - 10.06.2014

Thank you Rep