01.05.2015, 17:32
1.First i create an object
2.Then i move it with /eo
3.when i copy the object the object spawn at the place i create but not at the place i save the /eo
createobject and copyobject
editobject
onplayereditdynamicobject
2.Then i move it with /eo
3.when i copy the object the object spawn at the place i create but not at the place i save the /eo
createobject and copyobject
Код:
CMD:co(playerid,params[]) { if(playermap[playerid] == 1) { new f[128],modelid,Float:x,Float:y,Float:z; if(sscanf(params,"dF(0)F(0)F(0)",modelid,x,y,z)) return SendClientMessage(playerid,X11_YELLOW,"stynx correct usage /co [modelid] [Float:x] [Float:y] [Float:z]"); if(maxobject-gettotalcreatedobject(playerid) <= 1) return SendClientMessage(playerid,X11_YELLOW,"reached max object"); //if(checkxo(modelid) == 1) return SendClientMessage(playerid,X11_YELLOW,"error ! invalid objectid :o"); if(modelid <= 614) return SendClientMessage(playerid,X11_YELLOW,"error ! invalid objectid :o :o :o :o :o :o :o :o"); if(modelid == 1225) return SendClientMessage(playerid,X11_YELLOW,"WTFFFFFFFFFFF !"); else { new i = getfreemodelid(playerid); new Float:xx,Float:yy,Float:zz; GetPlayerPos(playerid,xx,yy,zz); cposx[playerid][i] = xx; cposy[playerid][i] = yy; cposz[playerid][i] = zz; cmodelid[playerid][i] = modelid; //DestroyDynamicObject(cobject[playerid][i]); cobject[playerid][i] = CreateDynamicObject(modelid,xx,yy,zz,crotx[playerid][i],croty[playerid][i],crotz[playerid][i]); if(textdiaoffja[playerid] == false) createobjecttext(playerid,modelid,i,pnama(playerid),xx,yy,zz,crotx[playerid][i],croty[playerid][i],crotz[playerid][i]); format(f,sizeof(f),"+you have created objectid: %d , modelid: %d , X:%0.2f , Y:%0.2f , Z:%0.2f",i,modelid,xx,yy,zz); SendClientMessage(playerid,X11_YELLOW,f); } } return 1; } CMD:copyobject(playerid,params[]) { if(playermap[playerid] == 1) { new f[128],id,Float:x,Float:y,Float:z; if(sscanf(params,"dF(0)F(0)F(0)",id,x,y,z)) return SendClientMessage(playerid,X11_YELLOW,"stynx correct usage /co [objectid] [Float:x] [Float:y] [Float:z]"); if(maxobject-gettotalcreatedobject(playerid) <= 1) return SendClientMessage(playerid,X11_YELLOW,"reached max object"); else { new i = getfreemodelid(playerid); new Float:xx,Float:yy,Float:zz; //GetPlayerPos(playerid,xx,yy,zz); cposx[playerid][i] = cposx[playerid][id]; cposy[playerid][i] = cposy[playerid][id]; cposz[playerid][i] = cposz[playerid][id]; cmodelid[playerid][i] = cmodelid[playerid][id]; xx = cposx[playerid][i]; yy = cposy[playerid][i]; zz = cposz[playerid][i]; crotx[playerid][i] = crotx[playerid][id]; croty[playerid][i] = croty[playerid][id]; crotz[playerid][i] = crotz[playerid][id]; //DestroyDynamicObject(cobject[playerid][i]); cobject[playerid][i] = CreateDynamicObject(cmodelid[playerid][i],xx,yy,zz,crotx[playerid][i],croty[playerid][i],crotz[playerid][i]); if(textdiaoffja[playerid] == false) createobjecttext(playerid,cmodelid[playerid][i],i,pnama(playerid),xx,yy,zz,crotx[playerid][i],croty[playerid][i],crotz[playerid][i]); format(f,sizeof(f),"+you have copy objectid: %d , modelid: %d , X:%0.2f , Y:%0.2f , Z:%0.2f",i,cmodelid[playerid][i],xx,yy,zz); SendClientMessage(playerid,X11_YELLOW,f); } } return 1; }
Код:
CMD:eo(playerid,params[]) { if(playermap[playerid] == 1) { new i; if(sscanf(params,"d",i)) return SendClientMessage(playerid,X11_YELLOW,"stynx correct usage /eo [objectid]"); if(cmodelid[playerid][i] <= 0 || i >= maxobject) return SendClientMessage(playerid,X11_YELLOW,"+error ! invalid objectid"); else { new x = cobject[playerid][i]; new Float:xx,Float:yy,Float:zz; new Float:rxx,Float:ryy,Float:rzz; GetDynamicObjectPos(x,xx,yy,zz); GetDynamicObjectRot(x,rxx,ryy,rzz); EditDynamicObject(playerid,x); SendClientMessage(playerid,X11_YELLOW,"Hold spacebar to rotate your camera"); } } return 1; }
Код:
public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz) { new Float:oldX, Float:oldY, Float:oldZ, Float:oldRotX, Float:oldRotY, Float:oldRotZ; GetDynamicObjectPos(objectid, oldX, oldY, oldZ); GetDynamicObjectRot(objectid, oldRotX, oldRotY, oldRotZ); if(response == EDIT_RESPONSE_FINAL) { SetDynamicObjectPos(objectid, x, y, z); SetDynamicObjectRot(objectid, rx, ry, rz); } if(response == EDIT_RESPONSE_CANCEL) { SetDynamicObjectPos(objectid, oldX, oldY, oldZ); SetDynamicObjectRot(objectid, oldRotX, oldRotY, oldRotZ); } return 1; }