Omg stupid errors o.0
#1

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
Reply
#2

You alredy have 'new pName' etc. somewhere else.
Reply
#3

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

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.
Reply
#5

[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
Reply
#6

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?
Reply
#7

Thanks for your help guys it works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)