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



GetObjectPos problem - polygxn - 23.02.2019

The problem is when I click the "floppy" icon I got everything back, the checkpoint created but at the same position where I created the ball originally so there is a problem with the GetObjectPos line (I guess). Can someone help me with this?

PHP Code:
new 
    
Float:px,
    
Float:py,
    
Float:pz,
    
cpsize,
    
policecheckpoint,
    
ball,
    
    
Float:ballx,
    
Float:bally,
    
Float:ballz
;
CMD:cptest(playeridparams[])
{
    if(
sscanf(params"i"cpsize)) return UsageTag(playerid"/cptest [SIZE]");
    
GetPlayerPos(playeridFloat:pxFloat:pyFloat:pz);
    
ball CreateObject(1946Float:px+1Float:py+1Float:pz, -1, -1, -13);
    
EditObject(playeridball);
    return 
1;
}
hook OnPlayerEditObject(playeridplayerobjectobjectidresponseFloat:fXFloat:fYFloat:fZFloat:fRotXFloat:fRotYFloat:fRotZ)
{
    if(
objectid == ball)
    {
        if(
response == EDIT_RESPONSE_FINAL)
        {
            
GetObjectPos(ballFloat:ballxFloat:ballyFloat:ballz); 
            
policecheckpoint CreateDynamicCP(Float:ballxFloat:ballyFloat:ballzcpsize, -1, -1, -1100);
            
ServerTag(playerid"edit_response_final called");
            
DestroyObject(ball);
        }
    }
    
    if(
response == EDIT_RESPONSE_CANCEL)
    {
        
DestroyObject(ball);
    }
    return 
1;




Re: GetObjectPos problem - Kane - 23.02.2019

The coordinates are right there for you to use. GetObjectPos is returning its actual position, not the one in editing. You don't need to do that.

pawn Code:
Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ



Re: GetObjectPos problem - polygxn - 23.02.2019

Quote:
Originally Posted by Kane_
View Post
The coordinates are right there for you to use. GetObjectPos is returning its actual position, not the one in editing. You don't need to do that.

pawn Code:
Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ
Holy...Im dumb. Thank you!