Raised This Month: $ Target: $400
 0% 

Solved Compile error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mrspeak
Junior Member
Join Date: Apr 2020
Old 04-11-2020 , 18:50   Compile error
Reply With Quote #1

I'm NOT such of an expert but i want to make a plugin where if it's 00:00 o'clock admins can't use amx_map with a print in the console and also if it's 00:00 o'clock and another map except de_dust2 to change it automatically that untill 07:00 o'clock.
And i'm stuck with the following errors:
Code:
mapblocker.sma(11) : error 020: invalid symbol name ""
mapblocker.sma(32) : error 033: array must be indexed (variable "mapname1")
mapblocker.sma(35) : error 001: expected token: "-identifier-", but found "="
mapblocker.sma(35) : error 029: invalid expression, assumed zero
mapblocker.sma(35) : warning 215: expression has no effect
mapblocker.sma(47) : error 001: expected token: "-identifier-", but found "="
mapblocker.sma(47) : error 029: invalid expression, assumed zero
mapblocker.sma(47) : warning 215: expression has no effect
mapblocker.sma(54) : error 029: invalid expression, assumed zero
mapblocker.sma(61) : warning 203: symbol is never used: ""
here is the .sma:
Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN ""
#define VERSION ""
#define AUTHOR ""

new mapname1[] = "de_dust2";

new state = 0,
	start,
	stop,
	minutes,
	h,
	m,
	mapname[64];

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	register_concmd("amx_map", "cmdMapDenied", ADMIN_MAP, "<map>")
	start = register_cvar( "start_map", "00" );
	stop = register_cvar( "end_map", "07" );
	minutes = register_cvar( "minutes_map", "00" );
	set_task(60.0,"HAIDA");
}

public HAIDA() {
	time( h, m, _ );
	if(h >= get_pcvar_num( start ) && h < get_pcvar_num( stop ))
	{    
		if(mapname1 == get_mapname(mapname,charsmax(mapname)))
		{
			server_cmd("amx_map de_dust2");
			state = 1;
		}
		if(h == get_pcvar_num( start ) && m == get_pcvar_num( minutes ))
		{
			log_amx("***** MAP CHANGE LOCKED *****");
		}
	}
	else if(h < get_pcvar_num( start ) || h >= get_pcvar_num( stop ))
	{
		if(h == get_pcvar_num( stop ) && m == get_pcvar_num( minutes ))
		{
			log_amx("***** MAP CHANGE UNLOCKED *****");
			state = 2;
		}
	}
}

public cmdMapDenied(id) {
	if (state != 1) {
		console_print(id, "***** MAP CHANGE LOCKED *****.");
		return PLUGIN_HANDLED;
	}
	return 1;
}

Last edited by mrspeak; 04-11-2020 at 21:14.
mrspeak is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-11-2020 , 19:17   Re: Compile error
Reply With Quote #2

get_mapname() doesn't return anything. Also, you can't compare two strings with ==, you must use equal() or equali().
__________________
fysiks is offline
mrspeak
Junior Member
Join Date: Apr 2020
Old 04-11-2020 , 19:24   Re: Compile error
Reply With Quote #3

Quote:
Originally Posted by fysiks View Post
get_mapname() doesn't return anything. Also, you can't compare two strings with ==, you must use equal() or equali().
Ok thanks, that's one done but what tf is this supposed to mean:
Code:
error 020: invalid symbol name ""
and for the
Code:
state = 1;
it says
Code:
error 001: expected token: "-identifier-", but found "="
mrspeak is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-11-2020 , 20:41   Re: Compile error
Reply With Quote #4

state is a reserved word which means it already has a purpose in the language syntax. Change that variable name to iState, or something. This would be similar to you trying to create a variable named 'new' or 'if'.
__________________
Bugsy is offline
mrspeak
Junior Member
Join Date: Apr 2020
Old 04-11-2020 , 21:13   Re: Compile error
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
state is a reserved word which means it already has a purpose in the language syntax. Change that variable name to iState, or something. This would be similar to you trying to create a variable named 'new' or 'if'.
Thanks ! I'm gonna kill myself for that mistake xD
mrspeak 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 15:55.


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