Object IDs - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Object IDs (
/showthread.php?tid=548878)
Object IDs -
TuNiSiAnO1 - 03.12.2014
How to give out to my objects i've created with this command ids.
PHP код:
new ObjectID, ModelID, Float:oX, Float:oY, Float:oZ;
new ObjectSpawned[MAX_PLAYERS];
CMD:object(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,red,"Command not found! Type /cmds");
if(sscanf(params, "i",ModelID)) return SendClientMessage(playerid,red,"Create object: /object <model>");
{
GetPlayerPos(playerid,oX,oY,oZ);
ObjectID = CreateObject(ModelID,oX,oY,oZ,0,0,0);
EditObject(playerid,ObjectID);
ObjectSpawned[playerid] = 1;
}
return 1;
}
Example: "Object id: 1 ModelID 19128"
"Object id: 2 ModelID 19125" etc..
Thanks
Re: Object IDs -
zT KiNgKoNg - 03.12.2014
This should help you out a little. (Just woke up, so it was the last thing i wanted to do)
pawn Код:
enum oInfo
{
ObjectID,
Float:POS[6],
ModelID,
Object,
BeingUsed,
};
new ObjectInformation[MAX_OBJECTS][oInfo];
public OnPlayerEditDynamicObject(playerid, objectid, response, x, y, z, rx, ry, rz)
{
}
COMMAND:object(playerid, params[], modelid)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, red, "This command was not found, please use /cmds for all the commands on the server");
if(sscanf(params, "d", modelid)) return SendClientMessage(playerid, red, "[USAGE]: /model [modelid]");
new Float: PPOS[4],
FreeSlot = GetFreeObjectSlot();
GetPlayerPos(playerid, PPOS[0], PPOS[1], PPOS[2]);
//GetPlayerFacingAngle(playerid, POS[3]) Just if you wish to rotate the object based on the players rotation.
ObjectInformation[FreeSlot][Object] = CreateDynamicObject(modelid, POS[0], PPOS[1], PPOS[2], 0,0,0);
ObjectInformation[FreeSlot][ObjectID] = FreeSlot + 1;
ObjectInformation[FreeSlot][POS][0] = PPOS[0];
ObjectInformation[FreeSlot][POS][1] = PPOS[1];
ObjectInformation[FreeSlot][POS][2] = PPOS[2];
ObjectInformation[FreeSlot][POS][3] = 0;
ObjectInformation[FreeSlot][POS][4] = 0;
ObjectInformation[FreeSlot][POS][5] = 0;
}
stock GetFreeObjectSlot()
{
for(new i = 0; i < MAX_OBJECTS; i++)
{
if(ObjectInformation[i][BeingUsed])
continue;
else
return i;
}
}