SA-MP Forums Archive
Errors....... - 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: Errors....... (/showthread.php?tid=600378)



Errors....... - Vizi - 07.02.2016

Код:
(58694) error 012: invalid function call, not a valid address
(58694) warning 215: expression has no effect
(58694) error 001: expected token: ";", but found ")"
(58694) error 029: invalid expression, assumed zero
(58694) fatal error 107: too many error messages on one line
Код:
new OnPlayerOfflineLogin;
new name;
OnPlayerOfflineLogin(name);
if( PlayerInfo[MAX_PLAYERS][pPermaBanned] == 3 || PlayerInfo[MAX_PLAYERS][pBanned] >= 1 )
{
SendClientMessage( playerid, COLOR_WHITE, "That player is banned" );
return 1;
}
Код:
OnPlayerOfflineLogin(name);



Re: Errors....... - Sascha - 07.02.2016

You are creating a variable and trying to use it as a callback.
If you want to create custom callbacks, you'll have to forward and not initialize them
you shall do it like this:
Код:
forward OnPlayerOfflineLogin(name[]);
public OnPlayerOfflineLogin(name[])
{
	if( PlayerInfo[MAX_PLAYERS][pPermaBanned] == 3 || PlayerInfo[MAX_PLAYERS][pBanned] >= 1 )
	{
		SendClientMessage( playerid, COLOR_WHITE, "That player is banned" );
 	}
 	return 1;
}
NOTE: this code won't work like it is
You can not use "PlayerInfo[MAX_PLAYERS]..." the way you are using, you have to enter the ID you want to check not "max_players", cause that would be the number you've set to maximum players on your server.
It either has to be "PlayerInfo[playerid]" or you need to get the playerid of the "name" entered when calling the callback


Re: Errors....... - Vizi - 07.02.2016

Quote:
Originally Posted by Sascha
Посмотреть сообщение
You are creating a variable and trying to use it as a callback.
If you want to create custom callbacks, you'll have to forward and not initialize them
you shall do it like this:
Код:
forward OnPlayerOfflineLogin(name[]);
public OnPlayerOfflineLogin(name[])
{
	if( PlayerInfo[MAX_PLAYERS][pPermaBanned] == 3 || PlayerInfo[MAX_PLAYERS][pBanned] >= 1 )
	{
		SendClientMessage( playerid, COLOR_WHITE, "That player is banned" );
 	}
 	return 1;
}
NOTE: this code won't work like it is
You can not use "PlayerInfo[MAX_PLAYERS]..." the way you are using, you have to enter the ID you want to check not "max_players", cause that would be the number you've set to maximum players on your server.
It either has to be "PlayerInfo[playerid]" or you need to get the playerid of the "name" entered when calling the callback
Код:
(58723) : warning 219: local variable "OnPlayerOfflineLogin" shadows a variable at a preceding level
(58724) : error 029: invalid expression, assumed zero
(58724) : error 012: invalid function call, not a valid address
(58724) : error 029: invalid expression, assumed zero
(58724) : fatal error 107: too many error messages on one line
Код:
if(fexist(string))
{
new OnPlayerOfflineLogin;
public OnPlayerOfflineLogin(name[]) 
{
if( PlayerInfo[MAX_PLAYERS][pPermaBanned] == 3 || PlayerInfo[MAX_PLAYERS][pBanned] >= 1 )
{
SendClientMessage( playerid, COLOR_WHITE, "That player is banned" );
}
return 1;
}
}
else
Код:
public OnPlayerOfflineLogin(name[])



Re: Errors....... - Vizi - 07.02.2016

BUMP ...
- sry spam... But i need this...