Can make a function to press the spacebar for 0.3 seconds when typing "/space" chat?

murakami

Известный
Автор темы
131
13
Can make a function to press the spacebar for 0.3 seconds when typing "/space" chat?
 
Последнее редактирование:

murakami

Известный
Автор темы
131
13
maybe like this

CLEO:
{$CLEO}
{$USE bitwise}
0000:

repeat
wait 0
until Samp.Available()
0B34: samp register_client_command "space" to_label @space
1@ = 0
TIMERA = 0

while true
wait 0
    if and
    1@ == 1
    TIMERA <= 300
    then
    0B56: set_game_key 16 state 255
    else
    1@ = 0
    end
end

:space
1@ = 1
TIMERA = 0
Samp.CmdRet()


Thanks for the great answer.
"Forbidden character in the identifier Samp.Available"
when compiled in sannybuilder 3.8.0. An error occurs. May I know the reason? Is it a code problem?
 

murakami

Известный
Автор темы
131
13
Maybe u should install SF ?
SF for 0.3dl
Extract content from "SannyBuilder Data" folder into "/SannyBuilder/data/sa"
It compiles successfully, but it doesn't seem to work. maybe set_game_key 16 is thought of as a shift key. Then when I use the /space command, the character should jump, but the character doesn't.
I also installed sampfuncs.asi
 

D3.Pheonix

🎹
Модератор
2,868
1,646
It compiles successfully, but it doesn't seem to work. maybe set_game_key 16 is thought of as a shift key. Then when I use the /space command, the character should jump, but the character doesn't.
I also installed sampfuncs.asi
game key 16 is SPrint key (default sprint is on SpaceBar). Change it to 14
 

murakami

Известный
Автор темы
131
13
@murakami
if u need only 1 jump, u don't need timer with 0.3s
CLEO:
{$CLEO}
0000:

repeat
wait 0
until Samp.Available()
0B34: samp register_client_command "space" to_label @space
1@ = 0

while true
wait 0
    if
    1@ == 1
    then
    0B56: set_game_key 14 state 255
    1@ = 0
    end
end

:space
1@ = 1
Samp.CmdRet()
It works fine. But I have a question.
"/space" cmd does not exist on the server, and if use a command that does not exist, the output string "You used a non existent cmd" is usually output from the server. This statement is not output when manually using /space cmd, but when used in a keybinder, the string "You used a non existent cmd" is output and the jump command is not executed. The keybinder is obviously working fine. Maybe this is a sampfuncs error?
 

murakami

Известный
Автор темы
131
13
it's not error, but it's true.
U can bind it in cleo.

P.s. I don't understand, why u are doing that. U can easily jump without script, but u want to bind it :D
Maybe u can explain, what u want to do ?
I'm making a macro on the server I'm playing on. Once the fish is caught, i need to press the spacebar once.
All other functions can be made by me using ahk, but it is not easy in ahk to press spacebar with san andreas inactive. So when the fish is caught I send a command(/space) to press the spacebar and try to get cleo to press the spacebar. But strangely, when I send the /space command to the keybinder written in ahk, cleo does not catch the command.
That said, I don't understand why register_client_command doesn't catch it when I send a command to /space using keybinder.

Could you possibly solve this problem? It's okay if you're not cleo. asi is good too. If you solve this problem, I can give you a small amount ($4) by paypal...
 
Последнее редактирование:

D3.Pheonix

🎹
Модератор
2,868
1,646
I'm making a macro on the server I'm playing on. Once the fish is caught, i need to press the spacebar once.
All other functions can be made by me using ahk, but it is not easy in ahk to press spacebar with san andreas inactive. So when the fish is caught I send a command(/space) to press the spacebar and try to get cleo to press the spacebar. But strangely, when I send the /space command to the keybinder written in ahk, cleo does not catch the command.
That said, I don't understand why register_client_command doesn't catch it when I send a command to /space using keybinder.

Could you possibly solve this problem? It's okay if you're not cleo. asi is good too. If you solve this problem, I can give you a small amount ($4) by paypal...
I checked it with simple ahk binder, and it works, but i can't help u. Try to ask help here: