13.08.2014, 16:04
What's bad? Happening nothing when i click at object.
Код:
new bool:IsEditingObject[MAX_PLAYERS]; new object; public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ) { if(objectid == object) { SetPVarInt(playerid, "objectid", objectid); new Float:oldX, Float:oldY, Float:oldZ, Float:oldRotX, Float:oldRotY, Float:oldRotZ; GetObjectPos(objectid, oldX, oldY, oldZ); GetObjectRot(objectid, oldRotX, oldRotY, oldRotZ); if(!playerobject) // If this is a global object, move it for other players { if(!IsValidObject(objectid)) return; MoveObject(objectid, fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ); } IsEditingObject[playerid] = true; if(response == EDIT_RESPONSE_FINAL) { IsEditingObject[playerid] = false; // The player clicked on the save icon // Do anything here to save the updated object position (and rotation) } if(response == EDIT_RESPONSE_CANCEL) { IsEditingObject[playerid] = false; //The player cancelled, so put the object back to it's old position if(!playerobject) //Object is not a playerobject { SetObjectPos(objectid, oldX, oldY, oldZ); SetObjectRot(objectid, oldRotX, oldRotY, oldRotZ); } else { SetPlayerObjectPos(playerid, objectid, oldX, oldY, oldZ); SetPlayerObjectRot(playerid, objectid, oldRotX, oldRotY, oldRotZ); } } } } public OnPlayerSelectObject(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ) { if(objectid == object) { if(type == SELECT_OBJECT_GLOBAL_OBJECT) { EditObject(playerid, objectid); } else { EditPlayerObject(playerid, objectid); } } return 1; } CMD:mc(playerid, params[]) { new objectid; new worldid = GetPlayerVirtualWorld(playerid); new Float:x, Float:y, Float:z; new Float:x2, Float:y2; GetPlayerPos(playerid, x, y, z); GetXYInFrontOfPlayer(playerid, x2, y2, 3); if(sscanf(params, "d", objectid)) return SendClientMessage(playerid, COLOR_GREY, "Usage: /mc [modelid]"); if(objectid > 19901 || objectid < 615) { return SendClientMessage(playerid, COLOR_GREY,"Error: Incorret modelid"); } else { object = CreateDynamicObject(objectid, x2, y2, z, 0.0, 0.0, 0.0, worldid, -1, -1, 200.0, 0.0); EditObject(playerid, object); } return 1; } CMD:msel(playerid, params[]) { SelectObject(playerid); return 1; } CMD:mdel(playerid, params[]) { if(IsEditingObject[playerid] == true) { DestroyObject(GetPVarInt(playerid, "objectid")); } return 1; }