Unknown Command
#1

Hey , i have this outside a callback ;
pawn Код:
dcmd_vbox(playerid, params[])
{
#pragma unused params
    if (Vip[playerid] < 1 ) {
        SendClientMessage(playerid, COLOR_CERVENA, "  [!] Only Vips can do that !");
    }
    else {
        if (Vip[playerid] >= 1) {
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    CreateObject(1685, x, y+2.0, z, 0.0, 0.0,0.0);

        }
    }
    return 1;
}
and this under public OnPlayerCommandText(playerid, cmdtext[])
pawn Код:
dcmd(vbox,11,cmdtext);
i complie without errors , but IG whene i type the command it says "Unknown Command"
anyone can help me ? thank you.
Reply
#2

vbox isn't 11 characters.
pawn Код:
dcmd( vbox, 4, cmdtext );
Reply
#3

oh so the numer means : how many characters?
Reply
#4

Yes, the lenght.
Reply
#5

Try these two;
pawn Код:
dcmd( vbox, 4, cmdtext );
pawn Код:
dcmd_vbox( playerid, params[] )
{
    #pragma unused params

    new
        Float:x,
        Float:y,
        Float:z
    ;

    if( Vip[ playerid ] < 1 )
        SendClientMessage( playerid, COLOR_CERVENA, "[!] Only Vips can do that !" );
    else if( Vip[ playerid ] >= 1 )
        GetPlayerPos( playerid, x, y, z ), CreateObject( 1685, x, y+2.0, z, 0.0, 0.0, 0.0 );

    return 1;
}
Reply
#6

i edited 11 to 4 it works fine ! thanks ,

Question : how to remove the object ?
DestroyObject or what ?
Reply
#7

Create a new per-player global or use a PVar to save the objectid. If the object is to be removed with the same command, you can create a static local as well.
Reply
#8

This will show you how it works.
pawn Код:
new
    ObjectID
;
pawn Код:
dcmd_vbox( playerid, params[] )
{
    #pragma unused params

    new
        Float:x,
        Float:y,
        Float:z
    ;

    if( Vip[ playerid ] < 1 )
        SendClientMessage( playerid, COLOR_CERVENA, "[!] Only Vips can do that !" );
    else if( Vip[ playerid ] >= 1 )
        GetPlayerPos( playerid, x, y, z ), ObjectID = CreateObject( 1685, x, y+2.0, z, 0.0, 0.0, 0.0 );

    return 1;
}
pawn Код:
dcmd( destroyobj, 10, cmdtext );
pawn Код:
dcmd_destroyobj( playerid, params[] )
{
    #pragma unused params

    DestroyObject(ObjectID);

    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)