03.12.2014, 09:25
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;
}
}