Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #include <sscanf>
- #include <YSI\y_ini> // includo l'include YSI/y_ini per la gestione dei file di registrazione e login
- #define PATH "Utenza/%s.ini" // definisco la directory dove verra salvato il file ini riguardante il singolo giocatore
- new Loggato[MAX_PLAYERS];
- forward CaricaDatiUtente(playerid,name[],value[]); //forward della funzione CaricaDatiUtente a finchè possa essere ricordata
- enum Utente // definisco un contenitore enum che conterrà le informazione del singolo giocatore
- {
- Password, // contenitore della password
- Soldi, // contenitore dei soldi
- Skin, //contenitore della skin
- Admin // contenitore del livello admin
- }
- new Info[MAX_PLAYERS][Utente];
- // Credits to Dracoblue - la funzione d'immagazzinamento serve per creare una stringra criptata.
- stock udb_hash(buf[])
- {
- new length=strlen(buf);
- new s1 = 1;
- new s2 = 0;
- new n;
- for (n=0; n<length; n++)
- {
- s1 = (s1 + buf[n]) % 65521;
- s2 = (s2 + s1) % 65521;
- }
- return (s2 << 16) + s1;
- }
- public CaricaDatiUtente(playerid,name[],value[])
- {
- INI_Int("Password",Info[playerid][Password]); //INI_Int legge l'intero salvato nel contenitore gPassword,
- INI_Int("Soldi",Info[playerid][Soldi]);
- INI_Int("Skin",Info[playerid][Skin]);
- INI_Int("Admin",Info[playerid][Admin]);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(Loggato[playerid] == 1)
- {
- new INI:File = INI_Open(PathUtente(playerid)); // inizio la scrittura del file ini all'interno della directori utenti
- INI_SetTag(File,"Informazioni Account"); // Do un intestazione al file ini
- INI_WriteInt(File,"Soldi",GetPlayerMoney(playerid)); // Scrivo i soldi del player
- INI_WriteInt(File,"Skin",GetPlayerSkin(playerid)); // Scrivo la skin del player
- INI_WriteInt(File,"Admin",0); //Scrivo il livello di admin
- INI_Close(File);
- }
- return 1;
- }
- CMD:settamod(playerid, params[])
- {
- new Player, NomeG[MAX_PLAYER_NAME], NomeA[MAX_PLAYER_NAME], String[256];
- if(IsPlayerAdmin(playerid) == 0)
- {
- SendClientMessage(playerid, RossoVivace,"[ERRORE]: Bisogna loggare come admin RCON per usare questo comando");
- }
- else
- {
- GetPlayerName(Player, NomeG, sizeof(NomeG));
- GetPlayerName(playerid, NomeA, sizeof(NomeA));
- format(String, sizeof(String), "%s ha settato %s come Admin!", NomeA, NomeG);
- SendClientMessageToAll(Verde, String);
- Info[Player][Admin] = 1;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement