Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is a comment
- // uncomment the line below if you want to write a filterscript
- //#define FILTERSCRIPT
- #include <a_samp>
- #include <Dini>
- #include <dutils>
- #define LIGHTBLUE "{00CED1}"
- #define ALB "{ffffff}"
- #define RED "{F81414}"
- #define GREEN "{00FF22}"
- #define COLOR_GREY 0xAFAFAFAA
- #pragma unused ret_memcpy
- #pragma unused strtok
- forward OnPlayerLogin(playerid,password[]);
- forward OnPlayerUpdate(playerid);
- forward OnPlayerRegister(playerid, password[]);
- enum pInfo
- {
- pPass,
- pAdmin,
- pVip,
- pLevel,
- pCash,
- pKills,
- pDeaths,
- pLottoNr
- };
- new PlayerInfo[MAX_PLAYERS][pInfo];
- new gPlayerLogged[MAX_PLAYERS];
- new gPlayerLogTries[MAX_PLAYERS];
- new gPlayerAccount[MAX_PLAYERS];
- new Typed[MAX_PLAYERS][64];
- main()
- {
- print("\n----------------------------------");
- print(" Blank Gamemode by your name here");
- print("----------------------------------\n");
- }
- public OnGameModeInit()
- {
- return 1;
- }
- public OnGameModeExit()
- {
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- ShowPlayerDialog(playerid,1234, DIALOG_STYLE_MSGBOX,""GREEN"Reguli",""ALB"Nu folosi un limbaj vulgar!\n"ALB"Nu face reclama altor servere\n"ALB"Nu iti da id-ul pe chat","Accept","Refuz");
- SetPlayerCameraPos(playerid, 1890.1014,-1194.7969,25.8091);
- SetPlayerCameraLookAt(playerid, 1933.4393,-1196.2479,18.8163);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new string[128];
- new plname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, plname, sizeof(plname));
- PlayerInfo[playerid][pAdmin] = 0;
- PlayerInfo[playerid][pVip] = 0;
- PlayerInfo[playerid][pLevel] = 0;
- PlayerInfo[playerid][pCash] = 0;
- PlayerInfo[playerid][pKills] = 0;
- PlayerInfo[playerid][pDeaths] = 0;
- PlayerInfo[playerid][pLottoNr] = 0;
- format(string, sizeof(string), "Users/%s.ini", plname);
- if(dini_Exists(string))
- {
- gPlayerAccount[playerid] = 1;
- }
- else
- {
- gPlayerAccount[playerid] = 0;
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerRegister(playerid, password[])
- {
- if(IsPlayerConnected(playerid))
- {
- new file[64];
- new playername3[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername3, sizeof(playername3));
- format(file, sizeof(file), "Users/%s.ini", playername3);
- if(dini_Exists(file))
- {
- return SendClientMessage(playerid,COLOR_GREY,"This account is already registered.");
- }
- else
- {
- dini_Create(file);
- new password2 = num_hash(password);
- PlayerInfo[playerid][pPass] = password2;
- dini_IntSet(file, "Password",password2);
- dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdmin]);
- dini_IntSet(file, "VipLevel",PlayerInfo[playerid][pVip]);
- dini_IntSet(file, "Level",PlayerInfo[playerid][pLevel]);
- dini_IntSet(file, "Cash",PlayerInfo[playerid][pCash]);
- dini_IntSet(file, "Kills",PlayerInfo[playerid][pKills]);
- dini_IntSet(file, "Deaths",PlayerInfo[playerid][pDeaths]);
- dini_IntSet(file, "LottoNr",PlayerInfo[playerid][pLottoNr]);
- ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,""ALB"Bun Venit",""ALB"Cont inregistrat cu succes!\n"ALB"Scrie parola ta mai jos pentru a te loga","Log-in","Quit");
- }
- }
- return 1;
- }
- public OnPlayerLogin(playerid,password[])
- {
- new string2[64];
- new playername3[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername3, sizeof(playername3));
- format(string2, sizeof(string2), "Users/%s.ini", playername3);
- if (dini_Exists(string2))
- {
- new password2 = num_hash(password);
- if(dini_Int(string2,"Password") == password2)
- {
- PlayerInfo[playerid][pPass] = dini_Int(string2,"Password");
- PlayerInfo[playerid][pAdmin] = dini_Int(string2,"AdminLevel");
- PlayerInfo[playerid][pVip] = dini_Int(string2,"VipLevel");
- PlayerInfo[playerid][pLevel] = dini_Int(string2,"Level");
- PlayerInfo[playerid][pCash] = dini_Int(string2,"Cash");
- PlayerInfo[playerid][pKills] = dini_Int(string2,"Kills");
- PlayerInfo[playerid][pDeaths] = dini_Int(string2,"Deaths");
- PlayerInfo[playerid][pLottoNr] = dini_Int(string2,"LottoNr");
- }
- else
- {
- gPlayerLogTries[playerid] += 1;
- ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,""ALB"Mai incearca!",""ALB"Ai introdus o parola gresita\n"ALB"Scrie-ti parola pentru a te loga!","Log-in","Quit");
- if(gPlayerLogTries[playerid] == 3) { Kick(playerid); }
- return 1;
- }
- }
- 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;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/mycommand", cmdtext, true, 10) == 0)
- {
- // Do something here
- 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)
- {
- if(IsPlayerConnected(playerid))
- {
- if(gPlayerLogged[playerid] == 1)
- {
- new string3[64];
- new playername3[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername3, sizeof(playername3));
- format(string3, sizeof(string3), "Users/%s.ini", playername3);
- dini_IntSet(string3, "Password",PlayerInfo[playerid][pPass]);
- dini_IntSet(string3, "AdminLevel",PlayerInfo[playerid][pAdmin]);
- dini_IntSet(string3, "VipLevel",PlayerInfo[playerid][pVip]);
- dini_IntSet(string3, "Level",PlayerInfo[playerid][pLevel]);
- dini_IntSet(string3, "Cash",PlayerInfo[playerid][pCash]);
- dini_IntSet(string3, "Kills",PlayerInfo[playerid][pKills]);
- dini_IntSet(string3, "Deaths",PlayerInfo[playerid][pDeaths]);
- dini_IntSet(string3, "LottoNr",PlayerInfo[playerid][pLottoNr]);
- }
- }
- 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 == 1234)
- {
- if(response)
- {
- new playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername, sizeof(playername));
- new string[64];
- format(string, sizeof(string), "Users/%s.ini", playername);
- if (dini_Exists(string))
- {
- ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,""ALB"Bun venit. Te rugam sa te loghezi.",""ALB"Scrie parola ta aici pentru a te loga","Log-in","Quit");
- }
- else
- {
- ShowPlayerDialog(playerid, 1246, DIALOG_STYLE_INPUT,""ALB"Te rugam sa te inregistrezi!",""ALB"Scrie parola ta aici pentru a te inregistra.","Register","Quit");
- }
- }
- else
- {
- SendClientMessage(playerid, COLOR_GREY,"*Ai refuzat. Trebuie sa accepti regulile pentru a juca");
- Kick(playerid);
- }
- }
- if(dialogid == 1245)
- {
- if(response)
- {
- strmid(Typed[playerid], inputtext, 0, strlen(inputtext), 255);
- if(!strcmp(Typed[playerid], "None", true))
- {
- ShowPlayerDialog(playerid, 1245, DIALOG_STYLE_INPUT,""ALB"Incerca din nou.",""ALB"Nu ai introdus o parola!\n"ALB"Scrie-ti parola mai jos pentru a te inregistra","Log-in","Quit");
- }
- else
- {
- OnPlayerLogin(playerid, inputtext);
- }
- }
- else
- {
- Kick(playerid);
- }
- }
- if(dialogid == 1246)
- {
- if(response == 1)
- {
- new sendername[MAX_PLAYER_NAME];
- GetPlayerName(playerid, sendername, sizeof(sendername));
- new string[512];
- format(string, sizeof(string),""ALB"Nume: "LIGHTBLUE"%s\n"ALB"Parola: "LIGHTBLUE"%s,\n"ALB"Bani: "LIGHTBLUE"10000\n"ALB"Scor: "LIGHTBLUE"1",sendername,inputtext);
- ShowPlayerDialog(playerid, 1242, DIALOG_STYLE_MSGBOX, ""LIGHTBLUE"Te-ai inregistrat cu succes",string,"Ok","");
- GivePlayerMoney(playerid, 10000);
- SetPlayerScore(playerid, 1);
- OnPlayerRegister(playerid, inputtext);
- }
- else
- {
- Kick(playerid);
- }
- }
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement