Raised This Month: $ Target: $400
 0% 

[L4D2] Help! How to execute my code when a zombie is entering ghost mode


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
super_leaf
Junior Member
Join Date: Oct 2012
Old 09-08-2013 , 12:53   [L4D2] Help! How to execute my code when a zombie is entering ghost mode
Reply With Quote #1

My goal is spawning boomer only in versus, which means players are only allowed to spawn as boomers. I can change the current infected to a boomer when player is in ghost spawning mode, but i dont know when to trigger this. There is no such event for me to hook like "player_enter_ghost_spawning_mode". So how am I going to implement my method? I tried using event ghost_spawn_time and set a timer to execute the change infected class function. But it doesn't work, or in other words, i dont know how to use this event. Please help me to execute my function whenever a player is entering the spawning mode as a ghost.

I know that there are plugins which have similar functions. I was constantly looking for plugins like 3v3 hunter mode or 3v3 chargervs melee mode but i failed. If you have the links to any mode like these two, plz post them to me! Thanks !

Last edited by super_leaf; 09-08-2013 at 12:54.
super_leaf is offline
Marcus101RR
Veteran Member
Join Date: Aug 2009
Location: Tampa, FL
Old 09-08-2013 , 13:17   Re: [L4D2] Help! How to execute my code when a zombie is entering ghost mode
Reply With Quote #2

Quote:
Originally Posted by super_leaf View Post
My goal is spawning boomer only in versus, which means players are only allowed to spawn as boomers. I can change the current infected to a boomer when player is in ghost spawning mode, but i dont know when to trigger this. There is no such event for me to hook like "player_enter_ghost_spawning_mode". So how am I going to implement my method? I tried using event ghost_spawn_time and set a timer to execute the change infected class function. But it doesn't work, or in other words, i dont know how to use this event. Please help me to execute my function whenever a player is entering the spawning mode as a ghost.

I know that there are plugins which have similar functions. I was constantly looking for plugins like 3v3 hunter mode or 3v3 chargervs melee mode but i failed. If you have the links to any mode like these two, plz post them to me! Thanks !
z_versus_boomer_limit 4
z_versus_smoker_limit 0
z_versus_hunter_limit 0

etc.
__________________
Marcus101RR is offline
Send a message via AIM to Marcus101RR Send a message via Skype™ to Marcus101RR
super_leaf
Junior Member
Join Date: Oct 2012
Old 09-08-2013 , 18:08   Re: [L4D2] Help! How to execute my code when a zombie is entering ghost mode
Reply With Quote #3

Quote:
Originally Posted by Marcus101RR View Post
z_versus_boomer_limit 4
z_versus_smoker_limit 0
z_versus_hunter_limit 0

etc.
Well, Seems like u dont undersstand my question.

These cvars i have already set all to 0 except for boomers, they are for the bots, but the game mode is versus, that means these convars will not restrict the spawning type of a client zombie and i have already tested that things are not that simple. As I said, i just want to trigger my function whenever a player is entering ghost spawning mode(after the countdown of spawn after N seconds) There is a similiar one for respawning(the event name:"respawning"), but what I want is not respawn. Thanks if you can look for such a way for me to trigger the function
super_leaf is offline
Marcus101RR
Veteran Member
Join Date: Aug 2009
Location: Tampa, FL
Old 09-08-2013 , 18:46   Re: [L4D2] Help! How to execute my code when a zombie is entering ghost mode
Reply With Quote #4

Quote:
Originally Posted by super_leaf View Post
Well, Seems like u dont undersstand my question.

These cvars i have already set all to 0 except for boomers, they are for the bots, but the game mode is versus, that means these convars will not restrict the spawning type of a client zombie and i have already tested that things are not that simple. As I said, i just want to trigger my function whenever a player is entering ghost spawning mode(after the countdown of spawn after N seconds) There is a similiar one for respawning(the event name:"respawning"), but what I want is not respawn. Thanks if you can look for such a way for me to trigger the function
They work just fine for all of us, matter of fact they even work in left 4 dead 1, you are not using them correctly, be reminded you need to do the same with the coop versions of those convars. Also, it is not just for bots, it applies for the versus game and all its players.

