AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [MOD] Panic Mod (https://forums.alliedmods.net/showthread.php?t=168396)

fpA 09-28-2011 13:53

[MOD] Panic Mod
 
Hello,

I'm developing my first mod, and i need some help.

For now, I have the base of the mod, but i need ideas and help.
  • Add more game modes.
  • Add infinite bullets to "soldier".
  • Add a menu, with shop,rules,help and admin "submenus".
  • Create soldiers and aliens classes.
  • And optimize the code.

PHP Code:

#include <amxmodx>
#include <engine>
#include <cstrike>
#include <fun>
#include <hamsandwich>

/* =============================== GENERAL =============================== */

new maxplayers
new hud_message

new bool:b_round[33]

public 
plugin_init(){
    
register_plugin("Panic Mod""0.0.1""FPA")
    
    
register_dictionary("pm_lang.txt")
    
    
register_clcmd("drop""DisableDrop")
    
    
set_task(1.0"Status"0""0"b")
    
    
register_logevent("RoundStart"2"1=RoundStart")
    
register_logevent("RoundEnd"2"1=RoundEnd")

    
RegisterHam(Ham_TakeDamage"player""ChangeDamage")
    
    
maxplayers get_maxplayers()
    
hud_message CreateHudSyncObj()    
}
public 
Status(id){ 
    
set_hudmessage(02550, -1.00.906.03.0
    
ShowSyncHudMsg(idhud_message"%L : %i %L : %i %L : %i""HEALTH_HUD"get_user_health(id), "ARMOR_HUD"get_user_armor(id), "POINTS_HUD",  get_user_frags(id))
}
public 
RoundStart(id){
    
set_task(30.0"Game_Start")
    
set_hudmessage(025500.30.1506.05.0)
    
show_hudmessage(0"%L"id"START_MESSAGE")
}
public 
RoundEnd(id){
    
b_round[id] = false
}
public 
GameStart(id){
    new 
round random_num (1,2)
    switch(
round){
        case 
:{
            if(
b_round[id] == false){
                
b_round[id] = true
                alien_round
(id)
                
set_hudmessage(025500.30.1506.05.0)
                
show_hudmessage(0"%L"id"ALIEN_ROUND")
            }
        }
        case 
:{
            if(
b_round[id] == false){
                
b_round[id] = true
                soldier_round
(id)
                
set_hudmessage(025500.30.1506.05.0)
                
show_hudmessage(0"%L"id"SOLDIER_ROUND")
            }
        }
    }
    return 
PLUGIN_HANDLED
}
public 
ChangeDamage(victim,  attackerFloat:damagedamage_bits){ 
    if(
cs_get_user_team(attacker)==CS_TEAM_T)
        
SetHamParamFloat(4damage 1.54
}
/* =============================== OTHERS =============================== */
public client_putinserver(id){
    new 
name[32]
    
get_user_name(idnamecharsmax(name))

    
client_print(idprint_chat"%L"id"MENU_MESSAGE")
    
client_print(idprint_chat"%L"id"WELCOME_MESSAGE")
}
public 
DisableBuyzone(){
    new 
ent find_ent_by_class(-1,"info_map_parameters")
    if(!
ent){
        
ent create_entity("info_map_parameters")
    }
    
DispatchKeyValue(ent,"buying","3")
    
DispatchSpawn(ent)
}
public 
DisableDrop(){
    return 
PLUGIN_HANDLED
}
/* =============================== ROUNDS =============================== */
public alien_round(id){
    for(new 
round 1round <= maxplayersround++){
        if(
is_user_alive(round)){
            
cs_set_user_team(roundCS_TEAM_CT)
        }
    }    
    new 
players[32], count
    get_players
(playerscount"a")
    if(
count){
        new 
iPlayer players[random(count)]
        new 
Float:AlienSpeed get_user_maxspeed(iPlayer) + 100.0
        
new name[32]
        
get_user_name(iPlayernamecharsmax(name))
        
        
cs_set_user_team(iPlayerCS_TEAM_T)
        
set_user_maxspeed(iPlayerAlienSpeed)
        
strip_user_weapons(iPlayer)
        
give_item(iPlayer"weapon_knife")
        
set_user_health(iPlayer5000)
        
set_hudmessage(025500.30.2006.05.0)
        
show_hudmessage(0"%L""ALIEN_ROUND")
    }
}
public 
soldier_round(id){
    for(new 
round 1round <= maxplayersround++){
        if(
is_user_alive(round)){
            
cs_set_user_team(roundCS_TEAM_T)
        }
    }    
    new 
players[32], count
    get_players
(playerscount"a")
    if(
count){
        new 
iPlayer players[random(count)]
        new 
name[32]
        
get_user_name(iPlayernamecharsmax(name))
        
        
cs_set_user_team(iPlayerCS_TEAM_CT)
        
strip_user_weapons(iPlayer)
        
set_user_health(iPlayer250)
        
give_item(iPlayer"weapon_knife")
        
give_item(iPlayer"weapon_deagle")
        
cs_set_user_bpammo(iPlayerCSW_DEAGLE1000)
        
give_item(iPlayer"weapon_m249")
        
cs_set_user_bpammo(iPlayerCSW_M2491000)
        
set_hudmessage(025500.30.2006.05.0)
        
show_hudmessage(0"%L""SOLDIER_ROUND")
    }
}
/* =============================== CLASSES =============================== */ 


e12harry 09-29-2011 04:05

Re: [MOD] Panic Mod
 
I am not a genius in Pawn, but I don't think RoundStart and RoundEnd have id parameter. These are global events.
Second thing in alien_round and soldier_round you move all players to T/CT and than move one player to oposit team, won't it mess up round end/start?

nightzombie 09-29-2011 05:02

Re: [MOD] Panic Mod
 
Omg nice... ^^ can i have your messenger adress? (Add me: [email protected] )

Stereo 09-29-2011 14:40

Re: [MOD] Panic Mod
 
Quote:

Originally Posted by e12harry (Post 1565144)
I am not a genius in Pawn, but I don't think RoundStart and RoundEnd have id parameter. These are global events.
Second thing in alien_round and soldier_round you move all players to T/CT and than move one player to oposit team, won't it mess up round end/start?

Yes, the round end/start haven't got parameters, you need to do a for(..)

MyPc 09-29-2011 14:54

Re: [MOD] Panic Mod
 
It does not have any parameters so the "(id)" thing just forces the round start / end to be ignored .


All times are GMT -4. The time now is 19:45.

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