Urguent Help
#1

Hello, I've tried making a command to make the admin with level 99999 above can do /addupdate with 3 different types [Implemented], [BugFix], [Pending GMX], whatever I got much errors and I don't understand what to do with them, PS:I tried to make it with MySQL but i found that it's kinda impossible because I still didn't learn anything about saving/loading from MySQL, Although I need someone to help me making a cmd that removes an update.

Enums :
Код:
enum updateinfo
{
	updatetype,
	updateimplemented,
	updatebug,
	updatepending,
	updatetext,
};
new UpdateInfo[MAX_UPDATES][updateinfo];
Commands :
Код:
CMD:addupdate(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 99999)
	{
		if(sscanf(params, "s[50]d", updatetext, updatetype)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /addupdate [text] [Update Type]");
		{
		SendClientMessageEx(playerid, COLOR_GREY, "Available Types: 1 = Implemented, 2= Bug Fix, 3= Pending GMX");
		}
	for(new i = 0; i < MAX_UPDATES; i++)
	if(updatetype == 1)
	{
		UpdateInfo[i][updatetype] = UpdateInfo[i][updateimplemented];
		SendClientMessageToAll(COLOR_RED, "A new update was added!(/updates)");
		return 1;
	}
	if(updatetype == 2)
	{
		UpdateInfo[i][updatetype] = UpdateInfo[i][updatebug];
		SendClientMessageToAll(COLOR_RED, "A new update was added!(/updates)");
		return 1;
	}
	if(updatetype == 3)
	{
		UpdateInfo[i][updatetype] = UpdateInfo[i][updatepending];
		SendClientMessageToAll(COLOR_RED, "A new update was added!(/updates)");
		return 1;
	}
	else if(PlayerInfo[playerid][pAdmin] < 99999)
	{
		SendClientMessageToAll(COLOR_GREY, "ERROR: You are not authorized to use this command!");
	}
	}
	return 1;
}
CMD:updates(playerid, params[])
{
	new string[128]; new string2[50];
	for(new i = 0; i < MAX_UPDATES; i++)
	SendClientMessageEx(playerid, COLOR_RED, "********* Nyakos City Roleplay Updates ************");
	format(string, sizeof(string), "Version: %s", SERVER_GM_TEXT);
	SendClientMessageEx(playerid, COLOR_YELLOW, string);
	if(UpdateInfo[i][updatetype] = UpdateInfo[i][updateimplemented])
	{
	format(string2, sizeof(string2), "[Implemented] %s", updatetext);
	SendClientMessageEx(playerid, COLOR_WHITE, string2);
	return 1;
	}
	if(UpdateInfo[i][updatetype] = UpdateInfo[i][updatebug])
	{
	format(string2, sizeof(string2), "[Bug Fix] %s", updatetext);
	SendClientMessageEx(playerid, COLOR_WHITE, string2);
	return 1;
	}
	if(UpdateInfo[i][updatetype] = UpdateInfo[i][updatepending])
	{
	format(string2, sizeof(string2), "[Pending GMX] %s", updatetext);
	SendClientMessage(playerid, COLOR_WHITE, string2);
	return 1;
	}
	SendClientMessageEx(playerid, COLOR_RED, "___________________________________________________");
}
Errors :
Quote:

F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61825) : warning 216: nested comment
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61840) : warning 217: loose indentation
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61841) : warning 213: tag mismatch
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61841) : warning 205: redundant code: constant expression is zero
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61847) : warning 213: tag mismatch
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61847) : warning 205: redundant code: constant expression is zero
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61849) : error 017: undefined symbol "i"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61853) : warning 213: tag mismatch
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61853) : warning 205: redundant code: constant expression is zero
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61855) : error 017: undefined symbol "i"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61873) : error 017: undefined symbol "i"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61879) : error 017: undefined symbol "i"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61885) : error 017: undefined symbol "i"
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61892) : warning 209: function "cmd_updates" should return a value

Any Quick help?
Reply
#2

Anyone?
Reply
#3

What line is the error at?

Try this

Код:
CMD:addupdate(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 99999)
	{
		if(sscanf(params, "s[50]d", updatetext, updatetype)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /addupdate [text] [Update Type]");
		{
		SendClientMessageEx(playerid, COLOR_GREY, "Available Types: 1 = Implemented, 2= Bug Fix, 3= Pending GMX");
		}
		for(new i = 0; i < MAX_UPDATES; i++)
		{
			if(updatetype == 1)
			{
				UpdateInfo[i][updatetype] = UpdateInfo[i][updateimplemented];
				SendClientMessageToAll(COLOR_RED, "A new update was added!(/updates)");
				return 1;
			}
			if(updatetype == 2)
			{
				UpdateInfo[i][updatetype] = UpdateInfo[i][updatebug];
				SendClientMessageToAll(COLOR_RED, "A new update was added!(/updates)");
				return 1;
			}
			if(updatetype == 3)
			{
				UpdateInfo[i][updatetype] = UpdateInfo[i][updatepending];
				SendClientMessageToAll(COLOR_RED, "A new update was added!(/updates)");
				return 1;
			}
			else if(PlayerInfo[playerid][pAdmin] < 99999)
			{
				SendClientMessageToAll(COLOR_GREY, "ERROR: You are not authorized to use this command!");
			}
		}
	}
	return 1;
}
CMD:updates(playerid, params[])
{
	new string[128]; new string2[50];
	for(new i = 0; i < MAX_UPDATES; i++)
	{
		SendClientMessageEx(playerid, COLOR_RED, "********* Nyakos City Roleplay Updates ************");
		format(string, sizeof(string), "Version: %s", SERVER_GM_TEXT);
		SendClientMessageEx(playerid, COLOR_YELLOW, string);
		if(UpdateInfo[i][updatetype] = UpdateInfo[i][updateimplemented])
		{
		format(string2, sizeof(string2), "[Implemented] %s", updatetext);
		SendClientMessageEx(playerid, COLOR_WHITE, string2);
		return 1;
		}
		if(UpdateInfo[i][updatetype] = UpdateInfo[i][updatebug])
		{
		format(string2, sizeof(string2), "[Bug Fix] %s", updatetext);
		SendClientMessageEx(playerid, COLOR_WHITE, string2);
		return 1;
		}
		if(UpdateInfo[i][updatetype] = UpdateInfo[i][updatepending])
		{
		format(string2, sizeof(string2), "[Pending GMX] %s", updatetext);
		SendClientMessage(playerid, COLOR_WHITE, string2);
		return 1;
		}
		SendClientMessageEx(playerid, COLOR_RED, "___________________________________________________");
	}
}
Reply
#4

Now it compiled without errors, But that what i get when i try to start the server.

[22:14:41] Error: Function not registered: 'SSCANF_IsConnected'
[22:14:41] [debug] Run time error 19: "File or function is not found"
[22:14:41] [debug] SSCANF_IsConnected
[22:14:41] [debug] Run time error 19: "File or function is not found"
[22:14:41] [debug] SSCANF_IsConnected
[22:14:41] Script[gamemodes/oggrp26.amx]: Run time error 19: "File or function is not found"
[22:14:41] Number of vehicle models: 0
[22:14:41] [debug] Run time error 19: "File or function is not found"
[22:14:41] [debug] SSCANF_IsConnected
[22:14:41] [debug] Run time error 19: "File or function is not found"
[22:14:41] [debug] SSCANF_IsConnected
[22:14:41] [debug] Run time error 19: "File or function is not found"
[22:14:41] [debug] SSCANF_IsConnected
[22:14:41] [debug] Run time error 19: "File or function is not found"
[22:14:41] [debug] SSCANF_IsConnected
Reply
#5

Anyone? Quickly please.
Reply
#6

24 hour bumps only.

You should also highlight WHICH LINES ARE WHAT from the errors... Otherwise all you'll get are guessers like above who simply paste up code trying to suppress the errors, and don't even look through it.
Reply
#7

Alright, now I will send the full code related to the cmd and the warnings/errors and the lines with errors/warnings..
Warnings+1 error :
Quote:

