View Single Post
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 07-20-2014 , 15:22   Weapons War (Developer Mode)
Reply With Quote #4

Weapons War
(Developer Mode)


cs_war.inc file?

So, this is the list of natives and forwards:
-->
For example, just download the war_trail.sma file to see how to use them. ;)

Custom Weapon War?

Just see custom_war.sma file. ;)
-->
How to use the API?
PHP Code:
///////////////////////////////////////////////////////////////
// Below is how to get current weapon war round as global string? 

// String
new g_sCurrentWar[32]

public 
cs_fw_war_start()
{
    
// Just use native cs_current_war(const szWarName[], iLen) inside cs_fw_war_start() forward. ;)
    
cs_current_war(g_sCurrentWarcharsmax(g_sCurrentWar))    
}

public 
cs_fw_vote_start()
{
    if(
equal(g_sCurrentWar"Auto-Shotgun"))
    {
        
client_print(0print_chat"Voting Auto-Shotgun round!")
    }
}

/////////////////////////////////////////////////////////////
// Below is how to use cs_fw_war_start() forward.
public cs_fw_war_start()
{
    
// Below is how to get current weapon war round. ;)
    // Just use native cs_current_war(const szWarName[], iLen);
    
new sCurrentWar[32]
    
cs_current_war(sCurrentWarcharsmax(sCurrentWar))
    
    if(
equal(sCurrentWar"Auto-Shotgun"))
    {
        
client_print(0print_chat"Now is Auto-Shotgun round!")
    }
}

/////////////////////////////////////////////////////////////
// Below is how to use cs_fw_vote_start() forward.
public cs_fw_war_end()
{
    
client_print(0print_chat"End of war!")
}

/////////////////////////////////////////////////////////////
// Below is how to use cs_fw_vote_start() forward.
public cs_fw_vote_start()
{
    
client_print(0print_chat"Please vote now!")
}

/////////////////////////////////////////////////////////////
// Below is how to use cs_fw_vote_end() forward.
public cs_fw_vote_end()
{
    
client_print(0print_chat"End of voting!")
}

/////////////////////////////////////////////////////////////
// Below is how to use cs_is_point_leader(id) native.
public fw_PlayerRespawn(id)
{
    if(
is_user_alive(id))
    {
        
// If point leader still in server after war round. Just tell about it again. ;)
        
if(cs_is_point_leader(id))
        {
            new 
szName[32]
            
get_user_name(idszNamecharsmax(szName))
            
            
client_print(0print_chat"[WW] %s is points leader!"szName)
        }
    }

API Example?

Just download the war_trail.sma file to see how to use them.

Then, open the war_trail.sma file to configure the trail color:
PHP Code:
    g_iWarTrail register_cvar("ww_allow_trail""1"// Allow player trail during war round
    
g_iCTAdminTrail register_cvar("ww_CT_admin_trail""0 255 0"// Trail color for CT admin
    
g_iTAdminTrail register_cvar("ww_T_admin_trail""255 127 0"// Trail color for T admin
    
g_iCTTrail register_cvar("ww_CT_trail""0 0 255"// Trail color for CT player
    
g_iTTrail register_cvar("ww_T_trail""255 0 0"// Trail color for T player 
Downloads:
-->

Codes now is at GitHub:


Attached Files
File Type: inc cs_war.inc (1.6 KB, 556 views)
File Type: sma Get Plugin or Get Source (custom_war.sma - 1227 views - 3.1 KB)
File Type: sma Get Plugin or Get Source (war_trail.sma - 1155 views - 2.0 KB)

Last edited by zmd94; 10-07-2015 at 00:33.
zmd94 is offline