AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Compile error (https://forums.alliedmods.net/showthread.php?t=323077)

mrspeak 04-11-2020 17:50

Compile error
 
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;
}


fysiks 04-11-2020 18:17

Re: Compile error
 
get_mapname() doesn't return anything. Also, you can't compare two strings with ==, you must use equal() or equali().

mrspeak 04-11-2020 18:24

Re: Compile error
 
Quote:

Originally Posted by fysiks (Post 2692609)
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 "="

Bugsy 04-11-2020 19:41

Re: Compile error
 
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'.

mrspeak 04-11-2020 20:13

Re: Compile error
 
Quote:

Originally Posted by Bugsy (Post 2692624)
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


All times are GMT -4. The time now is 09:45.

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