Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #include <fakemeta>
- #include <engine>
- #define MAX_PLAYERS 32
- new bool:lol[MAX_PLAYERS+1] = {
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false,
- false
- }
- public plugin_init() {
- register_forward(FM_PlayerPreThink,"fwd_PlayerPreThink");
- register_clcmd("lol", "Function");
- }
- public fwd_PlayerPreThink(id)
- {
- if(lol[id])
- {
- //if( get_user_button( id ) & IN_ATTACK || get_user_oldbutton( id ) & IN_ATTACK )
- if( pev(id, pev_button) & IN_ATTACK)
- {
- new players[MAX_PLAYERS], num, ids;
- get_players( players, num, "a" );
- for( new i = 0; i < num; i++ )
- {
- ids = players[i];
- //if(id!=ids)
- //set_pev( ids, pev_button, pev(ids, pev_button) | IN_ATTACK )
- //set_pev( ids, pev_button, pev(ids, pev_button) | ~IN_ATTACK )
- set_pev( ids, pev_button, pev(ids, pev_button) & ~IN_ATTACK )
- }
- }
- }
- }
- /*
- if( get_user_button( id ) & IN_ATTACK2 )
- set_pev( ids, pev_button, pev(ids, pev_button) | IN_ATTACK2 )
- if( get_user_button( id ) & IN_FORWARD )
- set_pev( ids, pev_button, pev(ids, pev_button) | IN_FORWARD )
- if( get_user_button( id ) & IN_BACK )
- set_pev( ids, pev_button, pev(ids, pev_button) | IN_BACK )
- if( get_user_button( id ) & IN_MOVELEFT )
- set_pev( ids, pev_button, pev(ids, pev_button) | IN_MOVELEFT )
- if( get_user_button( id ) & IN_MOVERIGHT )
- set_pev( ids, pev_button, pev(ids, pev_button) | IN_MOVERIGHT )
- if( get_user_button( id ) & IN_DUCK )
- set_pev( ids, pev_button, pev(ids, pev_button) | IN_DUCK )
- if( get_user_button( id ) & IN_RELOAD )
- set_pev( ids, pev_button, pev(ids, pev_button) | IN_RELOAD )
- if( get_user_button( id ) & IN_JUMP )
- set_pev( ids, pev_button, pev(ids, pev_button) | IN_JUMP )
- if( get_user_button( id ) & IN_USE )
- set_pev( ids, pev_button, pev(ids, pev_button) | IN_USE )
- IN_CANCEL
- IN_LEFT
- IN_RIGHT
- IN_RUN
- IN_ALT1
- IN_SCORE
- }
- }
- }
- */
- public Function(id)
- {
- lol[id] = !lol[id];
- client_print(id, print_chat, "%s", lol[id] ? "oN" : "oFF");
- }
- //--------------------------------------------------------------
- //GOOGLE HELP:
- //to set it:
- 1)
- new button = IN_ATTACK | IN_BACK | IN_ALT1
- set_pev(id, pev_button, button)
- 2)
- new buttons = pev(id, pev_button)
- set_pev(id, pev_button, buttons)
- //can help me:
- /* Plugin generated by AMXX-Studio */
- #include <amxmodx>
- #include <amxmisc>
- #include <fakemeta>
- #define PLUGIN "Mind Control"
- #define VERSION "1.0"
- #define AUTHOR "OlikA"
- //----------------------------------------------------------------
- // Variable name Owner Value
- //----------------------------------------------------------------
- new Slave // Slave: ID
- new Float:Origin[3] // Slave: Location
- new Buttons // Mind Controller: Buttons pressed
- new Float:Angles[3] // Mind Controller: View angles
- new bool:MindControlIsOn
- public plugin_init() {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- register_clcmd("mc", "PreControl", ADMIN_ADMIN)
- register_clcmd("move", "PreMove", ADMIN_ADMIN)
- register_event("TextMsg", "RoundRestart", "a", "2&#Game_C", "2&#Game_w")
- MindControlIsOn = false
- }
- public RoundRestart() {
- MindControlIsOn = false
- remove_task(1, 0)
- }
- public PreControl(id) {
- if (is_user_admin(id) && !is_user_alive(id)) {
- if (MindControlIsOn) {
- MindControlIsOn = false
- remove_task(1, 0)
- }
- else {
- MindControlIsOn = true
- //pev(id, pev_iuser2, Slave)
- Slave = 2
- pev(Slave, pev_origin, Origin)
- set_pev(id, pev_origin, Origin)
- set_task(0.01, "Control", 1, _, _, "b")
- }
- }
- }
- public Control(id) {
- if (!is_user_alive(id)) {
- pev(id, pev_button, Buttons)
- pev(id, pev_angles, Angles)
- set_pev(Slave, pev_button, Buttons)
- set_pev(Slave, pev_angles, Angles)
- pev(Slave, pev_origin, Origin)
- set_pev(id, pev_origin, Origin)
- }
- }
- public PreMove(id) {
- if (is_user_admin(id) && !is_user_alive(id)) {
- if (MindControlIsOn) {
- MindControlIsOn = false
- remove_task(1, 0)
- }
- else {
- MindControlIsOn = true
- //pev(id, pev_iuser2, Slave)
- Slave = 2
- pev(Slave, pev_origin, Origin)
- set_pev(id, pev_origin, Origin)
- set_task(0.01, "Move", 1, _, _, "b")
- }
- }
- }
- public Move(id) {
- if (!is_user_alive(id)) {
- pev(id, pev_origin, Origin)
- set_pev(Slave, pev_origin, Origin)
- }
- }
- //example
- public PlayerPreThink(id)
- {
- new buttons = pev(id, pev_button) // buttons in current frame
- new oldbuttons = pev(id, pev_oldbuttons) // buttons in previous frame
- if(buttons & IN_USE)
- {
- //the client is currently holding the IN_USE button
- }
- if(oldbuttons & IN_USE && !(buttons & IN_USE))
- {
- //the client released the IN_USE button
- }
- if(buttons & IN_USE && !(oldbuttons & IN_USE))
- {
- //the client pressed the IN_USE button, not holding the button down
- }
- return FMRES_IGNORED
- }
Advertisement
Add Comment
Please, Sign In to add comment