Unknown Command -
ServerScripter - 21.02.2012
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[])
i complie without errors , but IG whene i type the command it says "Unknown Command"
anyone can help me ? thank you.
Re: Unknown Command -
Konstantinos - 21.02.2012
vbox isn't 11 characters.
pawn Код:
dcmd( vbox, 4, cmdtext );
Re: Unknown Command -
ServerScripter - 21.02.2012
oh so the numer means : how many characters?
Re: Unknown Command -
Konstantinos - 21.02.2012
Yes, the lenght.
Re: Unknown Command -
Toreno - 21.02.2012
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;
}
Re: Unknown Command -
ServerScripter - 21.02.2012
i edited 11 to 4 it works fine ! thanks ,
Question : how to remove the object ?
DestroyObject or what ?
Re: Unknown Command -
Vince - 21.02.2012
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.
Re: Unknown Command -
Toreno - 21.02.2012
This will show you how it works.
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;
}