Raised This Month: $ Target: $400
 0% 

[Solved]Exchange T and CT Spawn on Round Start


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 09-21-2013 , 09:30   [Solved]Exchange T and CT Spawn on Round Start
Reply With Quote #1

Code Still has Bugs .. Uploaded back before i fixed them On special request by Hornet I dont think now this is required in New plugin submissions. So fix the bugs and use it Here you go.

PHP Code:
#include <amxmodx> 
#include <fun>
#include <engine>

new g_playerT,g_playerCT;
new 
g_maxplayers

public plugin_init() 
{               
register_event("HLTV""event_NewRound""a""1=0""2=0");             
register_event"DeathMsg""EventDeathMsg""a""1>0" );
g_maxplayers get_maxplayers()    


public 
event_NewRound() {         
//client_print(g_playerCT, print_chat, "Delaying 2 seconds");
set_task(2.0,"spawnplayers")   


public 
EventDeathMsg() {
new 
killer read_data(1);
new 
victim read_data(2);
if ( 
g_playerT && victim == g_playerT && is_user_connected(killer) ) {                 
new 
killer_name[32], victim_name[32];                 
get_user_name(killerkiller_namecharsmax(killer_name));         
get_user_name(victimvictim_namecharsmax(victim_name));                 
colored_print(0"^x04 %s saved the Asses of Ts by killing %s and was given 50HP Bonus :D"killer_name,victim_name);
show_hudmessage(killer ,"Bonus +50 HP[Deathmsg]");
set_user_health(killerget_user_health(killer) + 50);


if ( 
g_playerCT && victim == g_playerCT && is_user_connected(killer) ) {                 
new 
killer_name[32], victim_name[32];                 
get_user_name(killerkiller_namecharsmax(killer_name));         
get_user_name(victimvictim_namecharsmax(victim_name));                 
colored_print(0"^x04 %s saved the Asses of Ts by killing %s and was given 50HP Bonus :D"killer_name,victim_name);
show_hudmessage(killer ,"Bonus +50 HP[Deathmsg]");
set_user_health(killerget_user_health(killer) + 50);
}
}

public 
client_disconnect(id) {     
if ( 
id == g_playerT )         
g_playerT 0

if ( 
id == g_playerCT )         
g_playerCT 0



public 
spawnplayers()
{
if ( 
g_playerT ) {
//colored_print(g_playerT, "Saale Bach kaise gya xD !!")        
//client_print(g_playerT, print_chat, "Phew.. You have survived the round !!");           
}         
if ( 
g_playerCT ) {        
//colored_print(g_playerCT, "Saale Bach kaise gya xD !!")
//client_print(g_playerCT, print_chat, "Phew ..You have survived the round !!");           


g_playerT 0;
g_playerCT 0;

new 
playersT[32], playersnumT;     
new 
playersCT[32], playersnumCT

get_players(playersTplayersnumT"a""TERRORIST");
get_players(playersCTplayersnumCT"a""CT");

g_playerT playersT[random(playersnumT)];  
   
g_playerCT playersCT[random(playersnumCT)];      

new 
nameT[32],nameCT[32];     
get_user_name(g_playerTnameTcharsmax(nameT));   
get_user_name(g_playerCTnameCTcharsmax(nameCT));     

//client_print(g_playerCT, print_chat, "Players chosen");

new Tspot[33][3]
new 
CTspot[33][3]

//Get Spawn
get_user_origin(g_playerT,Tspot[g_playerT])
get_user_origin(g_playerCT,CTspot[g_playerCT])

//client_print(0, print_chat, "Spawns GET!");

//Set Spawn
set_user_origin(g_playerT,CTspot[g_playerCT])
set_user_origin(g_playerCT,Tspot[g_playerT])

//client_print(0, print_chat, "Spawns SET!");
set_user_health(g_playerTget_user_health(g_playerT) + 100);
set_user_health(g_playerCTget_user_health(g_playerCT) + 100);
//Done Spawning
colored_print(0"^x04Spawns of %s & %s are exchanged :D Kill Or Get Killed!"nameTnameCT); 
}

/*
public event_HamKilled(victim, killer) 

set_hudmessage(127, 170, 255, 0.27, 0.14, 0, 5.0, 5.0, 0.0, 0.0, -1);
    
if ( g_playerT && victim == g_playerT && is_user_connected(killer) ) {                 
new killer_name[32], victim_name[32];                 
get_user_name(killer, killer_name, charsmax(killer_name));         
get_user_name(victim, victim_name, charsmax(victim_name));                 
colored_print(0, "^x04 %s saved the Asses of CTs by killing %s and was given 50HP Bonus :D[HAM]", killer_name,victim_name);
show_hudmessage(killer ,"Bonus +50 HP[HAM]");
set_user_health(killer, get_user_health(killer) + 50);


if ( g_playerCT && victim == g_playerCT && is_user_connected(killer) ) {                 
new killer_name[32], victim_name[32];                 
get_user_name(killer, killer_name, charsmax(killer_name));         
get_user_name(victim, victim_name, charsmax(victim_name));                 
colored_print(0, "^x04 %s saved the Asses of Ts by killing %s and was given 50HP Bonus :D[HAM]", killer_name,victim_name);
show_hudmessage(killer ,"Bonus +50 HP[HAM]");
set_user_health(killer, get_user_health(killer) + 50);
}
}
*/

// Colored print by MeRcyLeZZ
colored_print(target, const message[], any:...)
{
    static 
buffer[512], iargscountg_msgSayText
    argscount 
numargs()
    
g_msgSayText get_user_msgid("SayText")
    
    
// Send to everyone
    
if (!target)
    {
        static 
player
        
for (player 1player <= g_maxplayersplayer++)
        {
            
// Not connected
            
if (!is_user_connected(player))
                continue;
            
            
// Remember changed arguments
            
static changed[5], changedcount // [5] = max LANG_PLAYER occurencies
            
changedcount 0
            
            
// Replace LANG_PLAYER with player id
            
for (2argscounti++)
            {
                if (
getarg(i) == LANG_PLAYER)
                {
                    
setarg(i0player)
                    
changed[changedcount] = i
                    changedcount
++
                }
            }
            
            
// Format message for player
            
vformat(buffercharsmax(buffer), message3)
            
            
// Send it
            
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_player)
            
write_byte(player)
            
write_string(buffer)
            
message_end()
            
            
// Replace back player id's with LANG_PLAYER
            
for (0changedcounti++)
                
setarg(changed[i], 0LANG_PLAYER)
        }
    }
    
// Send to specific target
    
else
    {
        
// Format message for player
        
vformat(buffercharsmax(buffer), message3)
        
        
// Send it
        
message_begin(MSG_ONEg_msgSayText_target)
        
write_byte(target)
        
write_string(buffer)
        
message_end()
    }

__________________
You keep bringing ANTICHRISTUS down .. He will rise again and kick asses !

#RespectList ANTICHRISTUS fysiks Bugsy

Most Common Errors You Can Encounter Every Now and Then

Last edited by devilicioux; 09-26-2013 at 06:15. Reason: Here you go hornet.See what USERS put together for me. Thanks to Black Rose as usual :)
devilicioux is offline
 



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 18:50.


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