4 warnings.
#1

as the Title: says guys


warning codes below.

Код:
(1573) : warning 219: local variable "s1" shadows a variable at a preceding level
(1574) : warning 219: local variable "s2" shadows a variable at a preceding level
(3632) : warning 219: local variable "int" shadows a variable at a preceding level
(4415) : warning 219: local variable "int" shadows a variable at a preceding level
the code making the warnings.
Код:
stock udb_hash(buf[])
{
    new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
       s1 = (s1 + buf[n]) % 65521;
       s2 = (s2 + s1)     % 65521;
    }
    return (s2 << 16) + s1;
}


CMD:gotox(playerid, params[])
{
	new Float:tpx, Float:tpy, Float:tpz, int;
	if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use this command.");
	if(AdminDuty[playerid] == 0 && PlayerInfo[playerid][pAdmin] < 6) return SendClientMessage(playerid, -1, "You are not on duty as an admin");
	if(sscanf(params, "fffi", tpx, tpy, tpz, int)) return SendClientMessage(playerid, -1, "USAGE: /gotox [coord x] [coord y] [coord z] [int]");
	if(!isnull(params))
	{
		SetPlayerPos(playerid, tpx, tpy, tpz);
		SetPlayerInterior(playerid, int);
		SendClientMessage(playerid, -1, "You have been teleported.");
		return 1;
	}
	return 1;
}
Reply
#2

4 global variables have the same name as those inside the udb_hash stock.
If you look ontop of your script, you will find 4 variables named "sl, "sl2", "int"
If you've no use to them, either delete them or rename them.
Reply
#3

s1, s2, int and int are already defined in your script (somewhere before "udb_hash", and at a higher level - outside of any functions).

You could simply rename s1, s2, int and int.
Reply
#4

got it thanks guys.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)