2020-10-10, 06:10 PM
Salut, make sure you do everything right. I will leave you an example below.
Code:
new test_object[MAX_PLAYERS]; //a global variable
public OnPlayerConnect(playerid) {
test_object[playerid]=0;
return 1;
}
public OnPlayerDisconnect(playerid, reason) {
if(test_object[playerid]) DestroyDynamicObject(test_object[playerid]);
return 1;
}
CMD:testobj(playerid, params[]) {
new idobject;
if(sscanf(params, "i", idobject)) return SendClientMessage(playerid, COLOR_GREY, "Syntax:{FFFFFF} /editobj <id object>");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(test_object[playerid] != 0) return SendClientMessage(playerid, COLOR_AWARNING, "You already edit a object.");
//create a object putting a objectid aleatory (eg: /testobj 2943)
test_object[playerid] = CreateDynamicObject(idobject, x, y, z, 0, 0, 0);
EditDynamicObject(playerid, test_object[playerid]);
return 1;
}
public OnPlayerEditDynamicObject(playerid, STREAMER_TAG_OBJECT objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz) {
switch(response) {
case EDIT_RESPONSE_CANCEL, EDIT_RESPONSE_FINAL: SendClientMessage(playerid, -1, "the function works");
}
return 1;
}
My discord:?BoNNe#3552