AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Enable plugin after the first round (https://forums.alliedmods.net/showthread.php?t=74235)

Maurice 07-14-2008 15:33

Enable plugin after the first round
 
I've a plugin wich give every player at the begin of each round some money. Because the plugin also give money on the first round there is no 'pistol round' anymore wich is a miss.

My question, is it possible to add a feature to any plugin so it only works after the first round is over?

Jon 07-15-2008 10:57

Re: Enable plugin after the first round
 
Code:
#include <amxmodx> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "" new g_round; public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_event("HLTV", "event_newround", "a", "1=0", "2=0"); } public event_newround() {     g_round++         if(g_round >= 1)     {         // give player weapons     } }

Maurice 07-15-2008 13:44

Re: Enable plugin after the first round
 
Thanks Jon!

I'm wondering how i can add this script the best onthe existing plugin, maybe you can jelp me out because honestly said i've no idea.

PHP Code:

#include <amxmodx>
#include <fakemeta>

#define MAX_PLAYERS     32

#define OFFSET_CSMONEY    115

new bool:g_bRestartAttempt[MAX_PLAYERS+1]
new 
g_pcvarRoundStartMoney
new g_msgidMoney

public plugin_init()
{
    
register_plugin("Round StartMoney""1.0""ConnorMcLeod")
    
register_cvar("amx_startmoney""3500")
    
    
register_event("TextMsg""eRestartAttempt""a""2=#Game_will_restart_in")
    
register_event("ResetHUD""eResetHUD""be")

    
register_clcmd("fullupdate""fullupdateCmd")
}

public 
plugin_cfg()
{
    
g_msgidMoney get_user_msgid("Money")
    
g_pcvarRoundStartMoney get_cvar_pointer("amx_startmoney")
}

public 
fullupdateCmd() {
    return 
PLUGIN_HANDLED_MAIN
}

public 
eRestartAttempt() {
    new 
players[MAX_PLAYERS], num
    get_players
(playersnum"a")
    for (new 
inum; ++i)
        
g_bRestartAttempt[players[i]] = true
}

public 
eResetHUD(id) {
    if (
g_bRestartAttempt[id]) {
        
g_bRestartAttempt[id] = false
        
return
    }
    
event_player_spawn(id)
}
 
event_player_spawn(id) {
    new 
iStartMoney get_pcvar_num(g_pcvarRoundStartMoney)

    if(
get_pdata_int(idOFFSET_CSMONEY) >= iStartMoney)
        return

    
set_pdata_int(idOFFSET_CSMONEYiStartMoney)

    
message_begin(MSG_ONE_UNRELIABLEg_msgidMoney_id)
    
write_long(iStartMoney)
    
write_byte(1)
    
message_end()



Maurice 07-15-2008 20:00

Re: Enable plugin after the first round
 
Thanks but when i try to compile this i get some error code messages
017
215
001
029


Jon 07-17-2008 09:42

Re: Enable plugin after the first round
 
Quote:

Originally Posted by Maurice (Post 653345)
Thanks but when i try to compile this i get some error code messages
017
215
001
029


Show me your code.

Xel0z 07-17-2008 10:07

Re: Enable plugin after the first round
 
Quote:

Originally Posted by Jon (Post 654103)
Show me your code.

He was talking there about my crappy code.


All times are GMT -4. The time now is 05:33.

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