AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Little problem. (https://forums.alliedmods.net/showthread.php?t=184296)

Napoleon_be 05-03-2012 12:54

Little problem.
 
PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <colorchat>
#include <fun>
#include <hamsandwich>

#define VERSION "1.0.0"

new pPlugin
new pPrefix

new szPrefix[32]
new 
iNoscope[33]
new 
iNormal[33]
new 
iHighGravity[33]

public 
plugin_init() {
    
register_plugin("ScoutzKnivez Fun Rounds"VERSION"NapoleoN#")
    
register_forward(FM_CmdStart"CmdStart")
    
    
RegisterHam(Ham_Spawn"player""FwPlayerSpawn")
    
    
pPlugin register_cvar("sk_enable""1")
    
pPrefix register_cvar("sk_prefix""SK")
    
    
get_pcvar_string(pPrefixszPrefixcharsmax(szPrefix))
}

public 
FwPlayerSpawn(id) {
    
iNoscope[id] = 0
    iNormal
[id] = 0
    iHighGravity
[id] = 0
    
    set_user_gravity
(id)
    if(
is_user_alive(id) && get_pcvar_num(pPlugin)) {
        switch(
random_num(13)) {
            case 
1Cmd_NoScope(id)
            case 
2Cmd_Normal(id)
            case 
3Cmd_HigherGravity(id)
        }
    }
}

public 
Cmd_NoScope(id) {
    if(
is_user_alive(id)) {
        
set_task(0.1"CmdStart"id)
        
iNoscope[id] = 1
        ColorChat
(idGREEN"[%s]^1 The current round is:^4 No Scope only!"szPrefix)
    }
}        

public 
CmdStart(idHandle) {
    if(
iNoscope[id] == && is_user_alive(id)) {
        static 
button
        button 
get_uc(HandleUC_Buttons)
    
        if (
button IN_ATTACK2) {
            
button &= ~IN_ATTACK2
        
}
    
        
set_uc(HandleUC_Buttonsbutton)
    }
}

public 
Cmd_Normal(id) {
    if(
is_user_alive(id)) {
        
ColorChat(idGREEN"[%s]^1 The current round is:^4 Normal round!"szPrefix)
        
iNormal[id] = 1
    
}
}
        
public 
Cmd_HigherGravity(id) {
    if(
is_user_alive(id)) {
        
iHighGravity[id] = 1
        set_user_gravity
(id0.2)
        
ColorChat(idGREEN"[%s]^1 The current round is:^4 Higher Gravity!"szPrefix)
    }


I've made a simple code, but on Cmd_HigherGravity, the gravity doesn't set the asked value, also on the ham_spawn event, i want to set the IN_ATTACK2 back to normal and stop blocking it, how to do that?

Exolent[jNr] 05-03-2012 12:56

Re: Little problem.
 
Change your spawn hook to post.

Napoleon_be 05-03-2012 13:02

Re: Little problem.
 
Works perfectly, thanks :)


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

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