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

Round Survival Money


Post New Thread Reply   
 
Thread Tools Display Modes
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 10-02-2007 , 18:05   Re: Round Survival Money
Reply With Quote #11

I fixed a lot of crap for you, so use this as a base to do what connorr said.
This isn't complete, as it still needs a lot of work. However, this should be a lot nicer to look at and code with now.

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

#define PLUGIN "Round Survival Money"
#define VERSION "1.0"
#define AUTHOR "X-Script"

new roundsurvivalroundreward

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_logevent("new_round"2"0=World triggered""1=Round_Start")
    
    
roundsurvival register_cvar("amx_survivemode""1")
    
roundreward register_cvar("amx_survivecash""3000")
}

public 
new_round()
{
    if (
get_pcvar_num(roundsurvival) < 1)
        return 
PLUGIN_HANDLED
    
    client_print
(0print_chat"[AMXX] ROUND STARTED: Survive to get $%i at the end of the round!"get_pcvar_num(roundreward))
    return 
PLUGIN_HANDLED
}

public 
round_end(id)
{
    if (
get_pcvar_num(roundsurvival) < 1)
        return 
PLUGIN_HANDLED
    
    
if (is_user_alive(id))
    {
        new 
newmoney cs_get_user_money(id) + get_pcvar_num(roundreward)
        
cs_set_user_money(idnewmoney)
        
        
client_print(idprint_chat"[AMXX] ROUND ENDED: You have survived and been awarded $%i!"get_pcvar_num(roundreward))
        
        
set_user_rendering(id,  kRenderFxSolidSlow1010010kRenderNormal25)
        
set_task(8.0"glow_off"id)
    }
    return 
PLUGIN_HANDLED
}

public 
glow_off(id)
{
    
set_user_rendering(id)

__________________

Last edited by M249-M4A1; 10-02-2007 at 18:07.
M249-M4A1 is offline
X-Script
BANNED
Join Date: Jul 2007
Location: (#504434)
Old 10-02-2007 , 18:09   Re: Round Survival Money
Reply With Quote #12

I'm going to release it for now, and work on it later.

;)

thanks.
X-Script is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 10-02-2007 , 18:24   Re: Round Survival Money
Reply With Quote #13

Quote:
Originally Posted by X-Script View Post
I'm going to release it for now, and work on it later.

;)

thanks.
I made all the necessary changes for you............

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

#define PLUGIN "Round Survival Money"
#define VERSION "1.0"
#define AUTHOR "X-Script"

new roundsurvivalroundreward

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_logevent("round_end"2"0=World triggered""1=Round_End")
    
register_logevent("new_round"2"0=World triggered""1=Round_Start")
    
    
roundsurvival register_cvar("amx_survivemode""1")
    
roundreward register_cvar("amx_survivecash""3000")
}

public 
new_round()
{
    if (
get_pcvar_num(roundsurvival) < 1)
        return 
PLUGIN_HANDLED
    
    client_print
(0print_chat"[AMXX] ROUND STARTED: Survive this round and win an additional $%i!"get_pcvar_num(roundreward))
    return 
PLUGIN_HANDLED
}

public 
round_end()
{
    if (
get_pcvar_num(roundsurvival) < 1)
        return 
PLUGIN_HANDLED
    
    
new players[32], totalplayers
    get_players
(playerstotalplayers)
    
    for (new 
0totalplayersi++) {
        if (
is_user_alive(players[i])) {
            
            new 
newmoney cs_get_user_money(players[i]) + get_pcvar_num(roundreward)
            
cs_set_user_money(players[i], newmoney)
            
            
client_print(players[i], print_chat"[AMXX] ROUND ENDED: You survived and have been awarded $%i!"get_pcvar_num(roundreward))
            
            
set_user_rendering(players[i],  kRenderFxGlowShell255255255kRenderNormal0)
            
set_task(8.0"glow_off"players[i])
        }
        else 
            
client_print(players[i], print_chat"[AMXX] ROUND ENDED: You did not survive this round. No award for you. Better luck next time!")
    }    
    
    return 
PLUGIN_HANDLED
}

