#include <a_samp>
#include <zcmd>
#include <sscanf2>
#define culoare 0xFFFFFFAA
new objectmodel[500];
forward WriteLog(string[]);
new Object;
COMMAND:createobject(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
new Model;
if(sscanf(params,"i", Model)) return SendClientMessage(playerid,-1,"{FF0000}USAGE: {15FF00}/CreateObject [ObjectID]");
new Float:X;
new Float:Y;
new Float:Z;
GetPlayerPos(playerid, X, Y, Z);
Object = CreateObject(Model, X, Y, Z, 0, 0, 0, 100.0);
EditObject(playerid,Object);
}
else
{
SendClientMessage(playerid, -1, "{FF0000}* {FF0000}ERROR: {FF0000}Only RCON can use this command !");
}
return 1;
}
COMMAND:editobject(playerid, params[])
{
new oid;
if (!sscanf(params, "i",oid ))
{
EditObject(playerid, oid);
return 1;
}else{SendClientMessage(playerid,culoare,"USE : /editobject [objectid]");SendClientMessage(playerid,culoare,"INFO :Type /objects for a list of created objects"); return 1;}
}
COMMAND:gotoobject(playerid, params[])
{
new oid;
if (!sscanf(params, "i",oid ))
{
new Float:xo, Float:yo, Float:zo;
GetObjectPos(oid, xo, yo, zo);
SetPlayerPos(playerid,xo+1,yo+1,zo+1);
return 1;
}else{SendClientMessage(playerid,culoare,"Use :/gotoobject[objectid]"); return 1;}
}
COMMAND:ohelp(playerid,params[])
{
SendClientMessage(playerid,culoare,"/addobject || /editobject ||/gotoobject || /objects || /savemap");
SendClientMessage(playerid,culoare,"/oprew");
return 1;
}
COMMAND:savemap(playerid, params[])
{
for(new i = 0; i <=500; i++)
{
new stringg[128];
new Float:RotX,Float:RotY,Float:RotZ;
GetObjectRot(i, RotX, RotY, RotZ);
new Float:xo, Float:yo, Float:zo;
GetObjectPos(i, xo, yo, zo);
if(xo!=0 && yo!=0 && zo!=0)
{
format(stringg, sizeof(stringg), "CreateObject(%d,%f,%f,%f,%f,%f,%f);",objectmodel[i],xo,yo,zo,RotX,RotY,RotZ,90);
WriteLog(stringg);
}
}
new stringg[128];
format(stringg, sizeof(stringg), "________________//\\_______________");
WriteLog(stringg);
SendClientMessage(playerid,culoare,"All Objects have been saved to mapa.txt");
return 1;
}
COMMAND:objects(playerid, params[])
{
SendClientMessage(playerid,culoare,"___________L I S T______________");
for(new i = 1; i <=500; i++)
{
new stringg[128];
new Float:RotX,Float:RotY,Float:RotZ;
GetObjectRot(i, RotX, RotY, RotZ);
new Float:xo, Float:yo, Float:zo;
GetObjectPos(i, xo, yo, zo);
if(xo!=0 && yo!=0 && zo!=0)
{
format(stringg, sizeof(stringg), "ID:%dCreateObject(%d,%f,%f,%f,%f,%f,%f);",i,objectmodel[i],xo,yo,zo,RotX,RotY,RotZ);
SendClientMessage(playerid,culoare,stringg);
}
}
SendClientMessage(playerid,culoare,"________________________________");
return 1;
}
public WriteLog(string[])
{
new entry[192];
format(entry, sizeof(entry), "%s\n",string);
new File:hFile;
hFile = fopen("mapa.txt", io_append);
fwrite(hFile, entry);
fclose(hFile);
return 1;
}
public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
{
new Float:oldX, Float:oldY, Float:oldZ,
Float:oldRotX, Float:oldRotY, Float:oldRotZ;
GetObjectPos(Object, oldX, oldY, oldZ);
GetObjectRot(Object, oldRotX, oldRotY, oldRotZ);
if(!playerobject)
{
if(!IsValidObject(Object)) return;
MoveObject(Object, fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ);
}
}
#include <a_samp>
#include <zcmd>
#include <sscanf>
new Object;
CMD:createobject(playerid, params[])
{
if(IsPlayerAdmin(playerid))
{
new Model;
if(sscanf(params,"i", Model)) return SendClientMessage(playerid,-1,"{FF0000}USAGE: {15FF00}/CreateObject [ObjectID]");
new Float:X;
new Float:Y;
new Float:Z;
GetPlayerPos(playerid, X, Y, Z);
Object = CreateObject(Model, X, Y, Z, 0, 0, 0, 100.0);
EditObject(playerid,Object);
}
else
{
SendClientMessage(playerid, -1, "{FF0000}* {FF0000}ERROR: {FF0000}Only RCON can use this command !");
}
return 1;
}
public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
{
new Float:oldX, Float:oldY, Float:oldZ,
Float:oldRotX, Float:oldRotY, Float:oldRotZ;
GetObjectPos(Object, oldX, oldY, oldZ);
GetObjectRot(Object, oldRotX, oldRotY, oldRotZ);
if(!playerobject)
{
if(!IsValidObject(Object)) return;
MoveObject(Object, fX, fY, fZ, 10.0, fRotX, fRotY, fRotZ);
}
}
He means , he need to add save, edit object options in that command.
|
u use mysql?
and do u want the object to save or no i didnt understand. the edit object not working to? |