20.11.2009, 16:20
I have make a Dialog Register and here is it:
And when i go out of my server & go back and i have not my job and my money.....
PLZ HELP
PS:I from slovakia & sorry for bad english
Код:
//---------------- INCLUDE #include <a_samp> #include <core> #include <float> #include <dutils> #include <dudb> //---------------- DEFINE #define COLOR_RED 0xAA3333AA #define COLOR_GREEN 0x33AA33AA #define MAX_PLAYERS_EX 100 enum INFORMATION { prihlasen } new Info[MAX_PLAYERS][INFORMATION]; //---------------- FORWARDS forward Register(playerid); forward Login(playerid); forward SetupPlayerForClassSelection(playerid); forward OnPlayerSavingAcc(playerid); //---------------- STOCKS stock PlayerName(playerid) { new name[255]; GetPlayerName(playerid, name, 255); return name; } stock Odpojeni(playerid) { SendClientMessage(playerid, COLOR_GREEN, "==== City Life ===="); SendClientMessage(playerid, COLOR_GREEN, "Odpojil si sa!"); SendClientMessage(playerid, COLOR_GREEN, "Odpojil si sa!"); SendClientMessage(playerid, COLOR_GREEN, "==== City Life ===="); Kick(playerid); return 1; } public Register(playerid) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); new tabulka[256]; format(tabulka,256,"Љpatnй heslo!\n\nNick: %s\n\nVaљe novй heslo:",name); ShowPlayerDialog(playerid,3,DIALOG_STYLE_INPUT,"Registracia",tabulka,"Registrovat","Odpojit"); return 1; } public Login(playerid) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); new tabulka[256]; format(tabulka,256,"Љpatnй heslo!\n\nNick: %s\n\nVaљe heslo:",name); ShowPlayerDialog(playerid,4,DIALOG_STYLE_INPUT,"Prihlбsenie",tabulka,"Prihlбsit","Odpojit"); return 1; } public OnPlayerSavingAcc(playerid) { for(new i=0; i< MAX_PLAYERS; i++){ if(IsPlayerConnected(i)){ //------- if (Info[playerid][prihlasen]) { dUserSetINT(PlayerName(playerid)).("penize",GetPlayerMoney(playerid)); //tady ukladame } } } return 1; } public SetupPlayerForClassSelection(playerid) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); if (Info[playerid][prihlasen] == 0) { if(!udb_Exists(PlayerName(playerid))) { new tabulka[256]; format(tabulka,256,"Vitajte na serveru\n\n%s prosнm registrujte sa\n\nZvolte si novй heslo:",name); ShowPlayerDialog(playerid,3,DIALOG_STYLE_INPUT,"Registracia",tabulka,"Regisrovat","Odpojit"); } else if (udb_Exists(PlayerName(playerid))){ new tabulka[256]; format(tabulka,256,"Vitajte na serveru\n\nNick: %s\n\nVaљe heslo:",name); ShowPlayerDialog(playerid,4,DIALOG_STYLE_INPUT,"Prihlбsenie",tabulka,"Prihlбsit","Odpojit"); } } } public OnGameModeInit() { return 1; } public OnGameModeExit() { return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerInterior(playerid,0); SetPlayerPos(playerid,2494.4172,-1691.6420,23.2226); SetPlayerFacingAngle(playerid,175.4473); SetPlayerCameraPos(playerid,2494.1086,-1696.4948,23.6205); SetPlayerCameraLookAt(playerid,2494.4172,-1691.6420,23.2226); return 1; } public OnPlayerConnect(playerid) { Info[playerid][prihlasen]=false; SetupPlayerForClassSelection(playerid); return 1; } public OnPlayerDisconnect(playerid, reason) { OnPlayerSavingAcc(playerid); return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); //register if(dialogid == 3){ if(IsPlayerNPC(playerid)) return 1; if(response){ if (strlen(inputtext)==0) return Register(playerid); if (udb_Create(PlayerName(playerid),inputtext)){ Login(playerid); new string[256]; format(string, 256, "Ъspeљně si sa registroval. Tvoje heslo: [%s]", inputtext); SendClientMessage(playerid, COLOR_GREEN, string); return 1; } }else{ Odpojeni(playerid); } return 1; } //login if(dialogid == 4){ if(IsPlayerNPC(playerid)) return 1; //pustн NPC if(response){ if (strlen(inputtext)==0) return Login(playerid); if (udb_CheckLogin(PlayerName(playerid),inputtext)){ GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("penize")-GetPlayerMoney(playerid)); SendClientMessage(playerid, COLOR_GREEN, "Ъspeљne si sa prihlбsil!"); Info[playerid][prihlasen]=true; }else{ Login(playerid); return 1; } }else{ Odpojeni(playerid); } return 1; } // return 1; }
PLZ HELP
PS:I from slovakia & sorry for bad english