public 
glow_off(id)
{
    
set_user_rendering(id)

__________________

Last edited by M249-M4A1; 10-02-2007 at 18:27.
M249-M4A1 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-02-2007 , 18:37   Re: Round Survival Money
Reply With Quote #14

Optimized a bit cause you shouln't get tha cvar pointer twice in the same function.
Also added a taskID, not needed at the moment but you need to do another task it will.
Code:
#include <amxmodx> #include <amxmisc> #include <cstrike> #include <fun> #define PLUGIN "Round Survival Money" #define VERSION "1.0" #define AUTHOR "X-Script" #define TASKID 978645 new roundsurvival, roundreward public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_logevent("round_end", 2, "0=World triggered", "1=Round_End")     register_logevent("new_round", 2, "0=World triggered", "1=Round_Start")         roundsurvival = register_cvar("amx_survivemode", "1")     roundreward = register_cvar("amx_survivecash", "3000") } public new_round() {     if (!get_pcvar_num(roundsurvival))         return PLUGIN_HANDLED         client_print(0, print_chat, "[AMXX] ROUND STARTED: Survive this round and win an additional $%i!", get_pcvar_num(roundreward))     return PLUGIN_HANDLED } public round_end() {     if (!get_pcvar_num(roundsurvival))         return PLUGIN_HANDLED         new players[32], totalplayers, player     get_players(players, totalplayers)         for (new i = 0; i < totalplayers; i++) {         player = players[i]         if (is_user_alive(player)) {                         new money_to_give = get_pcvar_num(roundreward)             cs_set_user_money(player, cs_get_user_money(player) + money_to_give)                         client_print(player, print_chat, "[AMXX] ROUND ENDED: You survived and have been awarded $%i!", money_to_give)                         set_user_rendering(player,  kRenderFxGlowShell, 255, 255, 255, kRenderNormal, 0)             set_task(8.0, "glow_off", player+TASKID)         }         else             client_print(player, print_chat, "[AMXX] ROUND ENDED: You did not survive this round. No award for you. Better luck next time!")     }            return PLUGIN_HANDLED } public glow_off(id) {     id -= TASKID     set_user_rendering(id) }
ConnorMcLeod is offline
X-Script
BANNED
Join Date: Jul 2007
Location: (#504434)
Old 10-02-2007 , 18:38   Re: Round Survival Money
Reply With Quote #15

I just tried my version (without looking at your post) and it gave me two tag-mismatches and I completly HATE those, so i'll go with yours.
X-Script is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 10-02-2007 , 18:45   Re: Round Survival Money
Reply With Quote #16

Thanks for the tip, connorr (@ player = players[i] and taskid)

@X-Script, you dislexic bastard lol. It's M249-M4A1, not M429-M4A1
jk, not a big deal... Are you tired or something? When I suggested $3000, you ended up putting $30,000 in the script, and you had a lot of careless errors. Get some sleep!
__________________

Last edited by M249-M4A1; 10-02-2007 at 18:58.
M249-M4A1 is offline
X-Script
BANNED
Join Date: Jul 2007
Location: (#504434)
Old 10-02-2007 , 18:50   Re: Round Survival Money
Reply With Quote #17

Quote:
Originally Posted by M249-M4A1 View Post
Thanks for the tip, connorr
X-Script is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 10-02-2007 , 18:51   Re: Round Survival Money
Reply With Quote #18

Read the updated post, I wasn't finished with my thought when I hit the reply button. lol
__________________
M249-M4A1 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-02-2007 , 19:17   Re: Round Survival Money
Reply With Quote #19

Again, you don't have to return PLUGIN_HANDLED...

You should not return PLUGIN_HANDLED all the time... -_-
__________________

Last edited by Arkshine; 10-02-2007 at 19:19.
Arkshine is offline
X-Script
BANNED
Join Date: Jul 2007
Location: (#504434)
Old 10-02-2007 , 19:42   Re: Round Survival Money
Reply With Quote #20

@M4: I'm aware of it I always check for updated posts.

@arkshine: I use return PLUGIN_HANDLED because it makes the code look cleaner. ;)

Last edited by X-Script; 10-02-2007 at 19:49.
X-Script is offline
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 17:05.


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