Some warnings and errors
#1

Hello guys, how are you today?
can you help me in this code? i've been looking for solution and i found nothing...
Here's the code:
Код:
stock BanPlayer(playerid,reason[],admin[])
{
	new str[128];
	BanEx(playerid,reason);
	format(str,sizeof(str),"You have been currently banned from this server.\nUser: %s\nReason: %s\nAdmin %s\n",PlayerName(playerid),reason,admin);
	ShowPlayerDialog(playerid,DIALOG_BANNED,DIALOG_STYLE_MSGBOX,"You have been banned!",str,"Leave","");
	return 1;
}
And here's the errors/warning:
Код:
C:\Users\HichamMeftah\Desktop\testgm.pwn(1166) : error 012: invalid function call, not a valid address
C:\Users\HichamMeftah\Desktop\testgm.pwn(1166) : warning 215: expression has no effect
C:\Users\HichamMeftah\Desktop\testgm.pwn(1166) : error 001: expected token: ";", but found ")"
C:\Users\HichamMeftah\Desktop\testgm.pwn(1166) : error 029: invalid expression, assumed zero
C:\Users\HichamMeftah\Desktop\testgm.pwn(1166) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Any help would be appreciated
Reply
#2

Which line is 1166?
Reply
#3

This:
Код:
format(str,sizeof(str),"You have been currently banned from this server.\nUser: %s\nReason: %s\nAdmin %s\n",PlayerName(playerid),reason,admin);
Reply
#4

your problem is here
PlayerName(playerid),reason,admin

you are in wrong with some of adresses did u define playername(playerid) ?


and also this stock will ban player instatly and player wont see the dialog )

so you have to do like this

PHP код:
forward BanExPlayer(playerid,reason[]);
Stock BanPlayer(playeridreason[], admin[])
{
    
// here shows some thing you want to player see 
    
SetTimerEx("BanExPlayer",1000,false,"ds",playerid,reason);
    return 
1;
}
public 
BanExPlayer(playerid,reason[])
{
    
BanEx(playerid,reason);
    return 
1;

Reply
#5

i defined playername and now it got fixed but another problem popped up
Код:
stock UserPath(playerid)
{
	new string[128],playername[MAX_PLAYER_NAME]; // this line
	GetPlayerName(playerid,playername,sizeof(playername)); // and this line too
	format(string,sizeof(string),PATH,playername);
	return string;
}
errors:
Код:
C:\Users\HichamMeftah\Desktop\testgm.pwn(611) : error 001: expected token: "-identifier-", but found "["
C:\Users\HichamMeftah\Desktop\testgm.pwn(612) : error 029: invalid expression, assumed zero
C:\Users\HichamMeftah\Desktop\testgm.pwn(612) : warning 215: expression has no effect
C:\Users\HichamMeftah\Desktop\testgm.pwn(612) : error 001: expected token: ";", but found "]"
C:\Users\HichamMeftah\Desktop\testgm.pwn(612) : error 029: invalid expression, assumed zero
C:\Users\HichamMeftah\Desktop\testgm.pwn(612) : fatal error 107: too many error messages on one line
can you help me in this too? thx
Reply
#6

Quote:
Originally Posted by SilentHill3D
Посмотреть сообщение
i defined playername and now it got fixed but another problem popped up
Код:
stock UserPath(playerid)
{
	new string[128],playername[MAX_PLAYER_NAME]; // this line
	GetPlayerName(playerid,playername,sizeof(playername)); // and this line too
	format(string,sizeof(string),PATH,playername);
	return string;
}
errors:
Код:
C:\Users\HichamMeftah\Desktop\testgm.pwn(611) : error 001: expected token: "-identifier-", but found "["
C:\Users\HichamMeftah\Desktop\testgm.pwn(612) : error 029: invalid expression, assumed zero
C:\Users\HichamMeftah\Desktop\testgm.pwn(612) : warning 215: expression has no effect
C:\Users\HichamMeftah\Desktop\testgm.pwn(612) : error 001: expected token: ";", but found "]"
C:\Users\HichamMeftah\Desktop\testgm.pwn(612) : error 029: invalid expression, assumed zero
C:\Users\HichamMeftah\Desktop\testgm.pwn(612) : fatal error 107: too many error messages on one line
can you help me in this too? thx
here you are

PHP код:
/* ok i think your problem is why you are defining varb playername 2x times
so please make sure to do this*/
#define PATH "your file adress"
Stock UserPatch(playerid)
{
    new 
str[128],pName[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,pName,sizeof(pName));
    
format(str,sizeof(str),PATH,pName);
    return 
str;
    

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)