Raised This Month: $32 Target: $400
 8% 

Solved Got Some Tag Mismatches


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 01-11-2018 , 02:29   Got Some Tag Mismatches
Reply With Quote #1

Hey guys, I need help again.

PHP Code:
void vSpecialInfectedSpawner(float pos[3])
{
    
int iBot CreateFakeClient("Punisher");
    if (
iBot 0)
    {
        
bool bIsPlayerSI[MAXPLAYERS 1];
        
ChangeClientTeam(iBot3);
        for (
int iPlayer 1iPlayer <= MaxClientsiPlayer++)
        {
            
bIsPlayerSI[iPlayer] = false;
            if (
bIsInfected(iPlayer))
                
bIsPlayerSI[iPlayer] = true;
        }

        
GetCmdArg(1sInfectedNamesizeof(sInfectedName));
        
Format(sInfectedNamesizeof(sInfectedName), ",%s,"sInfectedName);
        
GetConVarString(hPunishInfectedTypessInfectedTypessizeof(sInfectedTypes));
        if (
strcmp(sInfectedTypes""))
        {
            
Format(sInfectedTypessizeof(sInfectedTypes), ",%s,"sInfectedTypes);
            if (
StrContains(sInfectedTypessInfectedNamefalse) != -1)
                return 
false;
        }

        if (
iL4D2Version)
            
vSpawnCommand(iBot"z_spawn_old"sInfectedName);
        else
            
vSpawnCommand(iBot"z_spawn"sInfectedName);
        
int iSelectedType 0;
        for (
int iPlayer 1iPlayer <= MaxClientsiPlayer++)
        {
            if (
bIsInfected(iPlayer))
            {
                if (!
bIsPlayerSI[iPlayer])
                {
                    
iSelectedType iPlayer;
                    break;
                }
            }
        }

        if (
iSelectedType 0)
            
TeleportEntity(iSelectedTypeposNULL_VECTORNULL_VECTOR);
        
tKickBot(nulliBot);
    }

    return 
true;

The mismatches are the lines with return true; and return false;. I don't know what to replace them with. :/

I'm basically trying (again) to set up a cvar that allows users to input the name of a special infected and the z_spawn command will use that name as the 1st argument. Ex. z_spawn hunter

I got it somewhat working but all it kept spawning was 1 common zombie, which basically means that the command isn't properly retrieving the name I input in the cvar.

PHP Code:
// Which special infected should the Punishment system send after speedrunners?
// (Empty: None, may spawn 1 common zombie.)
// (Not empty: Spawn the following special infected, separated by commas with no spaces.)
// -
// Default: "hunter"
asspunish_infectedtypes "hunter" 
__________________

Last edited by Psyk0tik; 05-08-2018 at 02:30. Reason: Marked as [Solved]
Psyk0tik is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 01-11-2018 , 02:36   Re: Got Some Tag Mismatches
Reply With Quote #2

void vSpecialInfectedSpawner(float pos[3])

Change to

bool vSpecialInfectedSpawner(float pos[3])
__________________
8guawong is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 01-11-2018 , 06:51   Re: Got Some Tag Mismatches
Reply With Quote #3

Quote:
Originally Posted by 8guawong View Post
void vSpecialInfectedSpawner(float pos[3])

Change to

bool vSpecialInfectedSpawner(float pos[3])
If you don't want to return anything leave

void vSpecialInfectedSpawner(float pos[3])

and change your returns from

return true/false

to

return;
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 01-11-2018 , 07:38   Re: Got Some Tag Mismatches
Reply With Quote #4

I tried both of your methods and they both compile, though the command still isn't retrieving the special infected's name from the cvar. Am I doing something wrong?
__________________
Psyk0tik is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 01-11-2018 , 07:53   Re: Got Some Tag Mismatches
Reply With Quote #5

Quote:
Originally Posted by Crasher_3637 View Post
I tried both of your methods and they both compile, though the command still isn't retrieving the special infected's name from the cvar. Am I doing something wrong?
i only answered the question that was stated in the topic
__________________
8guawong is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 01-11-2018 , 08:10   Re: Got Some Tag Mismatches
Reply With Quote #6

Quote:
Originally Posted by 8guawong View Post
i only answered the question that was stated in the topic
*Purposefully changes the title*

Thanks btw
__________________
Psyk0tik is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 01-11-2018 , 09:17   Re: Got Some Tag Mismatches
Reply With Quote #7

checking empty strings i usually do
'\0'

if (strcmp(sInfectedTypes, ""))

to

if (sInfectedTypes[0] == '\0' )

other end of string checks

\0
EOS
0
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 05-08-2018 , 02:29   Re: Got Some Tag Mismatches
Reply With Quote #8

Update on this thread:

I finally figured it out.

PHP Code:
// Which special infected should the Chase system send after speedrunners?
// (Empty: None, may spawn 1 common infected.)
// (Not empty: Spawn the special infected with that name.)
// -
// Default: "hunter"
asschase_infectedtype "hunter" 
PHP Code:
void vSpecialInfectedSpawner(float pos[3])
{
    
char sInfectedName[32];
    
char sInfectedType[32];
    
int iBot CreateFakeClient("Chaser");
    if (
iBot 0)
    {
        
bool bIsPlayerSI[MAXPLAYERS 1];
        
ChangeClientTeam(iBot3);
        for (
int iPlayer 1iPlayer <= MaxClientsiPlayer++)
        {
            
bIsPlayerSI[iPlayer] = false;
            if (
bIsInfected(iPlayer))
            {
                
bIsPlayerSI[iPlayer] = true;
            }
        }

        
g_cvASSChaseInfected.GetString(sInfectedTypesizeof(sInfectedType));
        
Format(sInfectedTypesizeof(sInfectedType), "%s"sInfectedType);
        if (
strcmp(sInfectedTypes""))
        {
            
sInfectedName sInfectedType;
        }

        if (
bIsL4D2Game())
        {
            
vSpawnCommand(iBot"z_spawn_old"sInfectedName);
        }

        else
        {
            
vSpawnCommand(iBot"z_spawn"sInfectedName);
        }

        
int iSelectedType 0;
        for (
int iPlayer 1iPlayer <= MaxClientsiPlayer++)
        {
            if (
bIsInfected(iPlayer))
            {
                if (!
bIsPlayerSI[iPlayer])
                {
                    
iSelectedType iPlayer;
                    break;
                }
            }
        }

        if (
iSelectedType 0)
        {
            
TeleportEntity(iSelectedTypeposNULL_VECTORNULL_VECTOR);
        }

        
tTimerKickBot(nulliBot);
    }

__________________

Last edited by Psyk0tik; 05-08-2018 at 02:29.
Psyk0tik is offline
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:24.


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