Quote:
Originally Posted by OlikA
I read that I have to use bitwise operators and get the actual buttons pressed like
PHP Code:
pev(id, pev_button, button)
if (button & IN_JUMP)
But I want to make a specific plugin that allows me to control another player. No abuse, I'm about to make a public HNS server with bunny hop courses (blockmaker) and it would be great if I could help out newbies to reach what they want. So if they want help, I could easily control them to the right place. I tried this code:
PHP Code:
pev(id, pev_button, Buttons)
pev(id, pev_angles, Angles)
set_pev(Slave, pev_button, Buttons)
set_pev(Slave, pev_angles, Angles)
And on the dedicated server, I saw that when I press +forward or simply looking left, the Slave is also was about to go forward and look left but it was only a "visual" change, the Slave didn't saw any change. Give me some minutes and I will post the code.
|
PHP Code:
pev(id, pev_button, button)
if (button & IN_JUMP)
it is used this way ->
PHP Code:
button = pev(id, pev_button)
if (button & IN_JUMP)
And yes you need to use the bitwise operators! A good idea is to check all the topics in this thread ->
http://forums.alliedmods.net/forumdisplay.php?f=83
PHP Code:
pev(id, pev_button, Buttons)
pev(id, pev_angles, Angles)
set_pev(Slave, pev_button, Buttons)
set_pev(Slave, pev_angles, Angles)
For this you should correct the button ones with what I have said above.
And for angles it is correct. Angles must be a float vector.
PHP Code:
new buttons, Float:angles[3]
buttons = pev(id, pev_button)
pev(id, pev_angles, angles)
set_pev(Slave, pev_button, buttons)
set_pev(Slave, pev_angles, angles)
Edit:
I suggest using engine at least when you are a beginner at scripting because it is better when we talk about user friendly access.
__________________