Again, you do not need a plugin to control what type of infected are allowed, because the plugin that exists and it does exactly the same thing i just posted, it changed the convars for you. Confogl did the same actually, just changed cvars in the plugin.

So, just learn to use your cfgs.

Quote:
My goal is spawning boomer only in versus
Pretty sure I understand your goal, very clearly and effectively.
__________________

Last edited by Marcus101RR; 09-08-2013 at 18:50.
Marcus101RR is offline
Send a message via AIM to Marcus101RR Send a message via Skype™ to Marcus101RR
super_leaf
Junior Member
Join Date: Oct 2012
Old 09-09-2013 , 00:12   Re: [L4D2] Help! How to execute my code when a zombie is entering ghost mode
Reply With Quote #5

Quote:
Originally Posted by Marcus101RR View Post
They work just fine for all of us, matter of fact they even work in left 4 dead 1, you are not using them correctly, be reminded you need to do the same with the coop versions of those convars. Also, it is not just for bots, it applies for the versus game and all its players.

Again, you do not need a plugin to control what type of infected are allowed, because the plugin that exists and it does exactly the same thing i just posted, it changed the convars for you. Confogl did the same actually, just changed cvars in the plugin.

So, just learn to use your cfgs.


Pretty sure I understand your goal, very clearly and effectively.
PHP Code:
SetConVarInt(FindConVar("z_jockey_limit"),0,true);
SetConVarInt(FindConVar("z_charger_limit"),0,true);
SetConVarInt(FindConVar("z_hunter_limit"),0,true);
SetConVarInt(FindConVar("z_spitter_limit"),0,true);
SetConVarInt(FindConVar("z_smoker_limit"),0,true);
SetConVarInt(FindConVar("z_boomer_limit"),99,true); 
I have already set all convars to maximize boomers, but as I said, these convars are only for BOTS Player, if you are playing as a human player and join infected, you are still able to spawn as a charger, smoker or other infected. I have tested this out and I can still spawn as a charger or hunter. Inform me if I have any mistake in the code, or write a code for me thanks.
super_leaf is offline
Marcus101RR
Veteran Member
Join Date: Aug 2009
Location: Tampa, FL
Old 09-09-2013 , 16:29   Re: [L4D2] Help! How to execute my code when a zombie is entering ghost mode
Reply With Quote #6

Quote:
Originally Posted by super_leaf View Post
PHP Code:
SetConVarInt(FindConVar("z_jockey_limit"),0,true);
SetConVarInt(FindConVar("z_charger_limit"),0,true);
SetConVarInt(FindConVar("z_hunter_limit"),0,true);
SetConVarInt(FindConVar("z_spitter_limit"),0,true);
SetConVarInt(FindConVar("z_smoker_limit"),0,true);
SetConVarInt(FindConVar("z_boomer_limit"),99,true); 
I have already set all convars to maximize boomers, but as I said, these convars are only for BOTS Player, if you are playing as a human player and join infected, you are still able to spawn as a charger, smoker or other infected. I have tested this out and I can still spawn as a charger or hunter. Inform me if I have any mistake in the code, or write a code for me thanks.
Assuming this is all of it, the reason its not working is...
A. Really do not need a plugin for this, just use the cfgs.
B. You forget the Versus variables.
C. 99 Boomers is a bad idea. Use something reasonable.

I tested this on my server, works fine, I can even make a video and show you that versus with boomers or any type of infected in any combination or order works fine.
__________________
Marcus101RR is offline
Send a message via AIM to Marcus101RR Send a message via Skype™ to Marcus101RR
JackieChan
AlliedModders Donor
Join Date: Nov 2009
Old 09-09-2013 , 22:32   Re: [L4D2] Help! How to execute my code when a zombie is entering ghost mode
Reply With Quote #7

Quote:
Originally Posted by super_leaf View Post
PHP Code:
SetConVarInt(FindConVar("z_jockey_limit"),0,true);
SetConVarInt(FindConVar("z_charger_limit"),0,true);
SetConVarInt(FindConVar("z_hunter_limit"),0,true);
SetConVarInt(FindConVar("z_spitter_limit"),0,true);
SetConVarInt(FindConVar("z_smoker_limit"),0,true);
SetConVarInt(FindConVar("z_boomer_limit"),99,true); 
I have already set all convars to maximize boomers, but as I said, these convars are only for BOTS Player, if you are playing as a human player and join infected, you are still able to spawn as a charger, smoker or other infected. I have tested this out and I can still spawn as a charger or hunter. Inform me if I have any mistake in the code, or write a code for me thanks.
Those are the wrong convars by the way.

