Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <YSI\y_ini>
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" ------------ Balkan Skyline RP -------");
- print("--------------------------------------\n");
- return 1;
- }
- public OnGameModeInit()
- {
- SetGameModeText("BSRP by Dino");
- }
- /***************************************************************************/
- //=========================Login & Register system by Dino==============================
- #define REGISTRACIJA 01
- #define LOGIN 02
- #define UserPath "Users/%s.ini"
- #define Password
- native WP_Hash(buffer[],len,const str[]);
- enum PlayerInfo
- {
- Lozinka[129],
- Adminlevel,
- VIPlevel,
- Novac,
- Level,
- Ubojstva,
- Poginuca,
- }
- new pInfo[MAX_PLAYERS][PlayerInfo];
- stock Path(playerid)
- {
- new str[128],name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- format(str,sizeof(str),UserPath,name);
- return str;
- }
- forward loadaccount_user(playerid, name[], value[]);
- public loadaccount_user(playerid, name[], value[])
- {
- INI_String("Password",pInfo[playerid][Password],[129]);
- INI_Int("AdminLevel",pInfo[playerid][Adminlevel]);
- INI_Int("VIPLevel",pInfo[playerid][VIPlevel]);
- INI_Int("Money",pInfo[playerid][Money]);
- INI_Int("Scores",pInfo[playerid][Scores]);
- INI_Int("Ubojstva",pInfo[playerid][Kills]);
- INI_Int("Poginuća",pInfo[playerid][Deaths]);
- return 1;
- }
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Login and Register system by Dino");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #endif
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 816.47693, -1343.97681, 13.52600);
- SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
- SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- if(fexist(Path(playerid)))
- {
- INI_ParseFile(Path(playerid),"loadaccount_user", .bExtra = true, .extra = playerid);
- ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","Dobrodosli natrag. Vas account je registriran. \nUnesite lozinku kako bi ste se prijavili","Login","Izlaz");
- }
- else
- {
- ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Registracija","Dobrodosao/la! Ovaj account nije registriran.\nUpisite lozinku kako bi ste se registrirali.","Registracija","Izlaz");
- return 1;
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(fexist(Path(playerid)))
- {
- new INI:file = INI_Open(Path(playerid));
- INI_SetTag(file,"Player's Data");
- INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]);
- INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);/
- INI_WriteInt(file,"Money",GetPlayerMoney(playerid));
- INI_WriteInt(file,"Scores",GetPlayerScore(playerid));
- INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);
- INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);
- INI_Close(file);
- return 1;
- }
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- SetPlayerMoney(playerid, 10000);
- SetPlayerScore(playerid, 3);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- pInfo[killerid][Kills]++;
- pInfo[playerid][Deaths]++;
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- CreateObject
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/stats", cmdtext, true, 10) == 0)
- {
- return 1;
- }
- return 0;
- }
- 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[])
- {
- if(dialogid == dregister)
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- if(!strlen(inputtext)) /
- {
- ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Registracija","Welcomet! Ovaj account nije registriran.\nUnesite lozinku za daljnju registraciju.\nMolimo unesite lozinku!","Registracija","Izlaz");
- return 1;
- }
- new hashpass[129];
- WP_Hash(hashpass,sizeof(hashpass),inputtext);
- new INI:file = INI_Open(Path(playerid));
- INI_SetTag(file,"Player's Data");
- INI_WriteString(file,"Password",hashpass);
- INI_WriteInt(file,"AdminLevel",0);
- INI_WriteInt(file,"VIPLevel",0);
- INI_WriteInt(file,"Money",0);
- INI_WriteInt(file,"Scores",0);
- INI_WriteInt(file,"Kills",0);
- INI_WriteInt(file,"Deaths",0);
- INI_Close(file);
- SendClientMessage(playerid,-1,"Cestitamo,Uspjesno si se registrirao/la!");
- return 1;
- }
- }
- if(dialogid == dlogin)
- {
- if(!response) return Kick(playerid);
- if(response)
- {
- new hashpass[129];
- WP_Hash(hashpass,sizeof(hashpass),inputtext);
- if(!strcmp(hashpass,pInfo[playerid][Pass])) d
- {
- INI_ParseFile(Path(playerid),"loadaccount_user",.bExtra = true, .extra = playerid);
- SetPlayerScore(playerid,pInfo[playerid][Scores]);
- GivePlayerMoney(playerid,pInfo[playerid][Money]);
- SendClientMessage(playerid,-1,"Dobrodosao/la natrag! Uspjesno si se prijavio");
- else
- {
- ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Prijava","Dobrodosao/la natrag. Ovaj account je registriran!. \nUkucajte svoju lozinku kako bi se priijavili!.\nNetocna lozinka!!","Prijava","Izlaz");
- return 1;
- }
- }
- }
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement