Raised This Month: $ Target: $400
 0% 

[Solved]Exchange T and CT Spawn on Round Start


Post New Thread Reply   
 
Thread Tools Display Modes
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
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 09-21-2013 , 10:28   Re: Exchange T and CT Spawn on Round Start
Reply With Quote #2

When is the event called?
__________________
Black Rose is offline
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 09-21-2013 , 10:45   Re: Exchange T and CT Spawn on Round Start
Reply With Quote #3

Yeah sorry missed out ..

PHP Code:
register_event("HLTV""event_NewRound""a""1=0""2=0"); 
__________________
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
devilicioux is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 09-21-2013 , 11:08   Re: Exchange T and CT Spawn on Round Start
Reply With Quote #4

That is called before players spawn.
Use Ham_Spawn for "player" in post
__________________
Black Rose is offline
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 09-21-2013 , 11:16   Re: Exchange T and CT Spawn on Round Start
Reply With Quote #5

Quote:
Originally Posted by Black Rose View Post
That is called before players spawn.
Use Ham_Spawn for "player" in post
But will the Ham_spawn be called everytime a player spawns/respawns in between round as well ? I dont understand how to use it for just 2 players Only on Round start

Check these as well.. Now i am getting confused

Quote:
Originally Posted by minimiller View Post
HLTV hooks round start
i believe players spawn 1 server frame after that
Quote:
Originally Posted by hleV View Post
What do you mean "Ham_Spawn called in HLTV"? Ham_Spawn is called when player spawns and HLTV is called on the new round.

Usually player spawns (and Ham_Spawn is called) at about the same time when HLTV is called.
Quote:
Originally Posted by Arkshine View Post
When a new round is called players spawn right after.
__________________
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-21-2013 at 11:17.
devilicioux is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 09-21-2013 , 11:22   Re: Exchange T and CT Spawn on Round Start
Reply With Quote #6

Then delay it using set_task() from HLTV.

Here's the order of different functions:
Code:
event_HLTV, global
fwd_HamPlayerSpawnPre, specific
fwd_HamPlayerSpawnPost, specific
event_ResetHUD, specific
logevent_RoundStart, global
__________________

Last edited by Black Rose; 09-21-2013 at 11:25.
Black Rose is offline
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 09-21-2013 , 12:21   Re: Exchange T and CT Spawn on Round Start
Reply With Quote #7

Quote:
Originally Posted by Black Rose View Post
Then delay it using set_task() from HLTV.

Here's the order of different functions:
Code:
event_HLTV, global
fwd_HamPlayerSpawnPre, specific
fwd_HamPlayerSpawnPost, specific
event_ResetHUD, specific
logevent_RoundStart, global

Thanks it worked 1 second delay did the work perfectly
__________________
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
devilicioux is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 09-22-2013 , 08:20   Re: [Solved]Exchange T and CT Spawn on Round Start
Reply With Quote #8

Quote:
Originally Posted by devilicioux View Post
Trash this Please.
Why did you edit your post?
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.
wickedd is offline
Old 09-22-2013, 08:31
dark_style
This message has been deleted by dark_style. Reason: useless post in useless thread
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 09-22-2013 , 08:47   Re: [Solved]Exchange T and CT Spawn on Round Start
Reply With Quote #9

Quote:
Originally Posted by wickedd View Post
Why did you edit your post?
Quote:
Last edited by devilicioux; Today at 02:24 AM. Reason: Will release the plugin as in New plugin Submissions
Releasing a plugin that other users just put together for you ... Sounds convincing ...
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.
hornet is offline
devilicioux
Veteran Member
Join Date: Jun 2013
Location: Delhi,India
Old 09-26-2013 , 06:05   Re: [Solved]Exchange T and CT Spawn on Round Start
Reply With Quote #10

Quote:
Originally Posted by hornet View Post
Releasing a plugin that other users just put together for you ... Sounds convincing ...
Have a look at the complete post before you say that. I dont see any codes/help from USER"S" except Black Rose .. where did that USERS come from Mr. Hornet ?
+ You should have a problem when i am going to make the plugin private on which people helped me instead i am going to release it in new plugin .. Does that create a problem ?
__________________
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:06. Reason: Seems like Hornet has a problem with my editing post .. Restoring the main code.
devilicioux 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 18:50.


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