Raised This Month: $12 Target: $400
 3% 

Solved [L4D & L4D2] Need help with a tag mismatch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 12-15-2017 , 23:21   [L4D & L4D2] Need help with a tag mismatch
Reply With Quote #1

Hey guys, I need help with this:

PHP Code:
//Allows users to decide which special infected is spawned by a timer by inputting the name types in a cvar.
//Example: ass_punish_infected "jockey,charger,smoker,hunter,boomer,tank,witch,spitter"
bool SpecialType()
{
    
int bot CreateFakeClient("Monster");
    
GetConVarString(botInfectedNamesizeof(InfectedName));
    
Format(InfectedNamesizeof(InfectedName), ",%s,"InfectedName);
    
GetConVarString(ass_punish_infectedInfectedNamessizeof(InfectedNames));
    if(
strcmp(InfectedNames""))
    {
        
Format(InfectedNamessizeof(InfectedNames), ",%s,"InfectedNames);
        if(
StrContains(InfectedNamesInfectedNamefalse) == -1)
            return 
false;
    }

    return 
true;

This is what executes the bool SpecialType().

PHP Code:
void SpawnInfected(float pos[3])
{
    
int bot CreateFakeClient("Monster");
    if(
bot 0)
    {
        
ChangeClientTeam(bot3);
        
bool IsPlayerSI[MAXPLAYERS 1];
        for(
int i 1<= MaxClientsi++)
        {
            
IsPlayerSI[i] = false;
            if(
IsClientInGame(i) && IsPlayerAlive(i))
                if(
GetClientTeam(i) == 3)
                    
IsPlayerSI[i] = true;
        }

        
SpecialType();
        
SpawnCommand(bot"z_spawn"InfectedName);
        
int selected 0;
        for(
int i 1<= MaxClientsi++)
        {
            if(
IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 3)
            {
                if(!
IsPlayerSI[i])
                {
                    
selected i;
                    break;
                }
            }
        }

        if(
selected 0)
            
TeleportEntity(selectedposNULL_VECTORNULL_VECTOR);
        
Kickbot(INVALID_HANDLEbot);
    }

This line has a tag mismatch but I don't know what to replace it with:

PHP Code:
    GetConVarString(botInfectedNamesizeof(InfectedName)); 
__________________

Last edited by Psyk0tik; 12-16-2017 at 00:07. Reason: Marked as [Solved]
Psyk0tik is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 12-15-2017 , 23:25   Re: [L4D & L4D2] Need help with a tag mismatch
Reply With Quote #2

Also, could someone please show me how I could add a randomization feature so that the plugin picks 1 of the names inside the cvar to spawn. Otherwise, if I just leave it like that, the plugin would spawn all of those at once which to me is overkill.
__________________
Psyk0tik is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 12-15-2017 , 23:33   Re: [L4D & L4D2] Need help with a tag mismatch
Reply With Quote #3

Show us your declaration of InfectedName
__________________
Spirit_12 is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 12-15-2017 , 23:37   Re: [L4D & L4D2] Need help with a tag mismatch
Reply With Quote #4

Quote:
Originally Posted by Spirit_12 View Post
Show us your declaration of InfectedName
PHP Code:
char InfectedName[64], InfectedNames[64]; 
I strongly feel that the tag mismatch is the "bot" btw since it's not a cvar.
__________________

Last edited by Psyk0tik; 12-15-2017 at 23:46.
Psyk0tik is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 12-15-2017 , 23:53   Re: [L4D & L4D2] Need help with a tag mismatch
Reply With Quote #5

EDIT: Never mind about the randomization feature.

I fixed it by just doing this but now I need to figure out how to tell the plugin to randomly pick one of the names inside the cvar. As of now, it compiles but if I actually use the plugin, it would spawn all the infected names I specify in the cvar all at once.

PHP Code:
void SpawnInfected(float pos[3])
{
    
int bot CreateFakeClient("Monster");
    if(
bot 0)
    {
        
ChangeClientTeam(bot3);
        
bool IsPlayerSI[MAXPLAYERS 1];
        for(
int i 1<= MaxClientsi++)
        {
            
IsPlayerSI[i] = false;
            if(
IsClientInGame(i) && IsPlayerAlive(i))
                if(
GetClientTeam(i) == 3)
                    
IsPlayerSI[i] = true;
        }

        
Format(InfectedNamesizeof(InfectedName), ",%s,"InfectedName);
        
GetConVarString(ass_punish_infectedInfectedNamessizeof(InfectedNames));
        if(
strcmp(InfectedNames""))
        {
            
Format(InfectedNamessizeof(InfectedNames), ",%s,"InfectedNames);
            if(
StrContains(InfectedNamesInfectedNamefalse) == -1)
                return;
        }

        
SpawnCommand(bot"z_spawn"InfectedName);
        
int selected 0;
        for(
int i 1<= MaxClientsi++)
        {
            if(
IsClientInGame(i) && IsPlayerAlive(i) && GetClientTeam(i) == 3)
            {
                if(!
IsPlayerSI[i])
                {
                    
selected i;
                    break;
                }
            }
        }

        if(
selected 0)
            
TeleportEntity(selectedposNULL_VECTORNULL_VECTOR);
        
Kickbot(INVALID_HANDLEbot);
    }

EDIT: Never mind about the randomization feature.
__________________

Last edited by Psyk0tik; 12-16-2017 at 00:07.
Psyk0tik is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 12-16-2017 , 06:31   Re: [L4D & L4D2] Need help with a tag mismatch
Reply With Quote #6

Crasher, please bear with me since this is rushed. About the PM I sent you, don't do the second error I pointed out. I was supposed to send that info to the other user and got all tangled up while trying to dress my uniform properly.
cravenge is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 12-16-2017 , 09:17   Re: [L4D & L4D2] Need help with a tag mismatch
Reply With Quote #7

Quote:
Originally Posted by cravenge View Post
Crasher, please bear with me since this is rushed. About the PM I sent you, don't do the second error I pointed out. I was supposed to send that info to the other user and got all tangled up while trying to dress my uniform properly.
Thanks cravenge!
__________________
Psyk0tik is offline
aleeexxx
Member
Join Date: May 2014
Location: Valhalla
Old 12-17-2017 , 21:36   Re: [L4D & L4D2] Need help with a tag mismatch
Reply With Quote #8

well bro it's better if you look in the documentation, for fix the problem more quickly

http://www.sourcemod.net/new-api/con...etConVarString

but well I think is fixed now
__________________
aleeexxx is offline
Send a message via MSN to aleeexxx
Reply


Thread Tools
Display Modes

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 10:49.


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