11.06.2013, 20:14
Hello i have a problem when i create one object ingame and i delete it its works but when i create 2 object and delete them all the same it doesnt work
Here's the code
Commands :
DIALOG OF ADOBJ
Here's the code
Commands :
Код:
dcmd_adobj(playerid,params[]) { #pragma unused params ShowPlayerDialog(playerid,10000,DIALOG_STYLE_INPUT,"{A80000}Insert Object ID","Insert the object ID that you wan't to create.","Create","Close"); return 1; } dcmd_addeleteobj(playerid,params[]) { #pragma unused params DestroyDynamicObject(EDIT_OBJECT_ID[playerid]); return 1; } dcmd_addeleteallobj(playerid,params[]) { #pragma unused params #pragma unused playerid for(new i = 0; i < sizeof(EDIT_OBJECT_ID); i++) { DestroyDynamicObject(EDIT_OBJECT_ID[i]); } return 1; }
Код:
if(dialogid == 10000 && response) { if(!Numbers(inputtext)) return SendClientMessage(playerid,COLOR_RED,"Vous ne pouvez que utiliser des nombres."),ShowPlayerDialog(playerid,10000,DIALOG_STYLE_INPUT,"{A80000}Createur d'Objet","Insйrer l'ID de l'objet que vous voulez crйer.","Crйer","Fermer"); new Float:editor[3],id; GetPlayerPos(playerid,editor[0],editor[1],editor[2]); id = CreateDynamicObject(strval(inputtext), editor[0]+1, editor[1]+1, editor[2], 0.0,0.0,0.0, -1, -1, -1, 100.0); if(id > DEF_MAX_OBJECTS) return SendClientMessageToAll(COLOR_WHITE,"Erreur lors de la crйation de l'objet, il semble que vous essayez de crйer d'autres objets alors le montant maximum est de 5000 objets."); EDITOR_OBJECT[id][OBJ_MODEL] = strval(inputtext); EDITOR_OBJECT[id][OBJ_X] = editor[0]+1; EDITOR_OBJECT[id][OBJ_Y] = editor[1]+1; EDITOR_OBJECT[id][OBJ_Z] = editor[2]; EDITOR_OBJECT[id][OBJ_RX] = 0.0; EDITOR_OBJECT[id][OBJ_RY] = 0.0; EDITOR_OBJECT[id][OBJ_RZ] = 0.0; EDITOR_OBJECT[id][OBJ_VW] = -1; EDITOR_OBJECT[id][OBJ_INTERIOR] = -1; EDIT_OBJECT_ID[playerid] = id; EditDynamicObject(playerid, id); }
Код:
public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz) { EDITOR_OBJECT[objectid][OBJ_X] = x; EDITOR_OBJECT[objectid][OBJ_Y] = y; EDITOR_OBJECT[objectid][OBJ_Z] = z; EDITOR_OBJECT[objectid][OBJ_RX] = rx; EDITOR_OBJECT[objectid][OBJ_RY] = ry; EDITOR_OBJECT[objectid][OBJ_RZ] = rz; SetDynamicObjectPos(objectid,x,y,z); SetDynamicObjectRot(objectid,rx,ry,rz); return 1; }