SA-MP Forums Archive
3 Warnings +REP - 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: 3 Warnings +REP (/showthread.php?tid=585930)



CLOSED. - Rodri99 - 17.08.2015

CLOSED.


Re: 3 Warnings +REP - Sergei - 17.08.2015

1. Remove new x; on line35.

2. Looks like pName is already a global variable, so delete new pName[24] or rename it.


Re: 3 Warnings +REP - MichaelJones - 17.08.2015

Can you write down the code into a
Код:
One like this
or into a PHP code? SO I Can know the pawno code and the errors


Re : 3 Warnings +REP - Dutheil - 17.08.2015

For the first function, you've declared 2 times the variable "x".

Код:
stock GetNumberOfPlayersOnThisIP(test_ip[])//&&&&&&&&&&&&&&&&&&&&&&&stock&&&&&&&
{
	new against_ip[32+1];
	new x = 0; //line 35
	new ip_count = 0;
	for(new x, m = GetMaxPlayers(); x<m; x++) { //line 37
		if(IsPlayerConnected(x)) {
			GetPlayerIp(x,against_ip,32);
			if(!strcmp(against_ip,test_ip)) ip_count++;
		}
	}
	return ip_count;
}
For the second function, have you already a variable global "pName" ?

Think to use the BBCode [php] or [code] when you post a code.


Re: 3 Warnings +REP - DTV - 17.08.2015

Both of the warnings basically means that you already have the variable in question defined.

In the first case, you have
Код:
new x = 0;
, however a few lines down in the loop, you redefine x in the loop as
Код:
for(new x....
which causes the warnings. Just either get rid of the "new x = 0;" or use "for(x, m = GetMaxPlayers(); x<m; ++)" to fix the first one.

The second one is more than likely the case that somewhere in the script, pName is being declared a global variable, so you need to look wherever else pName is being used.

EDIT: Everyone literally gathered on this thread lol


Re: 3 Warnings +REP - Rodri99 - 17.08.2015

I changed new x to new xip but i got this:


C:\Users\Rodrigo\Desktop\xef-origenale\Gamemodes\xef.pwn(1737) : warning 219: local variable "xip" shadows a variable at a preceding level
C:\Users\Rodrigo\Desktop\xef-origenale\Gamemodes\xef.pwn(1735) : warning 204: symbol is assigned a value that is never used: "xip"


Re : 3 Warnings +REP - Dutheil - 17.08.2015

Quote:
Originally Posted by Rodri99
Посмотреть сообщение
I changed new x to new xip but i got this:


C:\Users\Rodrigo\Desktop\xef-origenale\Gamemodes\xef.pwn(1737) : warning 219: local variable "xip" shadows a variable at a preceding level
C:\Users\Rodrigo\Desktop\xef-origenale\Gamemodes\xef.pwn(1735) : warning 204: symbol is assigned a value that is never used: "xip"
Show the code.


Respuesta: 3 Warnings +REP - Whyd - 17.08.2015

You must change only one new x to new xip


Re: 3 Warnings +REP - Rodri99 - 17.08.2015

INFO CLOSED.


Re: 3 Warnings +REP - Vince - 17.08.2015

You should've just removed it like Sergei said. The instruction could hardly be any more clear.


Re : 3 Warnings +REP - Dutheil - 17.08.2015

Why do you declare variables, if you know that you will not use it ?


Re: Re : 3 Warnings +REP - Sergei - 17.08.2015

Quote:
Originally Posted by Dutheil
Посмотреть сообщение
Why do you declare variables, if you know that you will not use it ?
Because he has no idea what he is doing.


Now where is my rep.


Re : Re: Re : 3 Warnings +REP - Dutheil - 18.08.2015

Quote:
Originally Posted by Sergei
Посмотреть сообщение
Now where is my rep.
Ahaha :'))))