SA-MP Forums Archive
Omg stupid errors o.0 - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Omg stupid errors o.0 (/showthread.php?tid=112655)



Omg stupid errors o.0 - bajskorv123 - 09.12.2009

Hey, took /pm cmd from the Base Filterscript (credits to samp 0.3a whoever made it) Because i wanted to have it in my admin filterscript. But when i try to compile i get this error. Heres the code btw. And i took the numbers from the error rows.

Код:
// PM COMMAND

(4605)  new pName[MAX_PLAYER_NAME];
(4606)  new Message[256];
(4607)  new iName[MAX_PLAYER_NAME];
(4608)  new gMessage[256];
(4609)
(4610)  if(strcmp("/pm", cmd, true) == 0)
(4611)	{
(4612)	  new	tmp[256];
(4613)	  new	idx;
	  
		tmp = strtok(cmdtext,idx);

		if(!strlen(tmp) || strlen(tmp) > 5) {
			SendClientMessage(playerid,red,"Usage: /pm (id) (message)");
			return 1;
		}

		new id = strval(tmp);
    gMessage = strrest(cmdtext,idx);

		if(!strlen(gMessage)) {
			SendClientMessage(playerid,red,"Usage: /pm (id) (message)");
			return 1;
		}

		if(!IsPlayerConnected(id)) {
			SendClientMessage(playerid,red,"Bad player ID");
			return 1;
		}

		if(playerid != id) {
			GetPlayerName(id,iName,sizeof(iName));
			GetPlayerName(playerid,pName,sizeof(pName));
			format(Message,sizeof(Message),"%s(%d): %s",pName,playerid,gMessage);
			SendClientMessage(id,yellow,Message);
			PlayerPlaySound(id,1085,0.0,0.0,0.0);

			printf("[Pm] %s: '%s' to %s",pName,Message,iName);

		}
		else {
			SendClientMessage(playerid,red,"Cant PM Yourself");
		}
    return 1;
  }
  
// Ends here
And heres the error
Код:
C:\Documents and Settings\Administrator\Desktop\Server\filterscripts\admin.pwn(4605) : warning 219: local variable "pName" shadows a variable at a preceding level
C:\Documents and Settings\Administrator\Desktop\Server\filterscripts\admin.pwn(4612) : warning 219: local variable "tmp" shadows a variable at a preceding level
C:\Documents and Settings\Administrator\Desktop\Server\filterscripts\admin.pwn(4613) : warning 219: local variable "idx" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
Please help me with anything you can, thanks


Re: Omg stupid errors o.0 - Mikep. - 09.12.2009

You alredy have 'new pName' etc. somewhere else.


Re: Omg stupid errors o.0 - acade - 09.12.2009

Quote:
Originally Posted by Mikep.
You alredy have 'new pName' etc. somewhere else.
All you have to do is // the new pName etc.


Re: Omg stupid errors o.0 - Correlli - 09.12.2009

Quote:
Originally Posted by TheOneThatOwnZ
All you have to do is // the new pName etc.
No, that will give the error that pName is undefined because he's using it.
Just re-name it to something else.


Re: Omg stupid errors o.0 - jamesbond007 - 09.12.2009

[quote=bajskorv123 ]
Hey, took /pm cmd from the Base Filterscript (credits to samp 0.3a whoever made it) Because i wanted to have it in my admin filterscript. But when i try to compile i get this error. Heres the code btw. And i took the numbers from the error rows.

Код:
// PM COMMAND

(4605)  new pName[MAX_PLAYER_NAME];
(4606)  new Message[256];
(4607)  new iName[MAX_PLAYER_NAME];
(4608)  new gMessage[256];

i may not understand much about scripting but mine is working and i have new pName[MAX_PLAYER_NAME+1];
and new	tmp[256];
 new idx;
 at the top of the pm command



Re: Omg stupid errors o.0 - Mikep. - 09.12.2009

Quote:
Originally Posted by TheOneThatOwnZ
Quote:
Originally Posted by Mikep.
You alredy have 'new pName' etc. somewhere else.
All you have to do is // the new pName etc.
Do you not have a backspace key, then?


Re: Omg stupid errors o.0 - bajskorv123 - 10.12.2009

Thanks for your help guys it works