Problem With Objects
#2

PHP код:
public OnPlayerEditObject(playeridplayerobjectobjectidresponseFloat:fXFloat:fYFloat:fZFloat:fRotXFloat:fRotYFloat:fRotZ)
    {
        new 
Float:oldXFloat:oldYFloat:oldZFloat:oldRotXFloat:oldRotYFloat:oldRotZ;
        
GetDynamicObjectPos(objectidoldXoldYoldZ);
        
GetDynamicObjectRot(objectidoldRotXoldRotYoldRotZ);
        if(!
playerobject// If this is a global object, sync the position for other players
        
{
            if(
response == EDIT_RESPONSE_FINAL)
            {
               for(new 
i=0;i<MAX_OBJ;i++)
               {
                    if(
objectid==gobject[i][oid])
                    {
                        
GetDynamicObjectPos(objectidfXfYfZ);
                        
GetDynamicObjectRot(objectidfRotXfRotYfRotZ);
                        
gobject[i][posx]=fX;
                        
gobject[i][posy]=fY;
                        
gobject[i][posz]=fZ;
                        
gobject[i][rotx]=fRotX;
                        
gobject[i][roty]=fRotY;
                        
gobject[i][rotz]=fRotZ;
                        
printf("=====================\n");
                        
printf("Object Edited ID: %d\n",i);
                        
printf("Model: %d\n",gobject[i][model]);
                        
printf("New POS X: %f\n",gobject[i][posx]);
                        
printf("New POS Y: %f\n",gobject[i][posy]);
                        
printf("New POS Z: %f\n",gobject[i][posz]);
                        
printf("New ROT X: %f\n",gobject[i][rotx]);
                        
printf("New ROT Y: %f\n",gobject[i][roty]);
                        
printf("New ROT Z: %f\n",gobject[i][rotz]);
                        
printf("=====================");
                    }
                }
            }
            
    
            if(
response == EDIT_RESPONSE_CANCEL)
            {
                
//The player cancelled, so put the object back to it's old position
                
if(!playerobject//Object is not a playerobject
                
{
                        for(new 
i=0;i<MAX_OBJ;i++)
                   {
                        if(
objectid==gobject[i][oid])
                        {
                            
GetDynamicObjectPos(objectidfXfYfZ);
                            
GetDynamicObjectRot(objectidfRotXfRotYfRotZ);
                            
gobject[i][posx]=fX;
                            
gobject[i][posy]=fY;
                            
gobject[i][posz]=fZ;
                            
gobject[i][rotx]=fRotX;
                            
gobject[i][roty]=fRotY;
                            
gobject[i][rotz]=fRotZ;
                            
printf("=====================\n");
                            
printf("Object Edited ID: %d\n",i);
                            
printf("Model: %d\n",gobject[i][model]);
                            
printf("New POS X: %f\n",gobject[i][posx]);
                            
printf("New POS Y: %f\n",gobject[i][posy]);
                            
printf("New POS Z: %f\n",gobject[i][posz]);
                            
printf("New ROT X: %f\n",gobject[i][rotx]);
                            
printf("New ROT Y: %f\n",gobject[i][roty]);
                            
printf("New ROT Z: %f\n",gobject[i][rotz]);
                            
printf("=====================");
                        }
                    }
                }
            }    
        }
    } 
It's also not working ^^^ Can anyone tell me why?

Here's code on player create object:
PHP код:
CMD:createobject(playerid,params[])
    {
        new 
modelid;
        if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playeridCOLOR_RED,"Sorry but you are not authorised to use this command");
        if(
sscanf(params"i" ,modelid)) return SendClientMessage(playeridCOLOR_YELLOW,"Usage: /createobject <Model ID>");
        new 
Float:x,Float:y,Float:z;
        
GetPlayerPos(playerid,x,y,z);
        for(new 
i=0i<MAX_OBJ;i++)
        {
            if(
gobject[i][model]==0)
            {
                
gobject[i][oid]=CreateDynamicObject(modelid,x+2,y,z,0,0,0);
                new 
str[128];
                
format(str,sizeof(str),"You have created object(ID:%d) with Model ID:%d",i,modelid);
                
SendClientMessage(playeridCOLOR_BLUE,str);
                
GetDynamicObjectPos(gobject[i][oid],gobject[i][posx],gobject[i][posy],gobject[i][posz]);
                
GetDynamicObjectRot(gobject[i][oid],gobject[i][rotx],gobject[i][roty],gobject[i][rotz]);
                
gobject[i][model]=modelid;
                new 
INI:file INI_Open(SavePath(i));
                
INI_WriteInt(file,"model",gobject[i][model]);
                
INI_WriteFloat(file,"posx",gobject[i][posx]);
                
INI_WriteFloat(file,"posy",gobject[i][posy]);
                
INI_WriteFloat(file,"posz",gobject[i][posz]);
                
INI_WriteFloat(file,"rotx",gobject[i][rotx]);
                
INI_WriteFloat(file,"roty",gobject[i][roty]);
                
INI_WriteFloat(file,"rotz",gobject[i][rotz]);
                
INI_Close(file);
                break;
            }
        }
        return 
1;
    } 
Reply


Messages In This Thread
Problem With Objects - by TheRaGeLord - 22.07.2015, 11:34
Re: Problem With Objects - by TheRaGeLord - 22.07.2015, 13:28
Re: Problem With Objects - by nezo2001 - 22.07.2015, 13:48
Re: Problem With Objects - by TheRaGeLord - 22.07.2015, 14:09
Re: Problem With Objects - by kloning1 - 26.07.2015, 08:32
Re: Problem With Objects - by xVIP3Rx - 26.07.2015, 09:46
Re: Problem With Objects - by dominik523 - 26.07.2015, 09:50

Forum Jump:


Users browsing this thread: 1 Guest(s)