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

compile error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ace67
Senior Member
Join Date: Sep 2020
Location: France
Old 03-17-2023 , 16:36   compile error
Reply With Quote #1

PHP Code:
#include < amxmodx >

new const g_RoundEndDelay 1.0// Delay before moving dead players to T team

public Round_End()
{
  new 
num_alive_t 0;
  new 
num_alive_ct 0;

  
// Count the number of alive players on each team
  
for(new 1<= maxplayersi++)
  {
    if(!
is_user_connected(i))
      continue;

    if(
get_user_team(i) == 1// Terrorist
    
{
      if(
is_user_alive(i))
        
num_alive_t++;
    }
    else if(
get_user_team(i) == 2// Counter-Terrorist
    
{
      if(
is_user_alive(i))
        
num_alive_ct++;
    }
  }

  if(
num_alive_ct == && num_alive_t 0)
  {
    new 
delay g_RoundEndDelay;

    
// Move dead players from Counter-Terrorist to Terrorist team
    
for(new 1<= maxplayersi++)
    {
      if(!
is_user_connected(i))
        continue;

      if(
get_user_team(i) == && !is_user_alive(i))
      {
        
client_print(iprint_chat"You have been moved to the Terrorist team for the last round.");
        
set_user_team(i10);
        
set_user_alive(i1);
        
delay += 0.5;
      }
    }

    
// Inform all players that the last round will be played with T vs Zombies
    
new message[128];
    
format(messagesizeof(message), "Last round will be played with %d Terrorist vs. Zombies."num_alive_t);
    
center_msg(message);

    
set_task(delay"endround"); // End the round after the delay
    
return PLUGIN_HANDLED;
  }

  return 
PLUGIN_CONTINUE;

//// lastround.sma
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\czero\addons\amxmodx\scripting\lastround .sma(3) : warning 213: tag mismatch
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\czero\addons\amxmodx\scripting\lastround .sma(11) : error 017: undefined symbol "maxplayers"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\czero\addons\amxmodx\scripting\lastround .sma(33) : error 017: undefined symbol "maxplayers"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\czero\addons\amxmodx\scripting\lastround .sma(41) : error 017: undefined symbol "set_user_team"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\czero\addons\amxmodx\scripting\lastround .sma(42) : error 017: undefined symbol "set_user_alive"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\czero\addons\amxmodx\scripting\lastround .sma(50) : error 017: undefined symbol "center_msg"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\czero\addons\amxmodx\scripting\lastround .sma(52) : warning 213: tag mismatch
//
__________________
CS:CZ > CS 1.6
Ace67 is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 03-18-2023 , 00:13   Re: compile error
Reply With Quote #2

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

#define maxplayers MaxClients

new const g_RoundEndDelay 1.0// Delay before moving dead players to T team

public Round_End()
{
  new 
num_alive_t 0;
  new 
num_alive_ct 0;

  
// Count the number of alive players on each team
  
for(new 1<= maxplayersi++)
  {
    if(!
is_user_connected(i))
      continue;

    if(
get_user_team(i) == 1// Terrorist
    
{
      if(
is_user_alive(i))
        
num_alive_t++;
    }
    else if(
get_user_team(i) == 2// Counter-Terrorist
    
{
      if(
is_user_alive(i))
        
num_alive_ct++;
    }
  }

  if(
num_alive_ct == && num_alive_t 0)
  {
    new 
delay g_RoundEndDelay;

    
// Move dead players from Counter-Terrorist to Terrorist team
    
for(new 1<= maxplayersi++)
    {
      if(!
is_user_connected(i))
        continue;

      if(
get_user_team(i) == && !is_user_alive(i))
      {
        
client_print(iprint_chat"You have been moved to the Terrorist team for the last round.");
        
cs_set_user_team(i10);
        
spawn(i// fun.inc # set_user_alive(i, 1);
        
delay += 0.5;
      }
    }

    
// Inform all players that the last round will be played with T vs Zombies
    
new message[128];
    
format(messagesizeof(message), "Last round will be played with %d Terrorist vs. Zombies."num_alive_t);
    
client_print(0print_center"%s"message// center_msg(message);

    
set_task(delay"endround"); // End the round after the delay
    
return PLUGIN_HANDLED;
  }

  return 
PLUGIN_CONTINUE;

__________________
bigdaddy424 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-18-2023 , 00:41   Re: compile error
Reply With Quote #3

Quote:
Originally Posted by bigdaddy424 View Post
PHP Code:
#include < amxmodx >
#include < cstrike >
#include < fun >

#define maxplayers MaxClients

new const g_RoundEndDelay 1.0// Delay before moving dead players to T team

public Round_End()
{
  new 
num_alive_t 0;

... 
This forum is for learning so it is much more beneficial to the users if you explain what you changed and why. Also, you still have the tag mismatch.

Quote:
Originally Posted by Ace67 View Post
C:\Program Files (x86)\Steam\steamapps\common\Half-Life\czero\addons\amxmodx\scripting\lastround .sma(3) : warning 213: tag mismatch
C:\Program Files (x86)\Steam\steamapps\common\Half-Life\czero\addons\amxmodx\scripting\lastround .sma(52) : warning 213: tag mismatch
This because you're trying to assign a floating point value to an integer variable. To create a floating-point variable, you prepend the variable with the "Float" tag like this:

PHP Code:
new Float:myFloatingPointVariable 2.0 
So, in your case, you need to do this for both the g_RoundEndDelay and the delay variables.
__________________
fysiks is offline
Ace67
Senior Member
Join Date: Sep 2020
Location: France
Old 03-18-2023 , 04:35   Re: compile error
Reply With Quote #4

Quote:
Originally Posted by bigdaddy424 View Post
PHP Code:
#include < amxmodx >
#include < cstrike >
#include < fun >

#define maxplayers MaxClients

new const g_RoundEndDelay 1.0// Delay before moving dead players to T team

public Round_End()
{
  new 
num_alive_t 0;
  new 
num_alive_ct 0;

  
// Count the number of alive players on each team
  
for(new 1<= maxplayersi++)
  {
    if(!
is_user_connected(i))
      continue;

    if(
get_user_team(i) == 1// Terrorist
    
{
      if(
is_user_alive(i))
        
num_alive_t++;
    }
    else if(
get_user_team(i) == 2// Counter-Terrorist
    
{
      if(
is_user_alive(i))
        
num_alive_ct++;
    }
  }

  if(
num_alive_ct == && num_alive_t 0)
  {
    new 
delay g_RoundEndDelay;

    
// Move dead players from Counter-Terrorist to Terrorist team
    
for(new 1<= maxplayersi++)
    {
      if(!
is_user_connected(i))
        continue;

      if(
get_user_team(i) == && !is_user_alive(i))
      {
        
client_print(iprint_chat"You have been moved to the Terrorist team for the last round.");
        
cs_set_user_team(i10);
        
spawn(i// fun.inc # set_user_alive(i, 1);
        
delay += 0.5;
      }
    }

    
// Inform all players that the last round will be played with T vs Zombies
    
new message[128];
    
format(messagesizeof(message), "Last round will be played with %d Terrorist vs. Zombies."num_alive_t);
    
client_print(0print_center"%s"message// center_msg(message);

    
set_task(delay"endround"); // End the round after the delay
    
return PLUGIN_HANDLED;
  }

  return 
PLUGIN_CONTINUE;

//// lastround.sma
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\czero\addons\amxmodx\scripting\lastround .sma(7) : warning 213: tag mismatch
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\czero\addons\amxmodx\scripting\lastround .sma(15) : error 017: undefined symbol "MaxClients"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\czero\addons\amxmodx\scripting\lastround .sma(37) : error 017: undefined symbol "MaxClients"
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\czero\addons\amxmodx\scripting\lastround .sma(56) : warning 213: tag mismatch
__________________
CS:CZ > CS 1.6
Ace67 is offline
Ace67
Senior Member
Join Date: Sep 2020
Location: France
Old 03-18-2023 , 14:47   Re: compile error
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
This forum is for learning so it is much more beneficial to the users if you explain what you changed and why. Also, you still have the tag mismatch.



This because you're trying to assign a floating point value to an integer variable. To create a floating-point variable, you prepend the variable with the "Float" tag like this:

PHP Code:
new Float:myFloatingPointVariable 2.0 
So, in your case, you need to do this for both the g_RoundEndDelay and the delay variables.
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>

#define MAX_PLAYERS 32

new const Float:g_RoundEndDelay 1.0;

public 
Round_End()
{
    new 
num_alive_t 0;
    new 
num_alive_ct 0;

    
// Count the number of alive players on each team
    
for(new 1<= MAX_PLAYERSi++)
    {
        if(!
is_user_connected(i))
            continue;

        if(
get_user_team(i) == 1// Terrorist
        
{
            if(
is_user_alive(i))
                
num_alive_t++;
        }
        else if(
get_user_team(i) == 2// Counter-Terrorist
        
{
            if(
is_user_alive(i))
                
num_alive_ct++;
        }
    }

    if(
num_alive_ct == && num_alive_t 0)
    {
        new 
delay g_RoundEndDelay;

        
// Move dead players from Counter-Terrorist to Terrorist team
        
for(new 1<= MAX_PLAYERSi++)
        {
            if(!
is_user_connected(i))
                continue;

            if(
get_user_team(i) == && !is_user_alive(i))
            {
                
client_print(iprint_chat"You have been moved to the Terrorist team for the last round.");
                
cs_set_user_team(i10);
                
spawn(i); // fun.inc # set_user_alive(i, 1);
                
delay += 0.5;
            }
        }

        
// Inform all players that the last round will be played with T vs Zombies
        
new message[128];
        
format(messagesizeof(message), "Last round will be played with %d Terrorist vs. Zombies."num_alive_t);
        
client_print(0print_center"%s"message); // center_msg(message);

        
set_task(delay"endround"); // End the round after the delay
        
return PLUGIN_HANDLED;
    }

    return 
PLUGIN_CONTINUE;

I fixed the Maxclient/players, But im still getting one errors //// lastround.sma
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\czero\addons\amxmodx\scripting\lastround .sma(34) : warning 213: tag mismatch
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\czero\addons\amxmodx\scripting\lastround .sma(56) : warning 213: tag mismatch
__________________
CS:CZ > CS 1.6

Last edited by Ace67; 03-18-2023 at 14:48.
Ace67 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-18-2023 , 16:24   Re: compile error
Reply With Quote #6

You'll need to learn to look at the lines that are indicated by the warnings. In this case, lines 34 and 56. Line 34 is where you create the variable named "delay". Notice that you are trying to assign it the value of the "g_RoundEndDelay" variable. Notice that these two variables do not have the same tag (hence the tag mismatch). On line 56, the mismatch is because the first argument of set_task() requires a floating-point value but you're passing it the "delay" variable which was not created as a floating-point variable (because it doesn't have the Float tag).

So, both of these warnings are caused by one thing, the fact that the "delay" variable is not a floating-point variable. You need to add the Float tag to "delay".
__________________
fysiks is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 03-18-2023 , 16:33   Re: compile error
Reply With Quote #7

basically what fysiks says you replace line 34 with this new Float: delay = g_RoundEndDelay;
__________________
bigdaddy424 is offline
Ace67
Senior Member
Join Date: Sep 2020
Location: France
Old 03-18-2023 , 16:46   Re: compile error
Reply With Quote #8

Quote:
Originally Posted by bigdaddy424 View Post
basically what fysiks says you replace line 34 with this new Float: delay = g_RoundEndDelay;
//// lastround.sma
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\czero\addons\amxmodx\scripting\lastround .sma(37) : warning 217: loose indentation

PHP Code:
        for(new 1<= MAX_PLAYERSi++) 
__________________
CS:CZ > CS 1.6
Ace67 is offline
bigdaddy424
Senior Member
Join Date: Oct 2021
Location: Jupiter
Old 03-18-2023 , 16:52   Re: compile error
Reply With Quote #9

avoid that, spaces mixed up with tabs on indentation
__________________
bigdaddy424 is offline
Ace67
Senior Member
Join Date: Sep 2020
Location: France
Old 03-18-2023 , 17:02   Re: compile error
Reply With Quote #10

Quote:
Originally Posted by bigdaddy424 View Post
avoid that, spaces mixed up with tabs on indentation
Still getting it
__________________
CS:CZ > CS 1.6
Ace67 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 18:33.


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