02.03.2015, 23:16
When i use EditDynamicObject, nothing happens?
here is my create object code:
Here is my OnPlayerEditDynamicObject:
here is my create object code:
Код:
CMD:createobject(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command."); new type, objid, cost; new string[256]; if(sscanf(params,"iii", type, objid, cost)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /CreateObject status id cost /n Type: 1 - normal, 3 - Derby, 4 - furniture store"); for(new idx=1; idx<MAX_OBJECT; idx++) { if(!ObjectInfo[idx][oType]) { new virtworld = GetPlayerVirtualWorld(playerid); new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z); ObjectInfo[idx][oStatus] = 0; ObjectInfo[idx][oType] = type; ObjectInfo[idx][oid] = objid; format(ObjectInfo[idx][oOwner], 32, "The State"); ObjectInfo[idx][oX] = X; ObjectInfo[idx][oY] = Y; ObjectInfo[idx][oZ] = Z; ObjectInfo[idx][orX] = 0; ObjectInfo[idx][orY] = 0; ObjectInfo[idx][orZ] = 0; ObjectInfo[idx][oPickupid] = 0; ObjectInfo[idx][oPickupAmmount] = cost; ObjectInfo[idx][oVirtualWorld] = virtworld; ObjectInfo[idx][oidx] = CreateDynamicObject(ObjectInfo[idx][oid], ObjectInfo[idx][oX]+1, ObjectInfo[idx][oY]+1, ObjectInfo[idx][oZ]+1, 0.0,0.0,0.0, -1, -1, -1, 100.0, 0.0); EditDynamicObject(playerid, ObjectInfo[idx][oidx]); new string2[32]; format(string2, sizeof(string2), "You have created object with id: %d.", idx); SendClientMessage(playerid, COLOR_BLUE, string2); format(string, sizeof(string), "Object ID\n%d", idx); SendAdminMessage(COLOR_DARKRED, 1, string); new query[300]; mysql_format(MySQLCon, query, sizeof(query), "INSERT INTO `objects` (`ID`, `Status`, `Type`, `ObjectId`, `VirtualWorld`) VALUES ('%d', '%d', '%d', '%d')", idx, ObjectInfo[idx][oStatus], ObjectInfo[idx][oType], ObjectInfo[idx][oid], ObjectInfo[idx][oVirtualWorld]); mysql_query(MySQLCon, query); idx = MAX_OBJECT; Log("logs/objects.log", string); } } return 1; }
Код:
public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz) { if(response == EDIT_RESPONSE_FINAL) { for(new idx=1; idx<MAX_OBJECT; idx++) { if(objectid == ObjectInfo[idx][oidx]) { ObjectInfo[idx][oX] = x; ObjectInfo[idx][oY] = y; ObjectInfo[idx][oZ] = z; ObjectInfo[idx][orX] = rx; ObjectInfo[idx][orY] = ry; ObjectInfo[idx][orZ] = rz; SetDynamicObjectPos(ObjectInfo[idx][oidx], ObjectInfo[idx][oX], ObjectInfo[idx][oY], ObjectInfo[idx][oZ]); SetDynamicObjectRot(ObjectInfo[idx][oidx], ObjectInfo[idx][orX], ObjectInfo[idx][orY], ObjectInfo[idx][orZ]); break; } } } }