Köszi.
Itt a pénz mentés is:
// DAdmin v0.1
#include <a_samp>
#include <dini>
#include <dudb>
#include <sscanf2>
#include <zcmd>
#define narancs 0xFF9933AA
#define szurke (0xAFAFAFAA)
#define citrom (0xFFFF00AA)
#define piros (0xFF0000AA)
#define zold (0x33AA33AA)
#define feher (0xFFFFFFAA)
#define fekete 0x000000
#define neon 0x00FFFFFF
#define ReGiStEr 8
#define LoGiN 9
#undef MAX_PLAYERS
#define MAX_PLAYERS 30 // SZERÓ FÉRÕHELYEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE ÍRD ÁT!!!!!!!!
enum pInfo
{
Admin,
Olesek,
Halal,
as,
ban,
warn,
}
new Info[MAX_PLAYERS][pInfo];
new IsLogged[MAX_PLAYERS];
new string[128];
new nev[MAX_PLAYER_NAME];
new nev2[MAX_PLAYER_NAME];
new szinek[25] = {
0xFF0000FF, 0xFF2C00FF, 0xFF5000FF, 0xFF8700FF, 0xFFA700FF,
0xFFDC00FF, 0xFFFB00FF, 0xC4FF00FF, 0x7BFF00FF, 0x00FF00FF,
0x00FF1EFF, 0x00FF3BFF, 0x00FF7CFF, 0x00FFAEFF, 0x00FFD5FF,
0x00FFFFFF, 0x00CCFFFF, 0x00ACFFFF, 0x0083FFFF, 0x0054FFFF,
0x0000FFFF, 0x2C00FFFF, 0x5F00FFFF, 0x9B00FFFF, 0xCB00FFFF
};
new aduty[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
IsLogged[playerid] = 0;
new file[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),\"/user/%s.ini\",name);
if(!fexist(file))
{
format(string, sizeof string, \"Írj be egy jelszót:\");
ShowPlayerDialog(playerid, ReGiStEr, DIALOG_STYLE_INPUT, \"Regisztráció\", string, \"Regisztráció\", \"Mégse.\");
}
if(fexist(file))
{
format(string, sizeof string, \"Írd be a jelszavad:\");
ShowPlayerDialog(playerid, LoGiN, DIALOG_STYLE_INPUT, \"Bejelentkezés\", string, \"Belépés\", \"Mégse.\");
}
Info[playerid][as] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(IsLogged[playerid] == 1)
{
new file[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),\"/user/%s.ini\",name);
if(fexist(file))
{
dini_IntSet(file,\"Admin\", Info[playerid][Admin]);
dini_IntSet(file,\"Olesek\", Info[playerid][Olesek]);
dini_IntSet(file,\"Halal\", Info[playerid][Halal]);
dini_IntSet(file,\"ban\", Info[playerid][ban]);
dini_IntSet(file,\"warn\", Info[playerid][warn]);
dini_IntSet(file,\"penz\", GetPlayerMoney(playerid));
}
IsLogged[playerid] = 0;
}
return 1;
}
public OnPlayerText(playerid, text[])
{
if(Info[playerid][Admin] >= 1)
{
GetPlayerName(playerid, nev, sizeof(nev));
format(string, 128, \"Admin %s: %s\",nev, text);
SendClientMessageToAll(citrom, string);
return 0;
}
else if(Info[playerid][Admin] == 0 && Info[playerid][as] == 0)
{
GetPlayerName(playerid, nev, sizeof(nev));
format(string, 128, \"%s: %s\",nev, text);
SendClientMessageToAll(GetPlayerColor(playerid), string);
return 0;
}
else if(Info[playerid][as] == 1)
{
GetPlayerName(playerid, nev, sizeof(nev));
format(string, 128, \"Adminsegéd %s: %s\",nev, text);
SendClientMessageToAll(citrom, string);
return 0;
}
else if(Info[playerid][as] == 2)
{
GetPlayerName(playerid, nev, sizeof(nev));
format(string, 128, \"Haladó adminsegéd %s: %s\",nev, text);
SendClientMessageToAll(citrom, string);
return 0;
}
return 0;
}
public OnPlayerSpawn(playerid)
{
new randszin = random(sizeof(szinek));
SetPlayerColor(playerid, szinek[randszin]);
SetPlayerScore(playerid, Info[playerid][Olesek]);
return 1;
}
public OnPlayerUpdate(playerid)
{
if(aduty[playerid] == 1)
{
SetPlayerChatBubble(playerid, \"Admin szolgálatban\", neon, 20, 1200);
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == ReGiStEr)
{
if(response)
{
new file[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(strlen(inputtext) == 0)
{
format(string, sizeof string, \"Írj be egy jelszót:\");
ShowPlayerDialog(playerid, ReGiStEr, DIALOG_STYLE_INPUT, \"Regisztráció\", string, \"Regisztráció\", \"Mégse.\");
return 0;
}
format(file,sizeof(file),\"/user/%s.ini\",name);
if(!fexist(file))
{
dini_Create(file);
dini_IntSet(file,\"Password\", udb_hash(inputtext));
dini_IntSet(file,\"Admin\", 0);
dini_IntSet(file,\"Olesek\", 0);
dini_IntSet(file,\"Halal\", 0);
dini_IntSet(file,\"ban\", 0);
dini_IntSet(file,\"warn\", 0);
dini_IntSet(file,\"penz\", 0);
format(string, sizeof string, \"Írd be a jelszavad:\");
ShowPlayerDialog(playerid, LoGiN, DIALOG_STYLE_INPUT, \"Bejelentkezés\", string, \"Belép\", \"Mégse.\");
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
GetPlayerName(playerid, name, sizeof(name));
printf(\"%s sikeresen regisztrált!\", name);
}
}
}
if(dialogid == LoGiN)
{
if(response)
{
new file[128];
new PlayerName[24];
if(strlen(inputtext) == 0)
{
GetPlayerName(playerid, PlayerName, sizeof PlayerName);
format(string, sizeof string, \"Írd be a jelszavad:\", PlayerName);
ShowPlayerDialog(playerid, LoGiN, DIALOG_STYLE_INPUT, \"Bejelentkezés\", string, \"Belép\", \"Mégse.\");
return 0;
}
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),\"/user/%s.ini\",name);
if(fexist(file))
{
new password = dini_Int(file, \"Password\");
if(udb_hash(inputtext) != password)
{
SendClientMessage(playerid, piros, \"A jelszó hibás.\");
Kick(playerid);
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
printf(\"%s Nem tudott bejelentkezni!\", name);
}
else
{
IsLogged[playerid] = 1;
Info[playerid][Admin] = dini_Int(file,\"Admin\");
Info[playerid][Olesek] = dini_Int(file,\"Olesek\");
Info[playerid][Halal] = dini_Int(file,\"Halal\");
Info[playerid][ban] = dini_Int(file,\"ban\");
Info[playerid][warn] = dini_Int(file,\"warn\");
SetPlayerMoney(playerid,dini_Int(file,\"penz\"));
SendClientMessage(playerid, zold, \"Sikeres bejelentkezés.\");
SpawnPlayer(playerid);
if(Info[playerid][ban] == 1)
{
SendClientMessage(playerid, neon, \"Bannolva vagy! Kérj unbant a honlapunkon!\");
Ban(playerid);
}
TogglePlayerSpectating(playerid, 0);
}
}
}
}
return 1;
}
CMD:adadmin(playerid, params[])
{
if(IsPlayerAdmin(playerid) || Info[playerid][Admin] == 4)
{
new id;
new szint;
if(sscanf(params,\"ud\",id, szint)) return SendClientMessage(playerid,feher,\"Használat: /adadmin [id][szint 1-3]\");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, szurke, \"Nincs ilyen ID!\");
GetPlayerName(playerid, nev, sizeof(nev));
GetPlayerName(id, nev2, sizeof(nev2));
format(string, sizeof(string), \"%s felkért téged %d szintû adminnak.\", nev, szint);
SendClientMessage(id, neon, string);
format(string, sizeof(string), \"Felkérted %s-t %d szintû adminnak.\", nev2, szint);
SendClientMessage(playerid, piros, string);
Info[id][Admin] = szint;
} else { SendClientMessage(playerid, szurke, \"Nem vagy négyes szintû admin.\"); return 1; }
return 1;
}
CMD:a(playerid, params[])
{
if(Info[playerid][Admin] >= 1 || IsPlayerAdmin(playerid))
{
new szoveg[128];
if(sscanf(params,\"s[128]\",szoveg)) return SendClientMessage(playerid,feher,\"Használat: /a [szöveg]\");
GetPlayerName(playerid, nev, sizeof(nev));
format(string, sizeof(string), \"AdminChat: %s(%d): %s\", nev, Info[playerid][Admin], szoveg);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(Info[Admin] >= 1 || IsPlayerAdmin(i))
{
SendClientMessage(i, zold, string);
}
}
} else { SendClientMessage(playerid, szurke, \"Nem vagy egyes szintû admin.\"); return 1; }
return 1;
}
CMD:stats(playerid, params[])
{
GetPlayerName(playerid, nev, sizeof(nev));
format(string, 128, \"Név: %s, Ölések: %s, Halálok: %s, Adminszint: %d. Figyelmeztetések: %d.\",nev, Info[playerid][Olesek], Info[playerid][Halal], Info[playerid][Admin], Info[playerid][warn]);
SendClientMessage(playerid, szurke, string);
return 1;
}
CMD:adminok(playerid, params[])
{
SendClientMessage(playerid, feher, \"Elérhetõ adminisztrátorok:\");
for(new i=0; i<MAX_PLAYERS; i++)
{
if(Info[Admin] == 1)
{
GetPlayerName(i, nev, sizeof(nev));
format(string, 128, \"Admin %s | Rang: Kezdõ admin\", nev);
SendClientMessage(playerid, citrom, string);
}
if(Info[Admin] == 2)
{
GetPlayerName(i, nev, sizeof(nev));
format(string, 128, \"Admin %s | Rang: Haladó admin\", nev);
SendClientMessage(playerid, citrom, string);
}
if(Info[Admin] == 3)
{
GetPlayerName(i, nev, sizeof(nev));
format(string, 128, \"Admin %s | Rang: Fõadmin\", nev);
SendClientMessage(playerid, citrom, string);
}
if(Info[Admin] == 4)
{
GetPlayerName(i, nev, sizeof(nev));
format(string, 128, \"Admin %s | Rang: Tulajdonos\", nev);
SendClientMessage(playerid, citrom, string);
}
}
SendClientMessage(playerid, feher, \"Elérhetõ adminisztrátor segédek:\");
for(new i=0; i<MAX_PLAYERS; i++)
{
if(Info[as] == 1)
{
GetPlayerName(i, nev, sizeof(nev));
format(string, 128, \"Adminsegéd %s\", nev);
SendClientMessage(playerid, citrom, string);
}
if(Info[as] == 2)
{
GetPlayerName(i, nev, sizeof(nev));
format(string, 128, \"Adminsegéd %s | Rang: Haladó adminsegéd\", nev);
SendClientMessage(playerid, citrom, string);
}
}
return 1;
}
CMD:as(playerid, params[])
{
if(Info[playerid][Admin] >= 1)
{
new id;
if(sscanf(params,\"u\",id)) return SendClientMessage(playerid,feher,\"Használat: /as [id]\");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, szurke, \"Nincs ilyen ID!\");
SendClientMessage(playerid, feher, \"Kinevezted adminsegédnek.\");
SendClientMessage(id, feher, \"Egy adminisztrátor kinevezett téged adminsegédnek.\");
Info[id][as] = 1;
return 1;
} else { SendClientMessage(playerid, szurke, \"Nem vagy egyes szintû admin.\"); return 1; }
}
CMD:as2(playerid, params[])
{
if(Info[playerid][Admin] >= 2)
{
new id;
if(sscanf(params,\"u\",id)) return SendClientMessage(playerid,feher,\"Használat: /as2 [id]\");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, szurke, \"Nincs ilyen ID!\");
SendClientMessage(playerid, feher, \"Kinevezted haladó adminsegédnek.\");
SendClientMessage(id, feher, \"Egy adminisztrátor kinevezett téged haladó adminsegédnek.\");
Info[id][as] = 2;
} else { SendClientMessage(playerid, szurke, \"Nem vagy kettes szintû admin.\"); return 1; }
return 1;
}
CMD:asel(playerid, params[])
{
if(Info[playerid][Admin] >= 1)
{
new id;
if(sscanf(params,\"u\",id)) return SendClientMessage(playerid,feher,\"Használat: /asel [id]\");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, szurke, \"Nincs ilyen ID!\");
SendClientMessage(playerid, feher, \"Elvetted az adminsegéd jogát.\");
SendClientMessage(id, feher, \"Egy adminisztrátor elvette az adminsegéd rangodat.\");
Info[id][as] = 0;
} else { SendClientMessage(playerid, szurke, \"Nem vagy egyes szintû admin.\"); return 1; }
return 1;
}
CMD:kick(playerid, params[])
{
if(Info[playerid][Admin] >= 1 || Info[playerid][as] == 2)
{
new id;
new indok[64];
if(sscanf(params,\"us[64]\",id,indok)) return SendClientMessage(playerid,feher,\"Használat: /kick [id][indok]\");
GetPlayerName(playerid, nev, sizeof(nev));
GetPlayerName(playerid, nev2, sizeof(nev2));
format(string, 128, \"-= %s ki lett rúgva %s által. |=| Indoklás: %s =-\", nev2, nev, indok);
SendClientMessageToAll(piros, string);
Kick(id);
return 1;
} else { SendClientMessage(playerid, szurke, \"Nem vagy egyes szintû admin, vagy haladó adminsegéd.\"); return 1; }
}
CMD:ban(playerid, params[])
{
if(Info[playerid][Admin] >= 1)
{
new id;
new indok[64];
if(sscanf(params,\"us[54]\",id,indok)) return SendClientMessage(playerid,feher,\"Használat: /ban [id][indok]\");
GetPlayerName(playerid, nev, sizeof(nev));
GetPlayerName(playerid, nev2, sizeof(nev2));
Info[id][ban] = 1;
format(string, 128, \"-= %s ki lett tiltva %s által. |=| Indoklás: %s =-\", nev2, nev, indok);
SendClientMessageToAll(piros, string);
Ban(id);
return 1;
} else { SendClientMessage(playerid, szurke, \"Nem vagy egyes szintû admin.\"); return 1; }
}
CMD:aszolgalat(playerid,params[])
{
if(Info[playerid][Admin] >= 1)
{
if(aduty[playerid] == 0)
{
SendClientMessage(playerid, feher, \"Adminszolgálat bekapcsolva.\");
aduty[playerid] = 1;
GetPlayerName(playerid, nev, sizeof(nev));
format(string, 128, \"-= %s adminszolgálatba állt. =-\", nev);
SendClientMessageToAll(neon, string);
SetPlayerSkin(playerid, 217);
return 1;
}
if(aduty[playerid] == 1)
{
SendClientMessage(playerid, feher, \"Adminszolgálat kikapcsolva.\");
aduty[playerid] = 0;
GetPlayerName(playerid, nev, sizeof(nev));
format(string, 128, \"-= %s kilépett az adminszolgálatból. =-\", nev);
SendClientMessageToAll(neon, string);
return 1;
}
} else { SendClientMessage(playerid, szurke, \"Nem vagy admin.\"); return 1; }
return 1;
}
CMD:warn(playerid, params[])
{
if(Info[playerid][Admin] >= 1)
{
new id;
new indok[64];
if(sscanf(params,\"us[64]\",id,indok)) return SendClientMessage(playerid,feher,\"Használat: /warn [id][indok]\");
GetPlayerName(playerid, nev, sizeof(nev));
GetPlayerName(id, nev2, sizeof(nev2));
format(string, 128, \"-= %s figyelmeztetve lett %s által. |=| Indoklás: %s =-\", nev2, nev, indok);
SendClientMessageToAll(piros, string);
format(string, 128, \"Warnjaid: %d\", Info[id][warn]);
SendClientMessage(id, piros, string);
Info[id][warn] ++;
if(Info[id][warn] == 5)
{
SendClientMessage(id, piros, \"Meglett az öt figyelmeztetés. Bannolva lettél.\");
Info[id][ban] = 1;
Ban(id);
}
return 1;
} else { SendClientMessage(playerid, szurke, \"Nem vagy admin\"); return 1; }
}
CMD:goto(playerid, params[])
{
if(Info[playerid][Admin] >= 1 || Info[playerid][as] == 2)
{
new id;
if(sscanf(params,\"us]\",id)) return SendClientMessage(playerid,feher,\"Használat: /goto [id]\");
new Float: X, Float: Y, Float: Z;
GetPlayerPos(id, X, Y, Z);
SetPlayerPos(playerid, X+2, Y, Z);
return 1;
} else { SendClientMessage(playerid, szurke, \"Nem vagy admin\"); return 1; }
}
CMD:get(playerid, params[])
{
if(Info[playerid][Admin] >= 1)
{
new id;
if(sscanf(params,\"us]\",id)) return SendClientMessage(playerid,feher,\"Használat: /get [id]\");
new Float: X, Float: Y, Float: Z;
GetPlayerPos(playerid, X, Y, Z);
SetPlayerPos(id, X+2, Y, Z);
return 1;
} else { SendClientMessage(playerid, szurke, \"Nem vagy admin\"); return 1; }
}