20.06.2010, 20:24
i really don't understand this scripting it was all fine for 10 minutes i was testing my dialog register/login system it was working perfect
than i delete my file where it was saved and try to test it again ... and belive or not the script its just ignore all register/login is that possible ? wtf i dont understand what i did wrong...
here is the code
before it was all ok and it made file in scriptfiles folder send error messages ... ex: [System]:You was kicked becouse .... blah bla...
when i delete file with my name now is all wrong it simply ignore all what i made for register/login system with GUI, it dont make file in scriptfile folder it dont send any error message,if i dont type any word in box and press Register/login it wont send any error message,if i press cancel it wont kick me what the fuck ? i cant belive, no errors in script , no warnings,and i don't see any mistake
than i delete my file where it was saved and try to test it again ... and belive or not the script its just ignore all register/login is that possible ? wtf i dont understand what i did wrong...
here is the code
Код:
// This is a comment // uncomment the line below if you want to write a filterscript //#define FILTERSCRIPT #include <a_samp> #include <dini> //#include <dudb> //#include <zcmd> //#include <lethaldudb2> #pragma tabsize 0 //COLORS #define COLOR_GRAD1 0xB4B5B7FF #define COLOR_GRAD2 0xBFC0C2FF #define COLOR_GRAD3 0xCBCCCEFF #define COLOR_GRAD4 0xD8D8D8FF #define COLOR_GRAD5 0xE3E3E3FF #define COLOR_GRAD6 0xF0F0F0FF #define COLOR_GREY 0xAFAFAFAA #define COLOR_GREEN 0x33AA33AA #define COLOR_RED 0xAA3333AA #define COLOR_LIGHTRED 0xFF6347AA #define COLOR_LIGHTBLUE 0x33CCFFAA #define COLOR_LIGHTGREEN 0x9ACD32AA #define COLOR_YELLOW 0xFFFF00AA #define COLOR_YELLOW2 0xF5DEB3AA #define COLOR_WHITE 0xFFFFFFAA #define COLOR_FADE1 0xE6E6E6E6 #define COLOR_FADE2 0xC8C8C8C8 #define COLOR_FADE3 0xAAAAAAAA #define COLOR_FADE4 0x8C8C8C8C #define COLOR_FADE5 0x6E6E6E6E #define COLOR_PURPLE 0xC2A2DAAA #define COLOR_DBLUE 0x2641FEAA // COPS #define COLOR_ALLDEPT 0xFF8282AA #define COLOR_NEWS 0xFFA500AA #define COLOR_OOC 0xE0FFFFAA #define SV "1.0" #define TEAM_LSPD 1 new gTeam[MAX_PLAYERS]; enum aInfo { Password, LoggedIn, AdminLevel, Kicks } new AccInfo[MAX_PLAYERS][aInfo]; enum pInfo { Score, Deaths, Kills, Money } new PlayerInfo[MAX_PLAYERS][pInfo]; #if defined FILTERSCRIPT public OnFilterScriptInit() { print("\n--------------------------------------"); print(" Blank Filterscript by your name here"); print("--------------------------------------\n"); return 1; } public OnFilterScriptExit() { return 1; } #else main() { print("\n----------------------------------"); print(" Gamemode maded by Kljukec"); print("----------------------------------\n"); } #endif public OnGameModeInit() { if(!fexist("Accounts/")) { print("\n\n > WARNING: Folder Missing From Scriptfiles\n"); return 1; } // Don't use these lines if it's a filterscript SetGameModeText("Blank Script"); AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); return 1; } public OnGameModeExit() { return 1; } public OnPlayerRequestClass(playerid, classid) { SetPlayerTeamFromClass(playerid, classid); SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746); SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746); return 1; } SetPlayerToTeamColor(playerid) { if (gTeam[playerid] == TEAM_LSPD) { SetPlayerColor(playerid, 0x2641FEAA); } } public OnPlayerConnect(playerid) { new file[256]; new str[128]; new name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,sizeof(name)); format(file,sizeof(file),"/Accounts/%s.ini",name); if(dini_Exists(file)) { format(str, sizeof(str), "Welcome back %s!Please type in the correct password!\nEnjoy", name); ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login",str,"Login","Cancel"); } else { format(str, sizeof(str), "Hello %s!\nYou are not registered on this server yet.\nso please enter the password in the box\nto register a new account!\n\nRULES:\n-Do not DEATHMATCH!\n-Do not HACK or you will be kicked/banned!\nDo not INSULT admins and other players on the server!", name); ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Rp Registration",str,"Register","Cancel"); } return 1; } SetPlayerTeamFromClass(playerid, classid) { if (classid == 0) { gTeam[playerid] = TEAM_LSPD; } /*else { gTeam[playerid] = TEAM_BALLA; }*/ } public OnPlayerDisconnect(playerid, reason) { new name[MAX_PLAYERS]; new file[128]; GetPlayerName(playerid,name,sizeof name); format(file,sizeof(file),"Accounts/%s.ini",name); if(fexist(file) && AccInfo[playerid][LoggedIn]) { dini_IntSet(file,"Adminlvl",AccInfo[playerid][AdminLevel]); dini_IntSet(file,"Kills",PlayerInfo[playerid][Kills]); dini_IntSet(file,"Deaths",PlayerInfo[playerid][Deaths]); dini_IntSet(file,"Money",GetPlayerMoney(playerid)); dini_IntSet(file,"Score",GetPlayerScore(playerid)); } AccInfo[playerid][LoggedIn] = 0; return 1; } public OnPlayerSpawn(playerid) { SetPlayerToTeamColor(playerid); return 1; } public OnPlayerDeath(playerid, killerid, reason) { PlayerInfo[playerid][Deaths]++; PlayerInfo[killerid][Kills]++; return 1; } public OnVehicleSpawn(vehicleid) { return 1; } public OnVehicleDeath(vehicleid, killerid) { return 1; } public OnPlayerText(playerid, text[]) { return 1; } /*public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp("/mycommand", cmdtext, true, 10) == 0) { // Do something here return 1; } return 0; }*/ // isNumeric /*stock isNumeric(const string[]) { new length=strlen(string); if (length==0) return false; for (new i = 0; i < length; i++) { if ( (string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+') // Not a number,'+' or '-' || (string[i]=='-' && i!=0) // A '-' but not at first. || (string[i]=='+' && i!=0) // A '+' but not at first. ) return false; } if (length==1 && (string[0]=='-' || string[0]=='+')) return false; return true; }*/ public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger) { return 1; } public OnPlayerExitVehicle(playerid, vehicleid) { return 1; } public OnPlayerStateChange(playerid, newstate, oldstate) { return 1; } public OnPlayerEnterCheckpoint(playerid) { return 1; } public OnPlayerLeaveCheckpoint(playerid) { return 1; } public OnPlayerEnterRaceCheckpoint(playerid) { return 1; } public OnPlayerLeaveRaceCheckpoint(playerid) { return 1; } public OnRconCommand(cmd[]) { return 1; } public OnPlayerRequestSpawn(playerid) { return 1; } public OnObjectMoved(objectid) { return 1; } public OnPlayerObjectMoved(playerid, objectid) { return 1; } public OnPlayerPickUpPickup(playerid, pickupid) { return 1; } public OnVehicleMod(playerid, vehicleid, componentid) { return 1; } public OnVehiclePaintjob(playerid, vehicleid, paintjobid) { return 1; } public OnVehicleRespray(playerid, vehicleid, color1, color2) { return 1; } public OnPlayerSelectedMenuRow(playerid, row) { return 1; } public OnPlayerExitedMenu(playerid) { return 1; } public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid) { return 1; } public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { return 1; } public OnRconLoginAttempt(ip[], password[], success) { return 1; } public OnPlayerUpdate(playerid) { return 1; } public OnPlayerStreamIn(playerid, forplayerid) { return 1; } public OnPlayerStreamOut(playerid, forplayerid) { return 1; } public OnVehicleStreamIn(vehicleid, forplayerid) { return 1; } public OnVehicleStreamOut(vehicleid, forplayerid) { return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { new name[MAX_PLAYERS]; new file[128]; new str[256]; GetPlayerName(playerid,name,sizeof name); format(file,sizeof(file),"/Accounts/%s.ini",name); if(dialogid == 1) { if(response == 1) // Login Dialog { if(!strlen(inputtext)) { format(str, sizeof(str), "Welcome back %s!Please type in the correct password!\nEnjoy", name); ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login",str,"Login","Cancel"); return SendClientMessage(playerid,0xAA3333AA,"[System]:Please enter the password!"); } if(strcmp(inputtext,dini_Get(file,"Password")) == 0) { AccInfo[playerid][AdminLevel] = dini_Int(file,"AdminLevel"); AccInfo[playerid][Kicks] = dini_Int(file,"Kicks"); PlayerInfo[playerid][Kills] = dini_Int(file,"Kills"); PlayerInfo[playerid][Deaths] = dini_Int(file,"Deaths"); GivePlayerMoney(playerid,dini_Int(file,"Money")); SetPlayerScore(playerid,dini_Int(file,"Score")); AccInfo[playerid][LoggedIn] = 1; //player is logged in now SendClientMessage(playerid,0x33AA33AA,"[System]:You have been sucessfully logged in."); } if(strcmp(inputtext,dini_Get(file,"Password"))) { format(str, sizeof(str), "Welcome back %s!Please type in the correct password!\nEnjoy", name); ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login",str,"Login","Cancel"); SendClientMessage(playerid,0xAA3333AA,"[System]:You typed wrong password,please enter the correct password!"); } if(response == 0) { SendClientMessage(playerid,0xAA3333AA,"[System]:Bye,bye!"); Kick(playerid); printf("*Player >%s< was kicked by system,Reason:Pressing cancel while logging in account.",name); } } if(dialogid == 2) { if(response == 1) { if(!strlen(inputtext)) { format(str, sizeof(str), "Hello %s!\nYou are not registered on this server yet.\nso please enter the password in the box\nto register a new account!\n\nRULES:\n-Do not DEATHMATCH!\n-Do not HACK or you will be kicked/banned!\nDo not INSULT admins and other players on the server!", name); ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Rp Registration",str,"Register","Cancel"); return SendClientMessage(playerid,0xAA3333AA,"[System]:This password is to short!"); } dini_Create(file); dini_Set(file,"Password",inputtext); AccInfo[playerid][AdminLevel] = 0 ; AccInfo[playerid][LoggedIn] = 1; SendClientMessage(playerid,0x33AA33AA,"[System]:You sussessfuly registered your account!"); printf("*Player >%s< has sussessfuly registered an account",name); } } if(response == 0) { SendClientMessage(playerid,0xAA3333AA,"[System]:Bye,bye!"); Kick(playerid); printf("*Player >%s< was kicked by system,Reason:Pressing cancel while registering account.",name); } } return 1; }
when i delete file with my name now is all wrong it simply ignore all what i made for register/login system with GUI, it dont make file in scriptfile folder it dont send any error message,if i dont type any word in box and press Register/login it wont send any error message,if i press cancel it wont kick me what the fuck ? i cant belive, no errors in script , no warnings,and i don't see any mistake