Make an object appear with a command.
#1

PS : I'm french, i'm sorry for my bad english

Good evening.

I want to make a command /malette for example.
As in GTA, the briefcase already exists (ID 1210):


I wish to "spawn" in my hand (after contact j'peux change) with the command / briefcase.

Assistance? An indication?
Bye.
Reply
#2

strcmp version

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/malette", cmdtext, true, 10) == 0)
    {
        SetPlayerAttachedObject( playerid, 0, 1210, 6, 0.250000, 0.100000, 0.000000, 0.000000, 264.337768, 21.619852, 1.000000, 1.000000, 1.000000 );
        return 1;
    }
    return 0;
}
zcmd

pawn Код:
CMD:malette(playerid,params[])
{
    SetPlayerAttachedObject( playerid, 0, 1210, 6, 0.250000, 0.100000, 0.000000, 0.000000, 264.337768, 21.619852, 1.000000, 1.000000, 1.000000 );
    return 1;
}
EDIT: any bugs ?
Reply
#3

Thank you, and to remove I use destroyobject?
Reply
#4

nope,

zcmd
pawn Код:
CMD:disable(playerid,params[])
{
for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
if(IsPlayerAttachedObjectSlotUsed(playerid, i)) RemovePlayerAttachedObject(playerid, i);
return 1;
}
strcmp

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/disable", cmdtext, true, 10) == 0)
    {
        for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
        if(IsPlayerAttachedObjectSlotUsed(playerid, i)) RemovePlayerAttachedObject(playerid, i);
        return 1;
    }
    return 0;
}
Reply
#5

Thank you, and how do you know the exact position to place the object?
Reply
#6

And disable with a timer is possible?
Reply
#7

From Guest:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/disable", cmdtext, true, 10) == 0)
    {
        SetTimerEx("Disabled", 15000, false, "i", playerid);
        SendClientMessage(playerid, -1, "Disablying in 15 seconds!");
        return 1;
    }
    return 0;

//=================================Somewhere else//
    forward Disabled(playerid);
    public Disabled(playerid)
    {
         for(new i=0; i<MAX_PLAYER_ATTACHED_OBJECTS; i++)
        if(IsPlayerAttachedObjectSlotUsed(playerid, i)) RemovePlayerAttachedObject(playerid, i);
        return 1;
    }
Reply
#8

yea..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)