Please help
#1

PHP код:
CMD:editobject(playeridparams[])
{
 new 
objectid;
 if(
sscanf(params"d"objectid))
 {
     
SendClientMessage(playerid, -1"[USAGE]/editobject (objid)");
     return 
1;
 }
 
EditDynamicObject(playeridobjectid);
 return 
1;
}
public 
OnPlayerEditObject(playeridplayerobjectobjectidresponseFloat:fXFloat:fYFloat:fZFloat:fRotXFloat:fRotYFloat:fRotZ)
{
 new 
Float:oldXFloat:oldYFloat:oldZFloat:oldRotXFloat:oldRotYFloat:oldRotZQuery[800];
 
GetObjectPos(objectidoldXoldYoldZ);
 
GetObjectRot(objectidoldRotXoldRotYoldRotZ);
 if(!
playerobject)
 {
     if(!
IsValidObject(objectid)) return 1;
     
SetObjectPos(objectidfXfYfZ);
      
SetObjectRot(objectidfRotXfRotYfRotZ);
 }
 if(
response == EDIT_RESPONSE_UPDATE)
 {
     
GetObjectPos(objectidfXfYfZ);
     
GetObjectRot(objectidfRotXfRotYfRotZ);
  
format(Querysizeof(Query), "UPDATE loot SET objx = %f, objy = %f, objz = %f, objrx = %f, objry = %f, objrz = %f WHERE objid = %d",
  
fXfYfZfRotXfRotYfRotZobjectid);
  
db_query(LootQuery);
  print(
Query);
 }
 if(
response == EDIT_RESPONSE_FINAL)
 {
  
GetObjectPos(objectidfXfYfZ);
  
GetObjectRot(objectidfRotXfRotYfRotZ);
  
format(Querysizeof(Query), "UPDATE loot SET objx = %f, objy = %f, objz = %f, objrx = %f, objry = %f, objrz = %f WHERE objid = %d",
  
fXfYfZfRotXfRotYfRotZobjectid);
  
db_query(LootQuery);
  print(
Query);
 }
 if(
response == EDIT_RESPONSE_CANCEL)
 {
  if(!
playerobject)
  {
   
SetObjectPos(objectidoldXoldYoldZ);
   
SetObjectRot(objectidoldRotXoldRotYoldRotZ);
  }
  else
  {
   
SetPlayerObjectPos(playeridobjectidoldXoldYoldZ);
   
SetPlayerObjectRot(playeridobjectidoldRotXoldRotYoldRotZ);
  }
 }
 return 
1;

When I type /editobject ingame it edits the right object without any problem but it sends the wrong objectid to the database, it always send ID: 2, I don't have any idea why that would happen and why ID 2?

PHP код:
 if(response == EDIT_RESPONSE_FINAL)
 {
  
GetObjectPos(objectidfXfYfZ);
  
GetObjectRot(objectidfRotXfRotYfRotZ);
  
format(Querysizeof(Query), "UPDATE loot SET objx = %f, objy = %f, objz = %f, objrx = %f, objry = %f, objrz = %f WHERE objid = %d",
  
fXfYfZfRotXfRotYfRotZobjectid);
  
db_query(LootQuery);
  print(
Query);
 } 
It sends ID: 2 here, I checked it from printing it but as I said it edits/selects the right id ingame. Anyone know why this would happen with me?

Thanks
Reply


Messages In This Thread
Please help - by Oeal - 16.01.2016, 15:19
Re: Please help - by Oeal - 16.01.2016, 20:57
Re: Please help - by Sew_Sumi - 16.01.2016, 21:24
Re: Please help - by Oeal - 16.01.2016, 23:09
Re: Please help - by Sew_Sumi - 16.01.2016, 23:37
Re: Please help - by Vince - 16.01.2016, 23:44
Re: Please help - by Crayder - 16.01.2016, 23:50

Forum Jump:


Users browsing this thread: 2 Guest(s)