AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   button help (https://forums.alliedmods.net/showthread.php?t=51447)

SAMURAI16 02-18-2007 07:49

button help
 
can somebody give me an example if an player use for 3 times button "K" for example to do something.

Hope you understand
Thanks

Hawk552 02-18-2007 09:10

Re: button help
 
There's no way to check if they're hitting a specific key, but there are 2 things you can do:

1) Force them to bind the K key to a registered command
2) Tell them to bind any key to the command if it doesn't matter that it's the K key

I imagine the second is preferable, but if you need to know if they're hitting K, the first is.

SAMURAI16 02-18-2007 09:14

Re: button help
 
ok, i need the name of event who are execute before freezetime ; not ResetHud

Hawk552 02-18-2007 09:19

Re: button help
 
Taken from VEN's round scripting tutorial:
Code:
register_event("HLTV", "event_new_round", "a", "1=0", "2=0")

SAMURAI16 02-18-2007 09:27

Re: button help
 
what's wrong ?
Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>



public plugin_init() {
    register_plugin("","","")
   
    register_event("HLTV", "ev_newRound", "a", "1=0", "2=0")
}

public ev_newRound()
{
    new players[32],inum,i
    get_players(players,inum)
   
    for(i = 0; i <= inum; i++)
    {
        new CsTeams:playert = cs_get_user_team(players[i])
       
        if(playert == CS_TEAM_T)   
        return PLUGIN_CONTINUE;
       
        client_cmd(players[i],"bind ^"F12" "say ahh i used F12 :)^"")
    }
   
}


Hawk552 02-18-2007 09:53

Re: button help
 
Well, it's extremely bad practice, and it's really easy for them to just bind it to something else. Here's a cleaned up version, though:

Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> public plugin_init() {     register_plugin("","","")         register_event("HLTV", "ev_newRound", "a", "1=0", "2=0") } public ev_newRound() {     new players[32],inum     get_players(players,inum)         for(new i,player; i <= inum; i++)     {         player = players[i]                 if(cs_get_user_team(player) == CS_TEAM_T)                 return                 client_cmd(player,"bind F12 ^"say ahh i used F12 :)^"")     }     }


All times are GMT -4. The time now is 00:42.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.