F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61841) : warning 213: tag mismatch
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61841) : warning 205: redundant code: constant expression is zero
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61847) : warning 213: tag mismatch
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61847) : warning 205: redundant code: constant expression is zero
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61853) : warning 213: tag mismatch
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61853) : warning 205: redundant code: constant expression is zero
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61875) : warning 211: possibly unintended assignment
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61881) : warning 211: possibly unintended assignment
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(61887) : warning 211: possibly unintended assignment
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(142983) : warning 211: possibly unintended assignment
F:\SA-MP server\credit goes to mason\ogg\gamemodes\oggrp26.pwn(142983) : error 036: empty statement

enums
Код:
enum updateinfo
{
	updatetype,
	updateimplemented,
	updatebug,
	updatepending,
	updatetext,
};
new UpdateInfo[MAX_UPDATES][updateinfo];
cmds
Код:
CMD:addupdate(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 99999)
	{
		if(sscanf(params, "s[50]d", updatetext, updatetype)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /addupdate [text] [Update Type]");
		{
		SendClientMessageEx(playerid, COLOR_GREY, "Available Types: 1 = Implemented, 2= Bug Fix, 3= Pending GMX");
		}
		for(new i = 0; i < MAX_UPDATES; i++)
		{
			if(updatetype == 1)//LINE 61841
			{
				UpdateInfo[i][updatetype] = UpdateInfo[i][updateimplemented];
				SendClientMessageToAll(COLOR_RED, "A new update was added!(/updates)");
				return 1;
			}
			if(updatetype == 2)//LINE 61847
			{
				UpdateInfo[i][updatetype] = UpdateInfo[i][updatebug];
				SendClientMessageToAll(COLOR_RED, "A new update was added!(/updates)");
				return 1;
			}
			if(updatetype == 3)//LINE 61853
			{
				UpdateInfo[i][updatetype] = UpdateInfo[i][updatepending];
				SendClientMessageToAll(COLOR_RED, "A new update was added!(/updates)");
				return 1;
			}
			else if(PlayerInfo[playerid][pAdmin] < 99999)
			{
				SendClientMessageToAll(COLOR_GREY, "ERROR: You are not authorized to use this command!");
			}
		}
	}
	return 1;
}
CMD:updates(playerid, params[])
{
	new string[128]; new string2[50];
	for(new i = 0; i < MAX_UPDATES; i++)
	{
		SendClientMessageEx(playerid, COLOR_RED, "********* Nyakos City Roleplay Updates ************");
		format(string, sizeof(string), "Version: %s", SERVER_GM_TEXT);
		SendClientMessageEx(playerid, COLOR_YELLOW, string);
		if(UpdateInfo[i][updatetype] = UpdateInfo[i][updateimplemented])//LINE 61875
		{
		format(string2, sizeof(string2), "{#00b300][Implemented]{#00b300} %s", updatetext);
		SendClientMessageEx(playerid, COLOR_WHITE, string2);
		return 1;
		}
		if(UpdateInfo[i][updatetype] = UpdateInfo[i][updatebug])//LINE 61881
		{
		format(string2, sizeof(string2), "{#ff0000}[Bug Fix]{#ff0000} %s", updatetext);
		SendClientMessageEx(playerid, COLOR_WHITE, string2);
		return 1;
		}
		if(UpdateInfo[i][updatetype] = UpdateInfo[i][updatepending])//61887
		{
		format(string2, sizeof(string2), "{#ff3300}[Pending GMX]{#ff3300} %s", updatetext);
		SendClientMessage(playerid, COLOR_WHITE, string2);
		return 1;
		}
		SendClientMessageEx(playerid, COLOR_RED, "___________________________________________________");
	}
	return 1;
}
Under OnGameModeInIt I've added this to change the type of "Pending GMX" to "Implemented" after a GMX.
Код:
	for(new u; u != MAX_UPDATES; u++)
	{
		if(UpdateInfo[u][updatetype] = UpdateInfo[u][updatepending]);//LINE 142983
		{
			 return UpdateInfo[u][updatetype] == UpdateInfo[u][updateimplemented];
		}
	}
I hope someone will respond quickly.
Reply
#8

Код:
warning 211: possibly unintended assignment
relates to you using =, when you should be using ==.

Even 142983 is the same... using = when you should be using ==.


Also, further to this, is the way you're using an enum which has an entry titled updatetype, whilst making a local variable that has the same name... This will cause confusion, and could be related to your primary issue.
Reply
#9

So should i remove updatetype and make the updateimplemented = 1 etc?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)