SA-MP Forums Archive
OnGameModeInit compile error - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnGameModeInit compile error (/showthread.php?tid=646200)



OnGameModeInit compile error - Butcher1 - 12.12.2017

Hello there, i am doing a small update for my sever and after doing some gamemode changes i ran on this bug when trying to compile it:

C:\Users\Administrator\Desktop\Versions\samp versions\LIVE\gamemodes\update.pwn(459) : warning 204: symbol is assigned a value that is never used: "enable"

Код:
public OnGameModeInit()
{

	SendRconCommand("password CHANGETHISFORSECURITYREASONS");
    MapAndreas_Init(MAP_ANDREAS_MODE_FULL);
	zones[0] = CreateDynamicCircle(zones_points_0[0], zones_points_0[1], zones_points_0[2]);
    SendRconCommand("mapname San Andreas");
	ServerTextdraw();
	CreateDynamic3DTextLabel("SPAWN FIX: {FFFFFF}PRESS LMB", COLOR_YELLOW, 1958.7336,1342.4657,15.3746,15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, 0, 0, -1);
    CreatePickup(1318,1,1554.9025,-1675.5051,16.1953);
    CreatePickup(1318,1,2332.9895,-1069.5872,11.6794);
    CreatePickup(1318,1,2337.0386,2459.0793,14.9742);
    CreatePickup(1318,1,1294.7452, -48.8186, 1492.7);
    CreateDynamic3DTextLabel("BLACK MARKET: {FFFFFF}/buyitem", COLOR_YELLOW,1159.0352,-2044.0530,69.0078,15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, 0, 0, -1);
	CreatePickup(1318,1,1159.0352,-2044.0530,69.0078);
	CreateDynamic3DTextLabel("VIP LOUNGE: {FFFFFF}PRESS N", COLOR_YELLOW, 1574.4783,-1339.9746,16.4844,15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, 0, 0, -1);
	CreateDynamic3DTextLabel("VIP LOUNGE: {FFFFFF}PRESS N", COLOR_YELLOW, 277.3174,1852.0159,994.2360,15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, 0, 0, -1);
	CreatePickup(1318,1,1574.4783,-1339.9746,16.4844);
	CreatePickup(1318,1,277.3174,1852.0159,994.2360);
    enable = true;   <<<<<<<<<<<<< ROW 459 where the ERROR shows


    mysql_log(LOG_ERROR|LOG_WARNING);
    db = mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password);
    if(mysql_errno(db))
    {
        print(">> Connection to database failed <\n>> Exiting GameMode");
        return SendRconCommand("exit");
    }
    print("@>>>>>>> CONNECTED SUCCESSFULLY!");
Note: I am still a beginner on this coding world so any help would be useful.


Re: OnGameModeInit compile error - jasperschellekens - 12.12.2017

Add this at top of your scripts near all your other variable defines.
Код:
new enable;



Re: OnGameModeInit compile error - RogueDrifter - 12.12.2017

Quote:
Originally Posted by Butcher1
Посмотреть сообщение
Hello there, i am doing a small update for my sever and after doing some gamemode changes i ran on this bug when trying to compile it:

C:\Users\Administrator\Desktop\Versions\samp versions\LIVE\gamemodes\update.pwn(459) : warning 204: symbol is assigned a value that is never used: "enable"

