hello every one iam facing bindkey problam when i press f12 list show but when i f12 down list not hide why?
this code
function onKeyDown( player, bindid )
{
if(bindid==STAFFLIST)
{
LIST <-CreateSprite( "LIST.png", 340, 40, 0, 0, 0, 255 );
LIST.ShowForPlayer(player);
}
}
function onKeyUp( player, bindid )
{
if(bindid==STAFFLIST)
{
LIST.HideFromPlayer(player);
}
}
well its a bit different you have to make 2 keys STAFFLISTDOWN and STAFFLISTUP.
there is a value true/false in bindkey, afaik do false for down and true for up
Because you are creating sprite again and again when you press key donno if this could be a reason
try
function onScriptLoad()
{
LIST <-CreateSprite( "LIST.png", 340, 40, 0, 0, 0, 255 ); // Creating sprite once will prevent creating multiple sprites on keypress
}
function onKeyDown( player, bindid )
{
if(bindid==STAFFLIST)
{
LIST.ShowForPlayer(player);
}
}
function onKeyUp( player, bindid )
{
if(bindid==STAFFLIST)
{
LIST.HideFromPlayer(player);
}
}
thx kusangi try later!
not worked!!
:poop:
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fwww.jamieglowacki.com%2Fwp-content%2Fuploads%2F2015%2F01%2FLYw4POpF.jpeg&hash=27243af65f7d0710c155572fc05cf5a26b6983c5)
You can avoid the issue of the multiple replace of the sprite by using arrays, here's an example:
function onScriptLoad()
{
stafflist <- array( GetMaxPlayers(), null );
STAFFLIST <- BindKey(true,0x7B,0,0);
}
function onPlayerJoin( player )
{
stafflist[ player.ID ] = CreateSprite( "LIST.png", 340, 40, 0, 0, 0, 255 );
}
function onKeyDown( player, key )
{
if( key == STAFFLIST )
{
stafflist[ player.ID ].ShowForPlayer( player );
}
}
function onKeyUp( player, key )
{
if( key == STAFFLIST )
{
stafflist[ player.ID ].HideFromPlayer( player );
}
}
function onPlayerPart( player, reason )
{
stafflist[ player.ID ] = null;
}
Quote from: dEaN on Dec 10, 2015, 05:34 PMnot worked!!
Probably, you don't has LIST.png in your sprites folder.
It's case sensitive.
If on your sprites folder it's "list.png" and in your createsprite thing it is "LIST.png" it won't work.
Tell us do you have the sprite?
The directory must be:-
<your vcmp server dir>\store\sprites
-worked-