24.11.2018, 04:50
Quote:
Show the code that executes after logging in. As well as OnPlayerRequestSpawn/OnPlayerRequestClass.
Have you confirmed that your "script stopped responding" (in other words, your server; which can be the case of an infinite loop somewhere) or if it's merely an issue with the process of logging in and spawning (where the server isn't actually frozen or anything of the sort)? |
PHP код:
public OnPlayerRequestClass(playerid, classid)
{
/* SetPlayerPos(playerid,2182.4800,1285.8407,42.9785);
SetSpawnInfo(playerid, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0);
TogglePlayerSpectating(playerid, true);
TextDrawShowForPlayer(playerid, Textdraws[0]);
TextDrawShowForPlayer(playerid, Textdraws[1]);
TextDrawShowForPlayer(playerid, Textdraws[2]);
TextDrawShowForPlayer(playerid, Textdraws[3]);
SelectTextDraw(playerid, 0xA3B4C5FF);
*/
SetPlayerTeamFromClass(playerid, classid);
return 1;
}
// for the comments above, i used them when i had built a custom class selection system but its now removed.
PHP код:
function SetPlayerTeamFromClass(playerid, classid)
{
switch(classid)
{
case 0 .. 2:
{
GameTextForPlayer(playerid,"~p~ Clans Man Gang",1000,3);
tInfo[playerid][Team] = TEAM_CLANSMAN;
}
case 3 .. 5:
{
GameTextForPlayer(playerid,"~y~ G-City",1000,3);
tInfo[playerid][Team] = TEAM_GCITY;
}
case 6 .. 9:
{
GameTextForPlayer(playerid,"~b~ Babilon",1000,3);
tInfo[playerid][Team] = TEAM_POLICE;
}
case 10 .. 12:
{
GameTextForPlayer(playerid,"~r~ VIP",1000,3);
tInfo[playerid][Team] = TEAM_VIP;
}
}
SetPlayerCameraPos(playerid, 2168.9170, 1285.3018, 47.4067);
SetPlayerCameraLookAt(playerid, 2169.9199, 1285.3529, 47.0267);
SetPlayerPos(playerid,2181.4541,1285.5052,42.8728);
SetPlayerFacingAngle(playerid, 89.9141);
}
PHP код:
//logging in the player here
function LoadAcc(playerid)
{
INI_ParseFile(IPPath(playerid), "LoadIPBan_%s", .bExtra = true, .extra = playerid);
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
NameCheck(playerid);
AddAcc(playerid);
if(fexist(UserPath(playerid)))
{
if(!strcmp(RPIP(playerid), pInfo[playerid][pIP]))
{
new year, month, day, hour, mins, sec, string[64];
getdate(year, month, day);
gettime(hour,mins,sec);
format(string, 40,"%d/%d/%d at %d:%d:%d", day,month,year,hour,mins,sec);
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteString(File,"LastOn",string);
INI_Close(File);
BanCheck(playerid);
if(tInfo[playerid][ClearLog] == 0)
{
SendClientMessage(playerid,COL_NOTIFY,"Your account has been automatically logged in.");
if(IsPlayerStaff(playerid))
{
SendServerMSG(COL_LIGHTGREY,"[CONNECTED]: %s(ID:%i) has joined the server. [%i/%i]", ReturnPlayerName(playerid),playerid,CountPlayers(),MAX_CUR_PLAYERS);
SendClientMSG(playerid,COL_YELLOW,"You have been logged in as a level %i administrator. Welcome Back!!",pInfo[playerid][Admin]);
}
else
{
foreach(new i: Player)
{
if(IsPlayerStaff(i))
{
SendClientMSG(i,COL_LIGHTGREY,"[CONNECTED]: %s(ID:%i) has joined the server. (IP: %s) [%i/%i]", ReturnPlayerName(playerid),playerid,RPIP(playerid),CountPlayers(),MAX_CUR_PLAYERS);
}
else
{
SendClientMSG(i,COL_LIGHTGREY,"[CONNECTED]: %s(ID:%i) has joined the server [%i/%i]", ReturnPlayerName(playerid),playerid,CountPlayers(),MAX_CUR_PLAYERS);
}
}
}
SendClientMessage(playerid,-1,"{F52C2C}=========================================================");
SendClientMSG(playerid,-1,"{F52C2C}[MOTD]:{D17777} %s",MOTDInfo[MOTDstr]);
SendClientMessage(playerid,-1,"{F52C2C}=========================================================");
if(pInfo[playerid][Email] == 0)
{
SendClientMessage(playerid,COL_NOTIFY,"Your account doesn't have an assigned Email Address. Use /assignemail to link one to this account.");
SendClientMessage(playerid,COL_NOTIFY,"This Email Address will only be used for account recovery purposes ONLY.");
}
HideWelcomeTXD(playerid);
ShowPlayerTextdraws(playerid);
SetPlayerScore(playerid, pInfo[playerid][Score]);
}
}
else
{
InterpolateCameraPos(playerid, 1177.144775, 1243.406005, 49.845783, 2170.210937, 1284.397216, 44.558467, 45000);
InterpolateCameraLookAt(playerid, 1182.114013, 1243.842773, 50.186145, 2175.188232, 1284.801879, 44.308574, 45000);
new dialog[180];
new string[400];
strcat(string, ""COL_WHITE" Welcome back "COL_GREEN""SERVER_NAME""COL_WHITE". This account is registered, please input your password below.\n\n");
format(dialog, sizeof(dialog), ""COL_WHITE"Account Name: "COL_GREEN"%s (ID:%i)\n ",ReturnPlayerName(playerid),playerid);
strcat(string,dialog);
format(dialog, sizeof(dialog),""COL_WHITE"IP Address: "COL_GREEN"%s\n\n ",RPIP(playerid));
strcat(string,dialog);
strcat(string, ""COL_WHITE" **Remember to read "COL_RED"/rules "COL_WHITE".\n");
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE""SERVER_NAME" - Login",string,"Login","X");
}
}
else
{
InterpolateCameraPos(playerid, 1177.144775, 1243.406005, 49.845783, 2170.210937, 1284.397216, 44.558467, 45000);
InterpolateCameraLookAt(playerid, 1182.114013, 1243.842773, 50.186145, 2175.188232, 1284.801879, 44.308574, 45000);
new dialog[180];
new string[400];
strcat(string, ""COL_WHITE" Welcome to "COL_GREEN""SERVER_NAME""COL_WHITE". This account is not registered, please input your desired password below\n");
strcat(string, ""COL_WHITE" to register this account.\n\n");
format(dialog, sizeof(dialog), ""COL_WHITE"Account Name: "COL_GREEN"%s (ID:%i)\n ",ReturnPlayerName(playerid),playerid);
strcat(string,dialog);
format(dialog, sizeof(dialog),""COL_WHITE"IP Address:"COL_GREEN" %s\n\n ",RPIP(playerid));
strcat(string,dialog);
strcat(string, ""COL_WHITE" **Do "COL_RED"NOT "COL_WHITE"share your password with anyone. Not even administrators.\n");
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE""SERVER_NAME" - Registration",string,"Register","X");
}
return 1;
}