[HELP]Unreachable code - 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: [HELP]Unreachable code (
/showthread.php?tid=112312)
[HELP]Unreachable code -
Michelman - 06.12.2009
Hi Guys, This is my first post and I came here because I have an problem,
I use this code
Код:
public OnPlayerConnect(playerid)
{
new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s has joined the server", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
return 1;
SendClientMessage(playerid, COLOR_GREEN, "Welcome to Michel's server, Enjoy your stay !");
return 1;
}
But I get this error:
D:\GTA San-Andreas\Server\pawno\First script.pwn(473) : warning 225: unreachable code
SendClientMessage(playerid, COLOR_GREEN, "Welcome to Michel's server, Enjoy your stay !");
is the 473 line
Re: [HELP]Unreachable code -
Remi-X - 06.12.2009
return means that your callback will be ended.
Код:
public OnPlayerConnect(playerid)
{
new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s has joined the server", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
return 1; //So here your script ends. (Solution is to remove this line)
//And it wont reach this, but you have code below this.
SendClientMessage(playerid, COLOR_GREEN, "Welcome to Michel's server, Enjoy your stay !");
return 1;
}
Re: [HELP]Unreachable code -
[XST]O_x - 06.12.2009
pawn Код:
public OnPlayerConnect(playerid)
{
new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s has joined the server", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
SendClientMessage(playerid, COLOR_GREEN, "Welcome to Michel's server, Enjoy your stay !");
return 1;
}
You've putted two 'return 1;' .
Re: [HELP]Unreachable code -
Michelman - 06.12.2009
My bad, Thanks for the help