Ez a szekció lehetővé teszi a felhasználó által írt összes hozzászólás megtekintését. Vedd figyelembe, hogy csak azokba a fórumokba írt hozzászólásokat látod, amelyekhez hozzáférésed van. 541
Beszélgetés / Általános« Dátum: 2012. február 11. - 20:36:49 »>\" post=\"223740\" timestamp=\"1328988322\"] 542
Képek / Videók / Kobra üzen... :\'D« Dátum: 2012. február 11. - 19:04:09 »
Ezt mindíg emlegetjük a suliban
\"Romlik a farhát jógyerek!\" 543
Szkript kérések / Regisztrációs script kellene« Dátum: 2012. február 11. - 18:58:01 »
Nem olyan nehéz mint amilyennek tûnik.
Ezt a mód elejére: [pawn] #include <a_samp> #include <dini> #include <dudb> #include <zcmd> #include <sscanf2> // ezt akkor ha nem szeretnéd a kódot formályát használni! #define SCRIPT_VERSION \"v3\" #define colorRed 0xFF0000FF #define colorGreen 0x008000FF #define DIALOG_REGISTER 1 #define DIALOG_LOGIN 2 #define DIALOG_ACCOUNT 3 #define DIALOG_CHANGEPASS 4 #define DIALOG_CHANGENAME 5 #define DIALOG_VIEWSTATS 6 #define DIALOG_CHECKSTATS 7 #pragma unused ret_memcpy #pragma unused strtok forward UpdateTime(playerid); new str[128]; new file[128]; new playerIP[16]; new Update; [/pawn] A csatlakozás azaz OnPlayerConnect: [pawn] public OnPlayerConnect(playerid) { format(file, 128, \"/tReg/%s.ini\", GetName(playerid)); GetPlayerIp(playerid, playerIP, 16); TogglePlayerSpectating(playerid, 1); if(!dini_Exists(file)) { format(str, 128, \"Welcome %s \\n\\nPlease register your account\", GetName(playerid)); ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, \"Account Management\", str, \"Register\", \"Quit\"); } if(dini_Exists(file)) { if(strcmp(playerIP, dini_Get(file, \"IP\"), true) == 0) { dini_Set(file, \"IP\", playerIP); SetPVarInt(playerid, \"Logged\", 1); SetPlayerCash(playerid, dini_Int(file, \"Money\")); SetPlayerScore(playerid, dini_Int(file, \"Score\")); SetPVarInt(playerid, \"Kills\", dini_Int(file, \"Kills\")); SetPVarInt(playerid, \"Deaths\", dini_Int(file, \"Deaths\")); SetPVarInt(playerid, \"Time\", dini_Int(file, \"Minutes Ingame\")); Update = SetTimerEx(\"UpdateTime\", 60*1000, 1, \"i\", playerid); SendClientMessage(playerid, colorGreen, \"You have been automatically logged in.\"); } else { format(str, 128, \"Welcome %s \\n\\nPlease login to your account\", GetName(playerid)); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, \"Account Management\", str, \"Login\", \"Quit\"); } } return 1; }[/pawn] A lekapcsolódás azaz OnPlayerDisconnect: [pawn] public OnPlayerDisconnect(playerid, reason) { format(file, 128, \"/tReg/%s.ini\", GetName(playerid)); if(GetPVarInt(playerid, \"Logged\") == 1) { dini_IntSet(file, \"Money\", GetPlayerMoney(playerid)); dini_IntSet(file, \"Score\", GetPlayerScore(playerid)); dini_IntSet(file, \"Kills\", GetPVarInt(playerid, \"Kills\")); dini_IntSet(file, \"Deaths\", GetPVarInt(playerid, \"Deaths\")); dini_IntSet(file, \"Minutes Ingame\", GetPVarInt(playerid, \"Time\")); KillTimer(Update); } return 1; } [/pawn] Dialogok: [pawn] public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { format(file, 128, \"/tReg/%s.ini\", GetName(playerid)); if(dialogid == DIALOG_REGISTER) { if(!response) return Kick(playerid); if(response) { if(strlen(inputtext) == 0) { format(str, 128, \"Welcome %s \\n\\nPlease register your account\", GetName(playerid)); ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, \"Account Management\", str, \"Register\", \"Quit\"); return 0; } if(!dini_Exists(file)) { dini_Create(file); dini_IntSet(file, \"Password\", udb_hash(inputtext)); dini_IntSet(file, \"Money\", GetPlayerMoney(playerid)); dini_IntSet(file, \"Score\", GetPlayerScore(playerid)); dini_IntSet(file, \"Kills\", GetPVarInt(playerid, \"Kills\")); dini_IntSet(file, \"Deaths\", GetPVarInt(playerid, \"Deaths\")); dini_IntSet(file, \"Minutes Ingame\", GetPVarInt(playerid, \"Time\")); format(str, 128, \"Account successfully Registered \\n\\n\\nWelcome %s \\n\\nPlease login to your account\", GetName(playerid)); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, \"Account Management\", str, \"Login\", \"Quit\"); } } } if(dialogid == DIALOG_LOGIN) { if(!response) return Kick(playerid); if(response) { if(strlen(inputtext) == 0) { format(str, 128, \"Welcome %s \\n\\nPlease login to your account\", GetName(playerid)); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, \"Account Management\", str, \"Login\", \"Quit\"); return 0; } if(fexist(file)) { new password = dini_Int(file, \"Password\"); if(udb_hash(inputtext) != password) { if(GetPVarInt(playerid, \"Attempts\") == 0) { SetPVarInt(playerid, \"Attempts\", 1); SendClientMessage(playerid, colorRed, \"Incorrect password, You have 1 more attempt\"); format(str, 128, \"Welcome %s \\n\\nPlease login to your account\", GetName(playerid)); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, \"Account Management\", str, \"Login\", \"Quit\"); } else if(GetPVarInt(playerid, \"Attempts\") == 1) { SendClientMessage(playerid, colorRed, \"Incorrect password, You do not have any attempts left\"); Kick(playerid); } } else { SetPVarInt(playerid, \"Logged\", 1); SetPlayerCash(playerid, dini_Int(file, \"Money\")); SetPlayerScore(playerid, dini_Int(file, \"Score\")); SetPVarInt(playerid, \"Kills\", dini_Int(file, \"Kills\")); SetPVarInt(playerid, \"Deaths\", dini_Int(file, \"Deaths\")); SetPVarInt(playerid, \"Time\", dini_Int(file, \"Minutes Ingame\")); GetPlayerIp(playerid, playerIP, 16); dini_Set(file, \"IP\", playerIP); Update = SetTimerEx(\"UpdateTime\", 60*1000, 1, \"i\", playerid); TogglePlayerSpectating(playerid, 0); SendClientMessage(playerid, colorGreen, \"You have successfully logged in.\"); } } } } if(dialogid == DIALOG_CHANGEPASS) { if(response) { if(GetPVarInt(playerid, \"PassStage\") == 1) { new password = dini_Int(file, \"Password\"); if(udb_hash(inputtext) == password) { SetPVarInt(playerid, \"PassStage\", 2); ShowPlayerDialog(playerid, DIALOG_CHANGEPASS, DIALOG_STYLE_INPUT, \"Account Management\", \"Please input your new password\", \"Change Pass\", \"Cancel\"); } else { SendClientMessage(playerid, colorRed, \"Incorrect password.\"); } } else if(GetPVarInt(playerid, \"PassStage\") == 2) { if(GetPVarInt(playerid, \"Logged\") == 1) { dini_IntSet(file, \"Password\", udb_hash(inputtext)); SendClientMessage(playerid, colorGreen, \"Password successfully changed.\"); } } } } if(dialogid == DIALOG_CHANGENAME) { if(response) { if(GetPVarInt(playerid, \"NameStage\") == 1) { new password = dini_Int(file, \"Password\"); if(udb_hash(inputtext) == password) { SetPVarInt(playerid, \"NameStage\", 2); ShowPlayerDialog(playerid, DIALOG_CHANGENAME, DIALOG_STYLE_INPUT, \"Account Management\", \"Please input your new name\", \"Change\", \"Cancel\"); } else { SendClientMessage(playerid, colorRed, \"Incorrect password.\"); } } else if(GetPVarInt(playerid, \"NameStage\") == 2) { format(file, 128, \"/tReg/%s.ini\", inputtext); if(dini_Exists(file)) { SetPVarInt(playerid, \"NameStage\", 2); ShowPlayerDialog(playerid, DIALOG_CHANGENAME, DIALOG_STYLE_INPUT, \"Account Management\", \"A user has already registered with this name \\nIf this is you please reconnect using that account\\n\\nElse please enter your new name\", \"Change\", \"Cancel\"); } else { format(file, 128, \"/tReg/%s.ini\", GetName(playerid)); dini_Remove(file); format(file, 128, \"/tReg/%s.ini\", inputtext); dini_Create(file); dini_IntSet(file, \"Password\", udb_hash(inputtext)); dini_IntSet(file, \"Money\", GetPlayerMoney(playerid)); dini_IntSet(file, \"Score\", GetPlayerScore(playerid)); dini_IntSet(file, \"Kills\", GetPVarInt(playerid, \"Kills\")); dini_IntSet(file, \"Deaths\", GetPVarInt(playerid, \"Deaths\")); dini_IntSet(file, \"Minutes Ingame\", GetPVarInt(playerid, \"Time\")); SetPlayerName(playerid, inputtext); SendClientMessage(playerid, colorGreen, \"Name successfully changed.\"); } } } } return 0; }[/pawn] Szerveren töltött idõ mérése: [pawn] public UpdateTime(playerid) { format(file, 128, \"/tReg/%s.ini\", GetName(playerid)); SetPVarInt(playerid, \"Time\", GetPVarInt(playerid, \"Time\")+1); return 1; } [/pawn] A parancsok: [pawn] CMD:changepass(playerid, params[]) { if(GetPVarInt(playerid, \"Logged\") == 1) { SetPVarInt(playerid, \"PassStage\", 1); ShowPlayerDialog(playerid, DIALOG_CHANGEPASS, DIALOG_STYLE_INPUT, \"Account Management\", \"Please input your current password for verification\", \"Continue\", \"Cancel\"); } return 1; } CMD:changename(playerid, params[]) { if(GetPVarInt(playerid, \"Logged\") == 1) { SetPVarInt(playerid, \"NameStage\", 1); ShowPlayerDialog(playerid, DIALOG_CHANGENAME, DIALOG_STYLE_INPUT, \"Account Management\", \"Please input your password for verification\", \"Continue\", \"Cancel\"); } return 1; } CMD:viewstats(playerid, params[]) { if(GetPVarInt(playerid, \"Logged\") == 1) { new Float:health; GetPlayerHealth(playerid, health); new Float:armour; GetPlayerArmour(playerid, armour); format(str, 128, \"Name: %s\\nHealth: %0.00f\\nArmour: %0.00f\\nMoney: %i\\nScore: %i\\nKills: %i\\nDeaths: %i\", GetName(playerid), health, armour, GetPlayerMoney(playerid), GetPlayerScore(playerid), GetPVarInt(playerid, \"Kills\"), GetPVarInt(playerid, \"Deaths\")); ShowPlayerDialog(playerid, DIALOG_VIEWSTATS, DIALOG_STYLE_MSGBOX, \"Account Management\", str, \"Ok\", \"Cancel\"); } return 1; } CMD:checkstats(playerid, params[]) { new targetid; if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, colorRed, \"You need to be an RCON Admin to use this command.\"); if(sscanf(params, \"u\", targetid)) return SendClientMessage(playerid, colorRed, \"Usage: /checkstats [PlayerID/PartOfName]\"); if(targetid == playerid) return SendClientMessage(playerid, colorRed, \"You are trying to view the stats of you, To do this type: /viewstats\"); if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, colorRed, \"Player not Found\"); if(GetPVarInt(playerid, \"Logged\") == 1) { new Float:health; GetPlayerHealth(targetid, health); new Float:armour; GetPlayerArmour(targetid, armour); format(str, 128, \"Name: %s\\nHealth: %0.00f\\nArmour: %0.00f\\nMoney: %i\\nScore: %i\\nKills: %i\\nDeaths: %i\", GetName(targetid), health, armour, GetPlayerMoney(targetid), GetPlayerScore(targetid), GetPVarInt(targetid, \"Kills\"), GetPVarInt(targetid, \"Deaths\")); ShowPlayerDialog(playerid, DIALOG_VIEWSTATS, DIALOG_STYLE_MSGBOX, \"Account Management\", str, \"Ok\", \"Cancel\"); } return 1; } [/pawn] GetName, SetPlayerCash: [pawn] stock GetName(playerid) { new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof name); return name; } stock SetPlayerCash(playerid, amount) { ResetPlayerMoney(playerid); return GivePlayerMoney(playerid, amount); } [/pawn] sscanf (csak akkor ha nem használod a plugin verzióját): [pawn] stock sscanf(string[], format[], {Float,_}:...) { #if defined isnull if (isnull(string)) #else if (string[0] == 0 || (string[0] == 1 && string[1] == 0)) #endif { return format[0]; } #pragma tabsize 4 new formatPos = 0, stringPos = 0, paramPos = 2, paramCount = numargs(), delim = \' \'; while (string[stringPos] && string[stringPos] <= \' \') { stringPos++; } while (paramPos < paramCount && string[stringPos]) { switch (format[formatPos++]) { case \'\\0\': { return 0; } case \'i\', \'d\': { new neg = 1, num = 0, ch = string[stringPos]; if (ch == \'-\') { neg = -1; ch = string[++stringPos]; } do { stringPos++; if (\'0\' <= ch <= \'9\') { num = (num * 10) + (ch - \'0\'); } else { return -1; } } while ((ch = string[stringPos]) > \' \' && ch != delim); setarg(paramPos, 0, num * neg); } case \'h\', \'x\': { new num = 0, ch = string[stringPos]; do { stringPos++; switch (ch) { case \'x\', \'X\': { num = 0; continue; } case \'0\' .. \'9\': { num = (num << 4) | (ch - \'0\'); } case \'a\' .. \'f\': { num = (num << 4) | (ch - (\'a\' - 10)); } case \'A\' .. \'F\': { num = (num << 4) | (ch - (\'A\' - 10)); } default: { return -1; } } } while ((ch = string[stringPos]) > \' \' && ch != delim); setarg(paramPos, 0, num); } case \'c\': { setarg(paramPos, 0, string[stringPos++]); } case \'f\': { new changestr[16], changepos = 0, strpos = stringPos; while(changepos < 16 && string[strpos] && string[strpos] != delim) { changestr[changepos++] = string[strpos++]; } changestr[changepos] = \'\\0\'; setarg(paramPos,0,_:floatstr(changestr)); } case \'p\': { delim = format[formatPos++]; continue; } case \'\\\'\': { new end = formatPos - 1, ch; while ((ch = format[++end]) && ch != \'\\\'\') {} if (!ch) { return -1; } format[end] = \'\\0\'; if ((ch = strfind(string, format[formatPos], false, stringPos)) == -1) { if (format[end + 1]) { return -1; } return 0; } format[end] = \'\\\'\'; stringPos = ch + (end - formatPos); formatPos = end + 1; } case \'u\': { new end = stringPos - 1, id = 0, bool:num = true, ch; while ((ch = string[++end]) && ch != delim) { if (num) { if (\'0\' <= ch <= \'9\') { id = (id * 10) + (ch - \'0\'); } else { num = false; } } } if (num && IsPlayerConnected(id)) { setarg(paramPos, 0, id); } else { #if !defined foreach #define foreach(%1,%2) for (new %2 = 0; %2 < MAX_PLAYERS; %2++) if (IsPlayerConnected(%2)) #define __SSCANF_FOREACH__ #endif string[end] = \'\\0\'; num = false; new name[MAX_PLAYER_NAME]; id = end - stringPos; foreach (Player, playerid) { GetPlayerName(playerid, name, sizeof (name)); if (!strcmp(name, string[stringPos], true, id)) { setarg(paramPos, 0, playerid); num = true; break; } } if (!num) { setarg(paramPos, 0, INVALID_PLAYER_ID); } string[end] = ch; #if defined __SSCANF_FOREACH__ #undef foreach #undef __SSCANF_FOREACH__ #endif } stringPos = end; } case \'s\', \'z\': { new i = 0, ch; if (format[formatPos]) { while ((ch = string[stringPos++]) && ch != delim) { setarg(paramPos, i++, ch); } if (!i) { return -1; } } else { while ((ch = string[stringPos++])) { setarg(paramPos, i++, ch); } } stringPos--; setarg(paramPos, i, \'\\0\'); } default: { continue; } } while (string[stringPos] && string[stringPos] != delim && string[stringPos] > \' \') { stringPos++; } while (string[stringPos] && (string[stringPos] == delim || string[stringPos] <= \' \')) { stringPos++; } paramPos++; } do { if ((delim = format[formatPos++]) > \' \') { if (delim == \'\\\'\') { while ((delim = format[formatPos++]) && delim != \'\\\'\') {} } else if (delim != \'z\') { return delim; } } } while (delim > \' \'); return 0; } [/pawn] 544
Beszélgetés / Általános« Dátum: 2012. február 11. - 17:38:27 »Idézetet írta: Zotyabuszos date=1328976225\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"1\" data-ipsquote-contentclass=\"forums_Topic
545
RP/RPG kérések / DT mod 0.3d« Dátum: 2012. február 11. - 17:30:48 »Idézetet írta: Erik3333 date=1328976859\" data-ipsquote-contentapp=\"forums\" data-ipsquote-contenttype=\"forums\" data-ipsquote-contentid=\"16900\" data-ipsquote-contentclass=\"forums_Topic Beraksz egy 0.3d-s samp-server.exe-t és kész. (Legalábbis nálam jó)+ nemárt az includékat az újakra (0.3d-re) kicserélni és lecompilezni a módot. 547
Beszélgetés / Írj egy betût, a következõ ír hozzá még egyet. Minél hosszabb legyen a szó.« Dátum: 2012. február 11. - 13:50:15 »
Dagadt Állato
550
Szkript kérések / Regisztrációs script kellene« Dátum: 2012. február 11. - 11:31:08 »
Ez menti a pénzt, pontokat, öléseket, halálozásokat és a szerveren töltött idõt. Link.
551
Fórum Archívum (Témák/Fórumok) / Re:A szerver nem lett magyar« Dátum: 2012. február 11. - 10:02:52 »
Az idézet mellet van egy ilyen: Kattints rá
552
Beszélgetés / Általános« Dátum: 2012. február 11. - 10:01:30 »
Csak az a baj ha hamar elolvad akkor meg árvíz lesz.
553
Segítségkérés / A szerver nem lett magyar« Dátum: 2012. február 11. - 10:00:31 »
Includékat megnézted?
554
Segítségkérés / Benzinkút pickup lerakása« Dátum: 2012. február 11. - 10:00:10 »
Erre a pickupra gondoltál?
Mert ha igen akkor így meglehet oldani: [pawn] public OnGameModeInit() //vagy OnFilterScriptInit() { AddStaticPickup(1239, 1, x, y, z, vw); // vw -1 és akkor minden virtual worldben ott lesz return 1; } public OnPlayerUpdate(playerid) { if(IsPlayerInRangeOfPoint(playerid, r, x, y, z)) // a pickup koordinátái { SendClientMessage(playerid, 0xFFFFFFAA, \"Tankolás . . .\"); SetTimerEx(\"Megtankolva\",10000,0, \"d\", playerid); TogglePlayerControllable(playerid,0); } return 1; } forward Megtankolva(); public Megtankolva() { SendClientMessage(playerid, 0xFFFFFFAA, \"Tele a tank.\"); TogglePlayerControllable(playerid,1); // ide írd azt ami megtankolja az autót. return 1; } [/pawn] |