Is Near A Object
#1

Okay so what I want to do is create a command where the player is able to create a object in game... And then remove it if near by, there is one problem though... How can I get that particler object id? Would I do this?

pawn Код:
CMD:exampleobjectcreate(playerid, params[])
{
    new Float:x, Float:y, Float:z, objectdropped[MAX_PLAYERS];
    GetPlayerPos(playerid, x, y, z);
    objectdropped[playerid] = CreateDynamicObject(1508, 369.2036, 162.4440, 1019.9944, 0.0000, 0.0000, 180.0000);
    return 1;
}
pawn Код:
CMD:exampleobjectdelete(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    GetDynamicObjectPos(objectdropped[playerid], x, y, z);
    if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z)
    {
        DestroyDynamicObject(objectdropped[playerid]);
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "Test No");
    }
    return 1;
}
So would that work if the person is creating multiple objects? So say he creates 5 of those, will it remove them all?
Reply
#2

Can someone tell me if I coded it correct?
Reply
#3

Bump?
Reply
#4

Anyone?
Reply
#5

That will remove only the last object.

objectdropped must be global

pawn Код:
new objectdropped[MAX_PLAYERS];
pawn Код:
CMD:exampleobjectcreate(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    objectdropped[playerid] = CreateDynamicObject(1508, 369.2036, 162.4440, 1019.9944, 0.0000, 0.0000, 180.0000);
    return 1;
}
Reply
#6

Okay this way the person can drop multiple objects and then destroy each one?
Reply
#7

pawn Код:
SetPlayerSkin(Playerid,skinid);
Reply
#8

What is that?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)