10.02.2012, 18:09
on the top of gamemode:
OnPlayerConnect
OnPlayerDisconnect:
OnDialogR...
Код:
#define PATH "/JEZYK/Users/%s.ini" #define DIALOG_LANGUAGES 700 enum pInfo { pLang, } new PlayerInfo[MAX_PLAYERS][pInfo]; stock UserPath(playerid) { new string[128],playername[MAX_PLAYER_NAME]; GetPlayerName(playerid,playername,sizeof(playername)); format(string,sizeof(string),PATH,playername); return string; } forward LoadUser_data(playerid,name[],value[]); public LoadUser_data(playerid,name[],value[]) { INI_Int("Language",PlayerInfo[playerid][pLang]); return 1; }
Код:
new UID = BUD::GetNameUID( PlayerName2( playerid ) ); if ( !BUD::IsNameRegistered( PlayerName2( playerid ) ) ) { new String[200]; format( String, sizeof String,"{00C0FF}Witamy!""{FFFFFF}\n\n Wybierz swуj język!\n\n Choose your language!" ); ShowDialog(playerid, 2360, BOX,"{FFBF00}Jezyk/Language", String, "Polski", "English"); } else if(PlayerInfo[playerid][pLang] == 1) { new Stringg[ 200 ]; format( Stringg, sizeof Stringg, "{00C0FF}Witamy! "#COL_ORANGE"%s.\n\ {FFFFFF}To konto jest zarejestrowane!\n\ Zaloguj się albo spadaj:)\n\n\ Wciśnij 'Kick', jeżeli chcesz wyjść.",PlayerName2( playerid ) ); ShowDialog( playerid, Login1, BOX, "{FFBF00}Konto Zarejestrowane!", Stringg, "Login", "Kick"); if ( UID != BUD::INVALID_UID ) { P_DATA[ playerid ][ P_CitySave ] = BUD::GetIntEntry( UID, "SaveCity" ) ; P_DATA[ playerid ][ P_City ] = BUD::GetIntEntry( UID, "SpawnCity" ) ; } } else if(PlayerInfo[playerid][pLang] == 2) { new Stringgg[ 200 ]; format( Stringgg, sizeof Stringgg, "{00C0FF}Welcome! "#COL_ORANGE"%s.\n\ {FFFFFF}This account is registered!\n\ Please login or get out:)\n\n\ Pressing 'Kick' won't get you kicked.",PlayerName2( playerid ) ); ShowDialog( playerid, Login1, BOX,"{FFBF00}Account Registered!", Stringgg, "Login", "Kick"); if ( UID != BUD::INVALID_UID ) { P_DATA[ playerid ][ P_CitySave ] = BUD::GetIntEntry( UID, "SaveCity" ) ; P_DATA[ playerid ][ P_City ] = BUD::GetIntEntry( UID, "SpawnCity" ) ; } }
Код:
new INI:File = INI_Open(UserPath(playerid)); INI_WriteInt(File,"Language",PlayerInfo[playerid][pLang]); INI_Close(File);
Код:
if(dialogid == 2360) { if(response) { PlayerInfo[playerid][pLang] = 1; if ( !BUD::IsNameRegistered( PlayerName2( playerid ) ) ) { new String[ 200 ]; format( String, sizeof String, "{00C0FF}Witamy! "#COL_ORANGE"%s.\n\ {FFFFFF}Rejestracja jest obowiązkowa!\n\n\ Będziesz miał dostęp do wielu rzeczy!",PlayerName2( playerid ) ); ShowDialog( playerid, Register1, BOX, "{FFBF00}Zarejsestruj się.", String, "Rejestruj", "Kick"); } else if(PlayerInfo[playerid][pLang] == 1) { new String[ 200 ]; format( String, sizeof String, "{00C0FF}Witamy! "#COL_ORANGE"%s.\n\ {FFFFFF}To konto jest zarejestrowane!\n\ Zaloguj się albo spadaj:)\n\n\ Wciśnij 'Kick', jeżeli chcesz wyjść.",PlayerName2( playerid ) ); ShowDialog( playerid, Login1, BOX, "{FFBF00}Konto Zarejestrowane!", String, "Login", "Kick"); if ( UID != BUD::INVALID_UID ) { P_DATA[ playerid ][ P_CitySave ] = BUD::GetIntEntry( UID, "SaveCity" ) ; P_DATA[ playerid ][ P_City ] = BUD::GetIntEntry( UID, "SpawnCity" ) ; } } } else { PlayerInfo[playerid][pLang] = 2; if ( !BUD::IsNameRegistered( PlayerName2( playerid ) ) ) { new String[ 200 ]; format( String, sizeof String, "{00C0FF}Welcome! "#COL_ORANGE"%s.\n\ {FFFFFF}Registering is obligatory!\n\n\ You will have acces to many features!",PlayerName2( playerid ) ); ShowDialog( playerid, Register1, BOX,"{FFBF00}Register an account.", String, "Register", "Kick"); } else if(PlayerInfo[playerid][pLang] == 2) { new String[ 200 ]; format( String, sizeof String, "{00C0FF}Welcome! "#COL_ORANGE"%s.\n\ {FFFFFF}This account is registered!\n\ Please login or get out:)\n\n\ Pressing 'Kick' won't get you kicked.",PlayerName2( playerid ) ); ShowDialog( playerid, Login1, BOX,"{FFBF00}Account Registered!", String, "Login", "Kick"); if ( UID != BUD::INVALID_UID ) { P_DATA[ playerid ][ P_CitySave ] = BUD::GetIntEntry( UID, "SaveCity" ) ; P_DATA[ playerid ][ P_City ] = BUD::GetIntEntry( UID, "SpawnCity" ) ; } } } return 1; }