GetObjectPos problem
#1

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;

Reply
#2

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

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)