Код:
public OnGameModeInit()
{

	SendRconCommand("password CHANGETHISFORSECURITYREASONS");
    MapAndreas_Init(MAP_ANDREAS_MODE_FULL);
	zones[0] = CreateDynamicCircle(zones_points_0[0], zones_points_0[1], zones_points_0[2]);
    SendRconCommand("mapname San Andreas");
	ServerTextdraw();
	CreateDynamic3DTextLabel("SPAWN FIX: {FFFFFF}PRESS LMB", COLOR_YELLOW, 1958.7336,1342.4657,15.3746,15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, 0, 0, -1);
    CreatePickup(1318,1,1554.9025,-1675.5051,16.1953);
    CreatePickup(1318,1,2332.9895,-1069.5872,11.6794);
    CreatePickup(1318,1,2337.0386,2459.0793,14.9742);
    CreatePickup(1318,1,1294.7452, -48.8186, 1492.7);
    CreateDynamic3DTextLabel("BLACK MARKET: {FFFFFF}/buyitem", COLOR_YELLOW,1159.0352,-2044.0530,69.0078,15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, 0, 0, -1);
	CreatePickup(1318,1,1159.0352,-2044.0530,69.0078);
	CreateDynamic3DTextLabel("VIP LOUNGE: {FFFFFF}PRESS N", COLOR_YELLOW, 1574.4783,-1339.9746,16.4844,15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, 0, 0, -1);
	CreateDynamic3DTextLabel("VIP LOUNGE: {FFFFFF}PRESS N", COLOR_YELLOW, 277.3174,1852.0159,994.2360,15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, 0, 0, -1);
	CreatePickup(1318,1,1574.4783,-1339.9746,16.4844);
	CreatePickup(1318,1,277.3174,1852.0159,994.2360);
    enable = true;   <<<<<<<<<<<<< ROW 459 where the ERROR shows


    mysql_log(LOG_ERROR|LOG_WARNING);
    db = mysql_connect(mysql_host, mysql_user, mysql_database, mysql_password);
    if(mysql_errno(db))
    {
        print(">> Connection to database failed <\n>> Exiting GameMode");
        return SendRconCommand("exit");
    }
    print("@>>>>>>> CONNECTED SUCCESSFULLY!");
Note: I am still a beginner on this coding world so any help would be useful.
Well the compiler summed it up, it is never used, show the other parts where u use that enable variable if you aren't and it's pretty much just enable =true then remove that and remove the
PHP код:
new bool:enable



Re: OnGameModeInit compile error - rfr - 12.12.2017

this is a warning. you made it a variable instead of a bool

PHP код:
new bool:enable



Re: OnGameModeInit compile error - Butcher1 - 12.12.2017

I also got this on top of my script:

new bool:enable = true;


Re: OnGameModeInit compile error - rfr - 12.12.2017

Remove the = true; bit.

It should just be

new bool:enable;

after that you can do enable = true later in the script.


Re: OnGameModeInit compile error - Lucases - 12.12.2017

You created variable "enable" somewhere, after that you assigned true value to that variable and never used it.
You should use it somewhere to get rid of that warning


Re: OnGameModeInit compile error - Butcher1 - 12.12.2017

Alright so i was clearing some old useless cmd and i found that this was being used on this:

Код:
CMD:toggletphack(playerid, params[])
{
    if(enable == true)
    {
        enable = false;
        SCM(playerid, -1, "Disabled");
    }
    else
    {
        SCM(playerid, -1, "Enabled");
        enable = true;
    }
    return 1;
}
I removed it because i am not aware on what this does.
Should i remove all this part of the script or keep this lines, since i am not aware of what's the purpose of it!


Re: OnGameModeInit compile error - rfr - 12.12.2017

Quote:
Originally Posted by Butcher1
Посмотреть сообщение
Alright so i was clearing some old useless cmd and i found that this was being used on this:

Код:
CMD:toggletphack(playerid, params[])
{
    if(enable == true)
    {
        enable = false;
        SCM(playerid, -1, "Disabled");
    }
    else
    {
        SCM(playerid, -1, "Enabled");
        enable = true;
    }
    return 1;
}
I removed it because i am not aware on what this does.
Should i remove all this part of the script or keep this lines, since i am not aware of what's the purpose of it!
This command toggles 'tphack'.


Re: OnGameModeInit compile error - jasperschellekens - 12.12.2017

Quote:
Originally Posted by Butcher1
Посмотреть сообщение
Alright so i was clearing some old useless cmd and i found that this was being used on this:

Код:
CMD:toggletphack(playerid, params[])
{
    if(enable == true)
    {
        enable = false;
        SCM(playerid, -1, "Disabled");
    }
    else
    {
        SCM(playerid, -1, "Enabled");
        enable = true;
    }
    return 1;
}
I removed it because i am not aware on what this does.
Should i remove all this part of the script or keep this lines, since i am not aware of what's the purpose of it!
If you don't know what this command is used for you can probably delete it.