Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <sscanf2>
- #include <zcmd>
- #include <YSI\y_ini>
- #include <gl_common>
- #define rosso 0xff0000ff
- #define blu 0x0000ffff
- #define verde 0x00ff00ff
- #define verdescuro 0x009500ff
- #define rossoscuro 0xa00000ff
- #define bluscuro 0x0000a0ff
- #define nero 0x000000ff
- #define bianco 0xffffffff
- #define giallo 0xffff00ff
- #define arancione 0xffb100ff
- #define viola 0x974598ff
- #define azzurro 0x97c7ffff
- #define verdeacqua 0x00ffffff
- #define fuxia 0x90559bff
- #define marrone 0x905500ff
- #define rosachiaro 0xff92cc59
- #define rosascuro 0xff92ccff
- #define msg_rosso "{ff0000}"
- #define msg_blu "{0096ff}"
- #define msg_verde "{00a600}"
- #define msg_verdescuro "{009500}"
- #define msg_rossoscuro "{a00000}"
- #define msg_bluscuro "{0000a0}"
- #define msg_nero "{000000}"
- #define msg_bianco "{ffffff}"
- #define msg_giallo "{ffff00}"
- #define msg_arancione "{ffb100}"
- #define msg_viola "{974598}"
- #define msg_azzurro "{97c7ff}"
- #define msg_verdeacqua "{00ffff}"
- #define msg_fuxia "{90559b}"
- #define msg_marrone "{905500}"
- #define msg_rosachiaro "{ff92cc}"
- #define msg_rosascuro "{ff92cc}"
- #define msg_dialog "{e6e6e6}"
- #define Server_Name "Freeroam"
- #define Format_Account(%0) format(PLAYER_INFO[%0][ACCOUNT], 128, "Utenti/%s.ini", PLAYER_INFO[%0][NAME])
- #define MENU_REGISTER 1
- #define MENU_LOGIN 2
- #define MAX_TENTATIVI_LOGIN 3
- enum E_PLAYER
- {
- ADMIN,
- ACCOUNT[128],
- NAME[24],
- PASSWORD[20],
- SCORE,
- MONEY,
- LAST_LOGIN[24]
- };
- new
- PLAYER_INFO[MAX_PLAYERS][E_PLAYER],
- mess[128]
- ;
- main()
- {
- print("\n----------------------------------");
- print(" Blank Gamemode by your name here");
- print("----------------------------------\n");
- }
- public OnGameModeInit()
- {
- // Don't use these lines if it's a filterscript
- SetGameModeText("FreeRoam");
- 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)
- {
- 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;
- }
- public OnPlayerConnect(playerid)
- {
- GetPlayerName(playerid, PLAYER_INFO[playerid][NAME], 24);
- Format_Account(playerid);
- INI_ParseFile(PLAYER_INFO[playerid][ACCOUNT], "INI_Parse_Player_Last_Login", .bExtra = true, .extra = playerid);
- if(!fexist(PLAYER_INFO[playerid][ACCOUNT]))
- {
- format(mess, 128, ""msg_dialog"Benvenuto su "Server_Name", "msg_blu"%s"msg_dialog".\nDigita una Password per la "msg_verde"Registrazione"msg_dialog".", PLAYER_INFO[playerid][NAME]);
- ShowPlayerDialog(playerid, MENU_REGISTER, DIALOG_STYLE_INPUT, ""msg_verde"Registrazione", mess, "Conferma", "Annulla");
- format(mess, 128, "Ciao "msg_blu"%s"msg_bianco", benvenuto su "msg_verde""Server_Name""msg_bianco".", PLAYER_INFO[playerid][NAME]);
- SendClientMessage(playerid, -1, mess);
- SendClientMessage(playerid, -1, "Il tuo Account non risulta Registrato. Esegui la "msg_verde"Registrazione "msg_bianco"per cominciare a giocare.");
- }
- else
- {
- format(mess, 128, ""msg_dialog"Benvenuto su "Server_Name", "msg_blu"%s"msg_dialog".\nDigita una Password per il "msg_verde"Login"msg_dialog".", PLAYER_INFO[playerid][NAME]);
- ShowPlayerDialog(playerid, MENU_LOGIN, DIALOG_STYLE_INPUT, ""msg_verde"Login", mess, "Conferma", "Annulla");
- format(mess, 128, "Ciao "msg_blu"%s"msg_bianco", benvenuto su "msg_verde""Server_Name""msg_bianco".", PLAYER_INFO[playerid][NAME]);
- SendClientMessage(playerid, -1, mess);
- format(mess, 128, "Il tuo ultimo Login risale al: "msg_verde"%s"msg_bianco".", PLAYER_INFO[playerid][LAST_LOGIN]);
- SendClientMessage(playerid, -1, mess);
- }
- SetPVarInt(playerid, "Tentativi_Last_Login", MAX_TENTATIVI_LOGIN);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- CMD:setadmin(playerid, params[])
- {
- if(!IsPlayerAdmin(playerid))
- {
- SendErrorMessage(playerid, "Non puoi utilizzare questo comando.");
- return 1;
- }
- new
- pid,
- level
- ;
- if(sscanf(params, "ri", pid, level))
- {
- SendUseMessage(playerid, "/setadmin <playerid/nome> <livello>");
- return 1;
- }
- return 1;
- }
- 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[])
- {
- switch(dialogid)
- {
- case MENU_REGISTER:
- {
- if(response)
- {
- if(strlen(inputtext) == 0)
- {
- format(mess, 128, ""msg_dialog"Benvenuto su "Server_Name", "msg_blu"%s"msg_dialog".\nDigita una Password per la "msg_verde"Registrazione"msg_dialog".", PLAYER_INFO[playerid][NAME]);
- ShowPlayerDialog(playerid, MENU_REGISTER, DIALOG_STYLE_INPUT, ""msg_verde"Registrazione", mess, "Conferma", "Annulla");
- SendErrorMessage(playerid, "Devi inserire una Password.");
- return 1;
- }
- if(strlen(inputtext) < 3)
- {
- format(mess, 128, ""msg_dialog"Benvenuto su "Server_Name", "msg_blu"%s"msg_dialog".\nDigita una Password per la "msg_verde"Registrazione"msg_dialog".", PLAYER_INFO[playerid][NAME]);
- ShowPlayerDialog(playerid, MENU_REGISTER, DIALOG_STYLE_INPUT, ""msg_verde"Registrazione", mess, "Conferma", "Annulla");
- SendErrorMessage(playerid, "Inserisci più di 3 caratteri.");
- return 1;
- }
- if(strlen(inputtext) > 20)
- {
- format(mess, 128, ""msg_dialog"Benvenuto su "Server_Name", "msg_blu"%s"msg_dialog".\nDigita una Password per la "msg_verde"Registrazione"msg_dialog".", PLAYER_INFO[playerid][NAME]);
- ShowPlayerDialog(playerid, MENU_REGISTER, DIALOG_STYLE_INPUT, ""msg_verde"Registrazione", mess, "Conferma", "Annulla");
- SendErrorMessage(playerid, "Puoi inserire massimo 20 caratteri.");
- return 1;
- }
- new
- year,
- month,
- day,
- hour,
- minuts,
- seconds,
- ip[24]
- ;
- getdate(year, month, day);
- gettime(hour, minuts, seconds);
- GetPlayerIp(playerid, ip, sizeof(ip));
- format(mess, 128, "%d/%d/%d - %02d:%02d:%02d", day, month, year, hour, minuts, seconds);
- new
- INI: account = INI_Open(PLAYER_INFO[playerid][ACCOUNT])
- ;
- INI_WriteString(account, "Password", inputtext);
- INI_WriteInt(account, "Admin", 0);
- INI_WriteString(account, "Data_Registrazione", mess);
- INI_WriteString(account, "Ultimo_Login", mess);
- INI_WriteString(account, "IP_Registrazione", ip);
- INI_WriteString(account, "Ultimo_IP", ip);
- INI_WriteInt(account, "Soldi", 0);
- INI_WriteInt(account, "Punti", 0);
- INI_Close(account);
- format(PLAYER_INFO[playerid][PASSWORD], 20, inputtext);
- format(mess, 128, ""msg_dialog"Benvenuto su "Server_Name", "msg_blu"%s"msg_dialog".\nDigita una Password per il "msg_verde"Login"msg_dialog".", PLAYER_INFO[playerid][NAME]);
- ShowPlayerDialog(playerid, MENU_LOGIN, DIALOG_STYLE_INPUT, ""msg_verde"Login", mess, "Conferma", "Annulla");
- }
- else
- {
- SendErrorMessage(playerid, "Registrazione obbligatoria. Sei stato Kickato.");
- Kick(playerid);
- }
- }
- case MENU_LOGIN:
- {
- if(response)
- {
- if(strlen(inputtext) == 0)
- {
- format(mess, 128, ""msg_dialog"Benvenuto su "Server_Name", "msg_blu"%s"msg_dialog".\nDigita una Password per il "msg_verde"Login"msg_dialog".", PLAYER_INFO[playerid][NAME]);
- ShowPlayerDialog(playerid, MENU_LOGIN, DIALOG_STYLE_INPUT, ""msg_verde"Login", mess, "Conferma", "Annulla");
- SendErrorMessage(playerid, "Devi inserire una Password.");
- return 1;
- }
- if(strlen(inputtext) < 3)
- {
- format(mess, 128, ""msg_dialog"Benvenuto su "Server_Name", "msg_blu"%s"msg_dialog".\nDigita una Password per il "msg_verde"Login"msg_dialog".", PLAYER_INFO[playerid][NAME]);
- ShowPlayerDialog(playerid, MENU_LOGIN, DIALOG_STYLE_INPUT, ""msg_verde"Login", mess, "Conferma", "Annulla");
- SendErrorMessage(playerid, "Inserisci più di 3 caratteri.");
- return 1;
- }
- if(strlen(inputtext) > 20)
- {
- format(mess, 128, ""msg_dialog"Benvenuto su "Server_Name", "msg_blu"%s"msg_dialog".\nDigita una Password per il "msg_verde"Login"msg_dialog".", PLAYER_INFO[playerid][NAME]);
- ShowPlayerDialog(playerid, MENU_LOGIN, DIALOG_STYLE_INPUT, ""msg_verde"Login", mess, "Conferma", "Annulla");
- SendErrorMessage(playerid, "Puoi inserire massimo 20 caratteri.");
- return 1;
- }
- INI_ParseFile(PLAYER_INFO[playerid][ACCOUNT], "INI_Parse_Player_Password", .bExtra = true, .extra = playerid);
- Format_Account(playerid);
- if(strcmp(PLAYER_INFO[playerid][PASSWORD], inputtext, false) != 0)
- {
- SetPVarInt(playerid, "Tentativi_Last_Login", GetPVarInt(playerid, "Tentativi_Last_Login") - 1);
- if(GetPVarInt(playerid, "Tentativi_Last_Login") == 0)
- {
- SendErrorMessage(playerid, "Hai sprecato tutti i tentativi a disposizione.");
- return Kick(playerid);
- }
- format(mess, 128, ""msg_dialog"Benvenuto su "Server_Name", "msg_blu"%s"msg_dialog".\nDigita una Password per il "msg_verde"Login"msg_dialog".", PLAYER_INFO[playerid][NAME]);
- ShowPlayerDialog(playerid, MENU_LOGIN, DIALOG_STYLE_INPUT, ""msg_verde"Login", mess, "Conferma", "Annulla");
- format(mess, 128, "Password errata. Ti rimangono "msg_rosso"%d "msg_bianco"tentativi.", GetPVarInt(playerid, "Tentativi_Last_Login"));
- SendErrorMessage(playerid, mess);
- return 1;
- }
- new
- ip[24],
- year,
- month,
- day,
- hour,
- minuts,
- seconds
- ;
- GetPlayerIp(playerid, ip, 24);
- gettime(hour, minuts, seconds);
- getdate(year, month, day);
- format(mess, 128, "%d/%d/%d - %02d:%02d:%02d", day, month, year, hour, minuts, seconds);
- new
- INI: account = INI_Open(PLAYER_INFO[playerid][ACCOUNT])
- ;
- INI_WriteString(account, "Ultimo_Login", mess);
- INI_WriteString(account, "Ultimo_IP", ip);
- INI_Close(account);
- LoadData(playerid);
- SetTimerEx("Spawn_Player", 55, false, "d", playerid);
- }
- else
- {
- SendErrorMessage(playerid, "Login obbligatorio. Sei stato Kickato.");
- Kick(playerid);
- }
- }
- }
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- public Spawn_Player(playerid)
- {
- SpawnPlayer(playerid);
- SetCameraBehindPlayer(playerid);
- return 1;
- }
- /*__________[PUBLICS]__________*/
- public INI_Parse_Player_Password(playerid, name[], value[])
- {
- INI_String("Password", PLAYER_INFO[playerid][PASSWORD], 20);
- return 1;
- }
- public INI_Parse_Player_Account(playerid, name[], value[])
- {
- INI_Int("Admin", PLAYER_INFO[playerid][ADMIN]);
- INI_Int("Score", PLAYER_INFO[playerid][SCORE]);
- INI_Int("Money", PLAYER_INFO[playerid][MONEY]);
- return 1;
- }
- public INI_Parse_Player_Last_Login(playerid, name[], value[])
- {
- INI_String("Ultimo_Login", PLAYER_INFO[playerid][LAST_LOGIN], 24);
- return 1;
- }
- /*__________[STOCKS]__________*/
- stock SendInfoMessage(playerid, const messaggio[])
- {
- PlayerPlaySound(playerid, 1054, 0.0, 0.0, 0.0);
- format(mess, 128, "{FF9900}INFO{FFFFFF}: %s", messaggio);
- SendClientMessage(playerid, -1, mess);
- return 1;
- }
- stock SendErrorMessage(playerid, const messaggio[])
- {
- PlayerPlaySound(playerid, 1055, 0.0, 0.0, 0.0);
- format(mess, 128, "{FF0000}ERRORE{FFFFFF}: %s", messaggio);
- SendClientMessage(playerid, -1, mess);
- return 1;
- }
- stock SendUseMessage(playerid, const messaggio[])
- {
- PlayerPlaySound(playerid, 1054, 0.0, 0.0, 0.0);
- format(mess, 128, ""msg_blu"USO"msg_bianco": %s", messaggio);
- SendClientMessage(playerid, -1, mess);
- return 1;
- }
- stock LoadData(playerid)
- {
- SetPlayerScore(playerid, PLAYER_INFO[playerid][SCORE]);
- GivePlayerMoney(playerid, PLAYER_INFO[playerid][MONEY]);
- return 1;
- }
- /*__________[FORWARDS]__________*/
- forward INI_Parse_Player_Password(playerid, name[], value[]);
- forward INI_Parse_Player_Account(playerid, name[], value[]);
- forward INI_Parse_Player_Last_Login(playerid, name[], value[]);
- forward Spawn_Player(playerid);
Add Comment
Please, Sign In to add comment