Keybinder ingame?

Vrana

Active member
Joined
Jun 24, 2014
Messages
128
Reaction score
0
Location
Serbia
Hello Ugbase, is it possible to make a Keybinder in game SAMP? I mean keybind like /troll ID but I write it in keybind box and press 1 to troll that player? I have a keybinder but I need to alt tab to write it, Im asking if its possible to do it while ingame...
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
hi, you could make a cleo keybinder which would save the id by a special command

Code:
{$CLEO .cs}
0000:
repeat
wait 0
until 0AFA:  is_samp_available
0B34: samp register_client_command "saveid" to_label @save_id

0@ = 700 //0@ is going to be a delay before the key is pressed again
1@ = 0 //1@ is going to be our id
 
:First
wait 0  

if key_down 49 //key 1, not keypad
then

//idk if these two are right
0AD3: 2@v = format "/troll %d" 1@ //
0AF9: samp say_msg 2@v

//if these are wrong then you could delete them and try something like:
//alloc 2@ 64
//0AD3: 2@ = format "/troll %d" 1@ //
//0AF9: samp say_msg 2@
//free 2@

wait 0@
end

jump @First
 
:save_id
0B35: samp 30@ = get_last_command_params
if 0AD4: 31@ = scan_string 30@ format "%d" 1@
then
else
0AD1: show_formatted_text_highpriority "Wrong format" time 1000
end
samp.CmdRet

I didn't test it and don't know if it's working, but you'd need sampfuncs
The command to save id is:
/saveid <id>


Edit: In this one you could also save the command itself by using:
/savename </command>
But God knows if there are mistakes...

Code:
{$CLEO .cs}
0000:
repeat
wait 0
until 0AFA:  is_samp_available
0B34: samp register_client_command "saveid" to_label @save_id
0B34: samp register_client_command "savename" to_label @save_name

0@ = 700 //0@ is going to be a delay before the key is pressed again
1@ = 0 //1@ is going to be our id
alloc 10@ 64
0AD3: 10@ = format "/nocommandsavedyet"
 
:First
wait 0  

if key_down 49 //key 1, not keypad
then

//idk if these two are right
0AD3: 2@v = format "%s %d" 10@ 1@ 
0AF9: samp say_msg 2@v

//if these are wrong then you could delete them and try something like:
//alloc 2@ 64
//0AD3: 2@v = format "%s %d" 10@ 1@ 
//0AF9: samp say_msg 2@
//free 2@

wait 0@
end

jump @First
 
:save_id
0B35: samp 30@ = get_last_command_params
if 0AD4: 31@ = scan_string 30@ format "%d" 1@
then
else
0AD1: show_formatted_text_highpriority "Wrong format" time 1000
end
samp.CmdRet            

:save_name
0B35: samp 30@ = get_last_command_params
if 0AD4: 31@ = scan_string 30@ format "%s" 10@
then
else
0AD1: show_formatted_text_highpriority "Wrong format" time 1000
end
samp.CmdRet
 
Top