Easy adding object question
#1

How would I add an abject to where a player is. Like set it on the ground where they are? If someone could write the code out that would be great!

Thanks: jakejohnsonusa

(This will be for setting a boombox object when they use the boombox cmd)
Reply
#2

pawn Код:
CMD:makeobject(playerid, params[])
{
    new Float:mX, Float:mY, Float:mZ;
    GetPlayerPos(playerid, mX, mY, mZ);
    CreateObject(3409, mX, mY, mZ-1.5, 0.0, 0.0, 0.0);
    return 1;
   
}
Reply
#3

And to remove it?
Reply
#4

Quote:
Originally Posted by jakejohnsonusa
Посмотреть сообщение
And to remove it?
Store the object id into an array for later deletion.
pawn Код:
new playerBoombox[MAX_PLAYERS];

CMD:boombox(playerid, params[])
{
    new Float:mX, Float:mY, Float:mZ;
    GetPlayerPos(playerid, mX, mY, mZ);
    playerBoombox[playerid] = CreateObject(2103, mX, mY, mZ-1.5, 0.0, 0.0, 0.0);
    return 1;
}

CMD:removeboombox(playerid, params[])
{
    if(!IsValidObject(playerBoombox[playerid])) {
        return SendClientMessage(playerid, -1, "You haven't made a boombox!");
    }

    DestroyObject(playerBoombox[playerid]);
    SendClientMessage(playerid, -1, "Boombox removed.");
    return 1;
}
Reply
#5

Thanks!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)