public OnPlayerConnect(playerid)
{
TextDrawShowForPlayer(playerid, TextdrawConnect0); // Connect Textdraw
TextDrawShowForPlayer(playerid, TextdrawConnect1); // Connect Textdraw
TextDrawShowForPlayer(playerid, TextdrawConnect2); // Connect Textdraw
TextDrawShowForPlayer(playerid, TextdrawConnect3); // Connect Textdraw
TextDrawShowForPlayer(playerid, TextdrawConnect4); // Connect Textdraw
TextDrawShowForPlayer(playerid, TextdrawConnect5); // Connect Textdraw
TextDrawShowForPlayer(playerid, TextdrawConnect6); // Connect Textdraw
TextDrawShowForPlayer(playerid, TextdrawConnect7); // Connect Textdraw
TextDrawShowForPlayer(playerid, TextdrawConnect8); // Connect Textdraw
TextDrawShowForPlayer(playerid, TextdrawConnect9); // Connect Textdraw
TextDrawShowForPlayer(playerid, TextdrawConnect10); // Connect Textdraw
TextDrawShowForPlayer(playerid, TextdrawConnect11); // Connect Textdraw
TextDrawShowForPlayer(playerid, TextdrawConnect12); // Connect Textdraw
TextDrawShowForPlayer(playerid, TextdrawConnect13); // Connect Textdraw
TextDrawShowForPlayer(playerid, TextdrawConnect14); // Connect Textdraw
TextDrawShowForPlayer(playerid, TextdrawConnect15); // Connect Textdraw
TextDrawShowForPlayer(playerid, TextdrawConnect16); // Connect Textdraw
TextDrawShowForPlayer(playerid, TextdrawConnect17); // Connect Textdraw
TextDrawShowForPlayer(playerid, TextdrawConnect18); // Connect Textdraw
TextDrawShowForPlayer(playerid, TextdrawConnect19); // Connect Textdraw
TextDrawShowForPlayer(playerid, Credit); // Credits
new name[MAX_PLAYER_NAME]; // Player Name Textdraw
GetPlayerName(playerid,name,MAX_PLAYER_NAME);// Player Name Textdraw
PlayerN=TextDrawCreate(115,416,name);// Player Name Textdraw
TextDrawShowForPlayer(playerid, PlayerN);// Player Name Textdraw
TextDrawColor(PlayerN,0xFFFFFFAA);// Player Name Textdraw
TextDrawFont(PlayerN,3);// Player Name Textdraw
TextDrawSetShadow(PlayerN,1);// Player Name Textdraw
pLogged[playerid] = 0;
#if defined AUTOLOGIN
new tmpIP[16];
GetPlayerIp(playerid,tmpIP,sizeof(tmpIP)); //Getting IP
#endif
if(fexist(PlayerPath(playerid)))
{
INI_ParseFile(PlayerPath(playerid), "UserDataLoad_%s", .bExtra = true, .extra = playerid); //Calling loading callback
#if defined AUTOLOGIN
if(strcmp(tmpIP,pIP[playerid],true) == 0)//Checking if the IPs match
{
pLogged[playerid] = 1;
SetPlayerScore(playerid,pInfo[playerid][Score]);
GivePlayerMoney(playerid,pInfo[playerid][Cash]);
SendClientMessage(playerid,lime,"You've been auto-logged in. [IP match]");
return 1;
}
#endif
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Please enter your password below.","Login","Leave");
}
else
{
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Please register by entering a password below.","Register","Leave");
}
if(dini_Exists(MsgFile()))
{
new string[128];
format(string,128,"Server Message: {ffffff}%s",dini_Get(MsgFile(),"MSG"));
SendClientMessage(playerid,0x00ff00ff,string);
return 1;
}
PlayAudioStreamForPlayer(playerid,"http://k005.kiwi6.com/hotlink/0hn592rrdn/Alex_Mica_Dalinda_Official_Radio_Edit.mp3");
Radio[playerid] = false;
return 1;
}
Yes but what does "return" actually do?
It has something to do with returning... |
if(!strcmp(cmdtext, "/hello", true))
{
Hello();
return 1;
}
stock Hello()
{
return 0;
}
stock Hello()
{
return 0;
return 1;
}
if(strcmp(tmpIP,pIP[playerid],true) == 0)//Checking if the IPs match
{
pLogged[playerid] = 1;
SetPlayerScore(playerid,pInfo[playerid][Score]);
GivePlayerMoney(playerid,pInfo[playerid][Cash]);
SendClientMessage(playerid,lime,"You've been auto-logged in. [IP match]");
return 1;
}
if(dini_Exists(MsgFile()))
{
new string[128];
format(string,128,"Server Message: {ffffff}%s",dini_Get(MsgFile(),"MSG"));
SendClientMessage(playerid,0x00ff00ff,string);
return 1;
}
'return' returns to the point where the function it's used in is called.
For example: pawn Код:
pawn Код:
pawn Код:
Think of it as a person. A player types /hello, the person goes into OnPlayerCommandText to grab whatever is in /hello. "Hello()" is in /hello, so said person then goes into the Hello() function to grab whatever is in there. In this case, the man is told to return with a 0. He returns to /hello with a 0, as given by the Hello() function, where it can be used in processing in the /hello command. /hello no longer needs the Hello() information and so tells the man to return with a 1. The man returns to the server holding a 1, as given by the /hello command. Applying this to your script... pawn Код:
In this case, remove the return 1; after the SendClientMessage. pawn Код:
Again, remove the return 1; after the SendClientMessage. Firstly, the man asks if the IPs match. They don't, so he is never told to return. The man then asks if MsgFile exists. It does, so he goes into the if statement and is told to return. Because the man has returned, he's never told to play music. Therefore, the music doesn't play. In short, remove return 1; from the end of both statements I quoted. |
if(fexist(PlayerPath(playerid)))
{
INI_ParseFile(PlayerPath(playerid), "UserDataLoad_%s", .bExtra = true, .extra = playerid); //Calling loading callback
#if defined AUTOLOGIN
if(strcmp(tmpIP,pIP[playerid],true) == 0)//Checking if the IPs match
{
pLogged[playerid] = 1;
SetPlayerScore(playerid,pInfo[playerid][Score]);
GivePlayerMoney(playerid,pInfo[playerid][Cash]);
SendClientMessage(playerid,lime,"You've been auto-logged in. [IP match]");
}
#endif
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Please enter your password below.","Login","Leave");
}
if(pLogged[playerid] == 0)
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Please enter your password below.","Login","Leave");
}
pawn Код:
Try changing the ShowPlayerDialog to this: pawn Код:
|
#endif
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Please enter your password below.","Login","Leave");
#endif
if(pLogged[playerid] == 0)
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Please enter your password below.","Login","Leave");
}
pawn Код:
pawn Код:
|