SA-MP Forums Archive
How to put an object on my place? - 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: How to put an object on my place? (/showthread.php?tid=626439)



How to put an object on my place? - TobiasJones - 15.01.2017

Hello, I would like to know how to put an object on my position as when I select the object it spawns on my position immediately.

Example:


CreateDynamicObject(playerid, my position, my position, my position, interior id 0)

Thank you.


Re: How to put an object on my place? - Amads - 15.01.2017

https://sampwiki.blast.hk/wiki/Function:GetPlayerPos


Re: How to put an object on my place? - Logic_ - 15.01.2017

PHP код:
CreateObjectOnMyPos(playerid, model)
{
    if(
playerid != INVALID_PLAYER_ID) return 0;
    new 
Float: X, Float: Y, Float: Z, Interior, VWorld;
    
GetPlayerPos(playerid, X, Y, Z);
    
GetPlayerInterior(playerid, Interior);
    
GetPlayerVirtualWorld(playerid, VWorld);
    
CreateDynamicObject(playerid, model, X, Y, Z, 0.0, 0.0, 0.0, VWorld, Interior);
    return 
1;
} 



Re: How to put an object on my place? - SyS - 15.01.2017

Quote:
Originally Posted by Logic_
Посмотреть сообщение
PHP код:
CreateObjectOnMyPos(playerid, model)
{
    if(
playerid != INVALID_PLAYER_ID) return 0;
    new 
Float: X, Float: Y, Float: Z, Interior, VWorld;
    
GetPlayerPos(playerid, X, Y, Z);
    
GetPlayerInterior(playerid, Interior);
    
GetPlayerVirtualWorld(playerid, VWorld);
    
CreateDynamicObject(playerid, model, X, Y, Z, 0.0, 0.0, 0.0, VWorld, Interior);
    return 
1;
} 
That's not going to work see the if condition. Also it would be better to create it in front of the player rather putting it on his position.