23.07.2016, 13:15
Well for the MAX_PLAYERS part and scrolling I've implemented foreach, to make it more efficient and sure
Код:
case DIALOG_LOGIN: { if ( !response ) return Kick ( playerid ); if( response ) { if(udb_hash(inputtext) == PlayerInfo[playerid][pPass]) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); GivePlayerCash(playerid, PlayerInfo[playerid][pCash]); PlayerInfo[playerid][hours] = GetPVarInt(playerid, "Hours"); PlayerInfo[playerid][minutes] = GetPVarInt(playerid, "Minutes"); PlayerInfo[playerid][seconds] = GetPVarInt(playerid,"Seconds"); SpawnPlayer(playerid); SendClientMessage(playerid, -1, "* You have successfully logged in."); if(PlayerInfo[playerid][pBanned] == 1) { Ban(playerid); } if(PlayerInfo[playerid][pAdmin] != 0) { new msgID[128], msg[128]; if(PlayerInfo[playerid][pUCAdmin] == 0) { format(msgID, 32, "Administration Level - %d", PlayerInfo[playerid][pAdmin]); SendClientMessage(playerid, COLOR_ADMIN, msgID); format(msg, sizeof(msg), "* %s (ID%d) has logged in as Administrator Level %d.", GetName(playerid), playerid, PlayerInfo[playerid][pAdmin]); foreach(Player,i) { if(PlayerInfo[i][pAdmin] != 0 && i != playerid) SendClientMessage(i,COLOR_ADMIN,msg); } } else { format(msgID, 64, "Administration Level - %d (Undercover)", PlayerInfo[playerid][pAdmin]); SendClientMessage(playerid, COLOR_ADMIN, msgID); } } } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Login","You have entered an incorrect password.\n""Type your password below to login.","Login","Quit"); } return 1; } } } return 1;
Код:
public OnPlayerConnect(playerid) if(fexist(UserPath(playerid))) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"Authentication","{FFFFFF}Welcome to {FF0000}Vexed Roleplay\n{FFFFFF}Please type your password to login.","Login","Quit"); } else { ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,"Authentication","{FFFFFF}Welcome to {FF0000}Vexed Roleplay\n{FFFFFF}Please type your password to register.","Register","Quit"); } return 1;