Raised This Month: $51 Target: $400
 12% 

preventing player from getting extra frags


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rufee
Junior Member
Join Date: Aug 2008
Location: Lithuania
Old 03-04-2009 , 14:01   preventing player from getting extra frags
Reply With Quote #1

i need some way to protect the player from pressing the button twice so that he doesnt get extra frags(score)
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <fakemeta>
#include <hamsandwich>
#define PLUGIN "Push the button"
#define VERSION "1.0"
#define AUTHOR "rufee"
public plugin_init() {
register_plugin(PLUGINVERSIONAUTHOR)
RegisterHam(Ham_Use"func_button",    "hamUse"); 
}
public 
hamUse(ent,id
{
 new 
iPlayers[32];
 new 
iNum;
 new 
szTarget[32]
 
pev(entpev_targetszTarget31)
 if ( 
equal(szTarget"ct_target")) {
  if(
get_user_team(id) == 2){ 
 
client_print(idprint_chat"[Push the button]You can't push your own button!")
}
else
{
 
get_playersiPlayers iNum ,"ae" ,"CT" );
 for( new 
0iNum i++){ 
  
set_user_frags(iPlayers[i],get_user_frags(iPlayers[i])+1); 
 
user_kill(iPlayers[i])
 }
 
set_user_frags(id,get_user_frags(id)+1)
  
client_print(idprint_chat"[Push the button]You pushed the button!")
}
}
 if ( 
equal(szTarget"t_target")) {
if(
get_user_team(id) == 1){ 
 
client_print(idprint_chat"[Push the button]You can't push your own button!")
}
else
{
  
get_playersiPlayers iNum ,"ae" ,"TERRORIST" );
 for( new 
0iNum i++){
  
set_user_frags(iPlayers[i],get_user_frags(iPlayers[i])+1)
 
user_kill(iPlayers[i])
 }
 
set_user_frags(id,get_user_frags(id)+1)
  
client_print(idprint_chat"[Push the button]You pushed the button!")
 }
}

__________________

Last edited by rufee; 03-04-2009 at 14:06.
rufee is offline
Old 03-04-2009, 14:11
AntiBots
This message has been deleted by AntiBots.
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 03-04-2009 , 14:22   Re: preventing player from getting extra frags
Reply With Quote #2

PHP Code:
new g_havetouch[33]

enum
{
    
TT 1,
    
CT 2
}

public 
hamUse(entid
{
    if( 
g_havetouch[id] )
        return 
HAM_IGNORED
    
    
new iPlayers[32];
    new 
iNum;
    new 
szTarget[32]
    
pev(entpev_targetszTarget31)
    
    if( 
is_user_alive(id) && ( equal(szTarget"ct_target") || equal(szTarget"t_target") ) )
    {
        new 
style equal(szTarget"ct_target") ? CT TT
        
        
if( get_user_team(id) == style )
        { 
            
client_print(idprint_chat"[Push the button] You can't push your own button!")
        }
        else
        {
            
get_playersiPlayers iNum ,"ae"style == CT "CT" "TERRORIST");
            for( new 
0iNum i++)
            { 
                
set_user_frags(iPlayers[i],get_user_frags(iPlayers[i])+1); 
                
user_kill(iPlayers[i])
            }
            
set_user_frags(id,get_user_frags(id)+1)
            
client_print(idprint_chat"[Push the button] You pushed the button!")
            
g_havetouch[id] = true
        
}
    }
    
    return 
HAM_IGNORED

__________________

Last edited by AntiBots; 03-04-2009 at 14:28.
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
rufee
Junior Member
Join Date: Aug 2008
Location: Lithuania
Old 03-05-2009 , 08:28   Re: preventing player from getting extra frags
Reply With Quote #3

seems to work but when a player presses the enemy button he cant press it anymore even on the next round
__________________
rufee is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 03-05-2009 , 10:02   Re: preventing player from getting extra frags
Reply With Quote #4

Quote:
Originally Posted by rufee View Post
i need some way to protect the player from pressing the button twice so that he doesnt get extra frags(score)
I'm curious what you mean by this. I've never heard of such a thing before.
__________________
Brad is offline
rufee
Junior Member
Join Date: Aug 2008
Location: Lithuania
Old 03-05-2009 , 10:34   Re: preventing player from getting extra frags
Reply With Quote #5

well i have 2 buttons in a map each belongs to a team
the way i written the script the player can press the enemy button many times and get more score, instead of +1 they get +16 etc... so i need to let the player and the whole team press the enemy button 1 time per round
__________________

Last edited by rufee; 03-06-2009 at 11:54.
rufee is offline
Old 03-06-2009, 11:54
rufee
This message has been deleted by rufee. Reason: bump
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:04.


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