COMMAND:editobject(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
new id,count;
if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "Usage: /editobject [object id]");
for(new i; i < sizeof(object); i++){
if(object[i][oScriptID] == id){
EditDynamicObject(playerid, object[i][oObjectID]);
count++;
break;
}
}
if(count == 0)
{
SendClientMessage(playerid, COLOR_LIGHTRED, "Error: That object ID do not exist.");
return 1;
}
return 1;
}
public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
{
if(response == EDIT_RESPONSE_FINAL)
{
new query[258];
new Float:x,Float:y,Float:z,Float:rx,Float:ry,Float:rz;
GetDynamicObjectPos(objectid,x,y,z);
GetDynamicObjectRot(objectid,rx,ry,rz);
for(new i; i < sizeof(object); i++){
if(object[i][oObjectID] == objectid){
object[i][oX] = fX;
object[i][oY] = fY;
object[i][oZ] = fZ;
object[i][roX] = fRotX;
object[i][roY] = fRotY;
object[i][roZ] = fRotZ;
format(dquery, sizeof(dquery), "UPDATE objects SET oX = %f, oY = %f, oZ = %f, roX = %f, roY = %f, roZ = %f WHERE ScriptID = %d",object[i][oX],object[i][oY],object[i][roX],object[i][roY],object[i][roZ],object[i][oZ],object[i][oScriptID]);
mysql_query(1, query);
DestroyDynamicObject(objectid);
object[i][oObjectID] = CreateDynamicObject(object[i][oModelID], object[i][oX], object[i][oY], object[i][oZ], object[i][roX], object[i][roY], object[i][roZ]);
break;
}
}
}
if(response == EDIT_RESPONSE_CANCEL)
{
for(new i; i < sizeof(object); i++){
if(object[i][oObjectID] == objectid){
DestroyDynamicObject(objectid);
object[i][oObjectID] = CreateDynamicObject(object[i][oModelID], object[i][oX], object[i][oY], object[i][oZ], object[i][roX], object[i][roY], object[i][roZ]);
break;
}
}
}
return 1;
}
format(dquery, sizeof(dquery), "UPDATE objects SET oX = %f, oY = %f, oZ = %f, roX = %f, roY = %f, roZ = %f WHERE ScriptID = %d",object[i][oX],object[i][oY],object[i][roX],object[i][roY],object[i][roZ],object[i][oZ],object[i][oScriptID]);
format(dquery, sizeof(dquery), "UPDATE objects SET `oX` = '%f', `oY` = '%f', `oZ` = '%f', `roX` = '%f', `roY` = '%f', `roZ` = '%f' WHERE `ScriptID` = %d",object[i][oX],object[i][oY],object[i][roX],object[i][roY],object[i][roZ],object[i][oZ],object[i][oScriptID]);
Change:
Код:
format(dquery, sizeof(dquery), "UPDATE objects SET oX = %f, oY = %f, oZ = %f, roX = %f, roY = %f, roZ = %f WHERE ScriptID = %d",object[i][oX],object[i][oY],object[i][roX],object[i][roY],object[i][roZ],object[i][oZ],object[i][oScriptID]); Код:
format(dquery, sizeof(dquery), "UPDATE objects SET `oX` = '%f', `oY` = '%f', `oZ` = '%f', `roX` = '%f', `roY` = '%f', `roZ` = '%f' WHERE `ScriptID` = %d",object[i][oX],object[i][oY],object[i][roX],object[i][roY],object[i][roZ],object[i][oZ],object[i][oScriptID]); |
format(dquery, sizeof(dquery), "UPDATE objects SET oX = %f, oY = %f, oZ = %f, roX = %f, roY = %f, roZ = %f WHERE ScriptID = %d",object[i][oX],object[i][oY],object[i][roX],object[i][roY],object[i][roZ],object[i][oZ],object[i][oScriptID]); mysql_query(1, query);