z_versus_boomer_limit
z_versus_charger_limit
z_versus_hunter_limit
z_versus_jockey_limit
z_versus_smoker_limit
z_versus_spitter_limit

Those will do what you want.
__________________

Last edited by JackieChan; 09-09-2013 at 22:33.
JackieChan is offline
super_leaf
Junior Member
Join Date: Oct 2012
Old 09-10-2013 , 04:47   Re: [L4D2] Help! How to execute my code when a zombie is entering ghost mode
Reply With Quote #8

Quote:
Originally Posted by JackieChan View Post
Those are the wrong convars by the way.

z_versus_boomer_limit
z_versus_charger_limit
z_versus_hunter_limit
z_versus_jockey_limit
z_versus_smoker_limit
z_versus_spitter_limit

Those will do what you want.
Thanks dude, how careless am I. I can still implement it using another way, but your method is the best and easiest way though, I tried to use ghost spawn time event to set up a timer then execute my function:
PHP Code:
HookEvent("ghost_spawn_time",event_ghost_spawn_time,EventHookMode_Post); 
PHP Code:
public event_ghost_spawn_time(Handle:event, const String:name[], bool:dontBroadcast)
{
    
    new 
client GetClientOfUserId(GetEventInt(event,"userid"));
    new 
Float:spawntime GetEventFloat(event,"spawntime");
    if (
IsClientConnected(client) && GetClientTeam(client)==)
    {
        
CreateTimer(spawntime+1.0,ChangeToBoomer,client); //Delay one second to ensure that player is in ghost mode
    
}

PHP Code:
public Action:ChangeToBoomer(Handle:timerany:client)
{
    if(
IsClientConnected(client) && GetClientTeam(client)==)
    {
        if(!
IsPlayerGhost(client)){PrintToServer("CTB triggered! But client is not a ghost!"); return;}
        new 
WeaponIndex;
        while ((
WeaponIndex GetPlayerWeaponSlot(client0)) != -1)
        {
            
RemovePlayerItem(clientWeaponIndex);
            
RemoveEdict(WeaponIndex);
        }

        
SDKCall(g_hSetClassclient2);
        
AcceptEntityInput(MakeCompatEntRef(GetEntProp(clientProp_Send"m_customAbility")), "Kill");
        
SetEntProp(clientProp_Send"m_customAbility"GetEntData(SDKCall(g_hCreateAbilityclient), g_oAbility));
        
SetEntProp(client,Prop_Send,"m_zombieClass",2);
    }


Anyway, Thanks Marcus101RR and JackieChan for telling me the mistake

Last edited by super_leaf; 09-10-2013 at 04:59.
super_leaf is offline
super_leaf
Junior Member
Join Date: Oct 2012
Old 09-10-2013 , 07:07   Re: [L4D2] Help! How to execute my code when a zombie is entering ghost mode
Reply With Quote #9

now I have another problem:
This is the server log:
Code:
ConVarRef z_hunter_limit doesn't point to an existing ConVar
ConVarRef z_smoker_limit doesn't point to an existing ConVar
super_leaf is offline
Marcus101RR
Veteran Member
Join Date: Aug 2009
Location: Tampa, FL
Old 09-10-2013 , 13:27   Re: [L4D2] Help! How to execute my code when a zombie is entering ghost mode
Reply With Quote #10

Quote:
Originally Posted by super_leaf View Post
now I have another problem:
This is the server log:
Code:
ConVarRef z_hunter_limit doesn't point to an existing ConVar
ConVarRef z_smoker_limit doesn't point to an existing ConVar
If you read this post your problem would have been fixed 5 posts ago:
https://forums.alliedmods.net/showpo...64&postcount=2

As for that, are you using l4d1 or l4d2? L4d1 uses Gas and Exploding rather than than boomer/smoker. Or you made a mistake in your code.
__________________
Marcus101RR is offline
Send a message via AIM to Marcus101RR Send a message via Skype™ to Marcus101RR
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 20:26.


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