Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //define
- #define LIGHTBLUE 0x33CCFFAA
- #define RED 0xAA3333AA
- #define GREY 0xAFAFAFAA
- #define YELLOW 0xFFFF00AA
- #define PINK 0xFF66FFAA
- #define BLUE 0x0000BBAA
- #define WHITE 0xFFFFFFAA
- #define DARKRED 0x660000AA
- #define ORANGE 0xFF9900AA
- #define BRIGHTRED 0xFF0000AA
- #define INDIGO 0x4B00B0AA
- #define VIOLET 0x9955DEEE
- #define LIGHTRED 0xFF99AADD
- #define SEAGREEN 0x00EEADDF
- #define GRAYWHITE 0xEEEEFFC4
- #define LIGHTNEUTRALBLUE 0xabcdef66
- #define GREENISHGOLD 0xCCFFDD56
- #define LIGHTBLUEGREEN 0x0FFDD349
- #define NEUTRALBLUE 0xABCDEF01
- #define LIGHTCYAN 0xAAFFCC33
- #define LEMON 0xDDDD2357
- #define MEDIUMBLUE 0x63AFF00A
- #define NEUTRAL 0xABCDEF97
- #define BLACK 0x00000000
- #define NEUTRALGREEN 0x81CFAB00
- #define DARKGREEN 0x12900BBF
- #define LIGHTGREEN 0x24FF0AB9
- #define DARKBLUE 0x300FFAAB
- #define BLUEGREEN 0x46BBAA00
- #define PINK 0xFF66FFAA
- #define dregister 2011
- #define dlogin 2012
- #define UserPath "Users/%s.ini"
- //include
- #include <a_samp>
- #include <a_samp>
- #include <YSI\y_ini>
- //new
- new bool:firstSpawn[ MAX_PLAYERS ];
- // kitka
- native WP_Hash(buffer[],len,const str[]);
- main()
- {
- print("\n----------------------------------");
- print(" Blank Gamemode by your name here");
- print("----------------------------------\n");
- }
- public OnGameModeInit()
- {
- AddStaticVehicleEx ( 510, 2017.6434,1338.0948,10.8203,265.4293, 0, 1, 30 );
- AddStaticVehicleEx ( 510, 2017.1171,1347.7137,10.8203,267.3094, 0, 1, 30 );
- // Don't use these lines if it's a filterscript
- SetGameModeText("Serveris 1.0");
- AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- return 1;
- }
- enum PlayerInfo
- {
- Pass[129],
- Adminlevel,
- VIPlevel,
- Money,
- Scores,
- Kills,
- Deaths
- }
- 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][Pass],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("Kills",pInfo[playerid][Kills]);
- INI_Int("Deaths",pInfo[playerid][Deaths]);
- 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)
- {
- PlayAudioStreamForPlayer( playerid, "http://84.46.205.13/rc128.mp3.m3u" );
- firstSpawn[ playerid ] = true;
- if(InvalidNickKick(playerid)) return 0;
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- if(fexist(Path(playerid)))
- {// then
- INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid); //Will load user''s data using INI_Parsefile.
- ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Prisijungimas","Sveiki sugrįže! {FFFFFF}Šis vartotojas yra {DB881A}registruotas {FFFFFF}įveskite slaptažodį norėdami prisijungti.","Jungtis","Išeiti");/*A dialog with input style will appear so you can insert your password to login.*/
- }
- else //If the connected user is not registered,
- {//then we will ''force'' him to register :)
- ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Registracija","Sveiki! {FFFFFF}Jūs turite užsiregistruoti. Įveskite norimą slaptažodį.","Registruotis","Išeiti");
- return 1;
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- //Same as OnDialogResponse, we will save their stats inside of their user''s account
- new INI:file = INI_Open(Path(playerid)); //will open their file
- INI_SetTag(file,"Player''s Data");//We will set a tag inside of user''s account called "Player''s Data"
- INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]); //If you''ve set his/her admin level, then his/her admin level will be saved inside of his/her account
- INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);//As explained above
- INI_WriteInt(file,"Money",GetPlayerMoney(playerid));//We will save his money inside of his account
- INI_WriteInt(file,"Scores",GetPlayerScore(playerid));//We will save his score inside of his account
- INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);//As explained above
- INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);//As explained above
- INI_Close(file);//Now after we''ve done saving their data, we now need to close the file
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- StopAudioStreamForPlayer ( playerid );
- firstSpawn[ playerid ] = false;
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- pInfo[killerid][Kills]++;//Will give 1 kill to killer and it will be saved inside of his/her account
- pInfo[playerid][Deaths]++;//Will give 1 death each time they die and it will be saved inside of his/her account
- 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)
- {
- 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 dialog id is a register dialog
- {//then
- if(!response) return Kick(playerid); //If they clicked the second button "Quit", we will kick them.
- if(response) //if they clicked the first button "Register"
- {//then
- if(!strlen(inputtext)) //If they didn''t enter any password
- {// then we will tell to them to enter the password to register
- ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Registracija","Prašome įvesti slaptažodį, tuščias laukelis netinka!","Registruotis","Išeiti");
- return 1;
- }
- //If they have entered a correct password for his/her account...
- new hashpass[129]; //Now we will create a new variable to hash his/her password
- WP_Hash(hashpass,sizeof(hashpass),inputtext);//We will use whirlpool to hash their inputted text
- new INI:file = INI_Open(Path(playerid)); // we will open a new file for them to save their account inside of Scriptfiles/Users folder
- INI_SetTag(file,"Player''s Data");//We will set a tag inside of user''s account called "Player''s Data"
- INI_WriteString(file,"Password",hashpass);//This will write a hashed password into user''s account
- INI_WriteInt(file,"AdminLevel",0); //Write an integer inside of user''s account called "AdminLevel". We will set his level to 0 after he registered.
- INI_WriteInt(file,"VIPLevel",0);//As explained above
- INI_WriteInt(file,"Money",0);//Write an integer inside of user''s account called "Money". We will set their money to 0 after he registered
- INI_WriteInt(file,"Scores",0);//Write an integer inside of user''s account called "Scores". We will set their score to 0 after he registered
- INI_WriteInt(file,"Kills",0);//As explained above
- INI_WriteInt(file,"Deaths",0);//As explained above
- INI_Close(file);//Now after we''ve done saving their data, we now need to close the file
- SendClientMessage(playerid,-1,"Jūs sėkmingai užsiregistravote!");//Tell to them that they have successfully registered a new account
- return 1;
- }
- }
- if(dialogid == dlogin) //If dialog id is a login dialog
- {//then
- if(!response) return Kick(playerid); //If they clicked the second button "Quit", we will kick them.
- if(response) //if they clicked the first button "Register"
- {//then
- new hashpass[129]; //Will create a new variable to hash his/her password
- WP_Hash(hashpass,sizeof(hashpass),inputtext); //Will hash inputted password
- if(!strcmp(hashpass, pInfo[playerid][Pass], false)) //If they have insert their correct password
- {//then
- INI_ParseFile(Path(playerid),"loadaccount_%s",.bExtra = true, .extra = playerid);//We will load his account''s data from user''s path
- SetPlayerScore(playerid,pInfo[playerid][Scores]);//We will get their score inside of his user''s account and we will set it here
- GivePlayerMoney(playerid,pInfo[playerid][Money]);//As explained above
- SendClientMessage(playerid,-1,"Sveiki sugrįže! Jūs sėkmingai prisijungėte.");//Tell them that they''ve successfully logged in
- }
- else //If they''ve entered an incorrect password
- {//then
- ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Prisijungimas","{FFFFFF}Jūsų įvestas slaptažodis buvo {FF0000}neteisingas{FFFFFF}, pabandykite įvesti dar kartą!","Prisijungti","Išeiti");//We will tell to them that they''ve entered an incorrect password
- return 1;
- }
- }
- }
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- stock InvalidNickKick(playerid)
- {
- if(IsPlayerNPC(playerid))return 1;
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- new where = strfind(name,"_",true);
- new lenght = strlen(name)-1;
- new invalid = strfind(name,"[",true);
- if(invalid == -1) invalid = strfind(name,"]",true);
- if(name[0] < 65 || name[0] > 90)
- {
- new msg[128];
- SendClientMessage(playerid,RED,"* Serveris: Jusu slapyvardis netinkamas. Vardas rasosi didziaja raide!");
- SendClientMessage(playerid,RED,"* Serveris: Teisinga slapyvardzio forma butu:");
- SendClientMessage(playerid,RED,"* Serveris: Vardas_Pavarde");
- format(msg,sizeof(msg),"* ]]] %s [[ ]] %i [[[ *", name[0], name[0]);
- SendClientMessage(playerid, RED, msg);
- Kick(playerid);
- return 1;
- }
- if(name[where+1] < 65 || name[where+1] > 90)
- {
- SendClientMessage(playerid,RED,"* Serveris: Jusu slapyvardis netinkamas. Pavarde rasosi didziaja raide!");
- SendClientMessage(playerid,RED,"* Serveris: Teisinga slapyvardzio forma butu:");
- SendClientMessage(playerid,RED,"* Serveris: Vardas_Pavarde");
- Kick(playerid);
- return 1;
- }
- for(new i = 1; i < where-1; i++)
- {
- if(name[i] < 97 || name[i] > 122)
- {
- SendClientMessage(playerid,RED,"* Serveris: Jusu slapyvardis netinkamas del: (didziosios raides arba skaiciai vardo vidury)");
- SendClientMessage(playerid,RED,"* Serveris: Teisinga slapyvardzio forma butu:");
- SendClientMessage(playerid,RED,"* Serveris: Vardas_Pavarde");
- Kick(playerid);
- return 1;
- }
- }
- if(where == 0 || where == lenght || where==-1)
- {
- SendClientMessage(playerid,RED,"* Serveris: Jusu slapyvardis netinkamas.");
- SendClientMessage(playerid,RED,"* Serveris: Teisinga slapyvardzio forma butu:");
- SendClientMessage(playerid,RED,"* Serveris: Vardas_Pavarde");
- Kick(playerid);
- return 1;
- }
- if(strlen(name[where])<4)
- {
- SendClientMessage(playerid,RED,"* Serveris: Jusu pavarde per trumpa");
- SendClientMessage(playerid,RED,"* Serveris: Teisinga slapyvardzio forma butu:");
- SendClientMessage(playerid,RED,"* Serveris: Vardas_Pavarde");
- Kick(playerid);
- return 1;
- }
- if(where<3)
- {
- SendClientMessage(playerid,RED,"* Serveris: Jusu vardas per trumpas");
- SendClientMessage(playerid,RED,"* Serveris: Teisinga slapyvardzio forma butu:");
- SendClientMessage(playerid,RED,"* Serveris: Vardas_Pavarde");
- Kick(playerid);
- return 1;
- }
- if(invalid != -1)
- {
- SendClientMessage(playerid,RED,"* Serveris: Varde rasta netinkamu raidziu.");
- SendClientMessage(playerid,RED,"* Serveris: Teisinga slapyvardzio forma butu:");
- SendClientMessage(playerid,RED,"* Serveris: Vardas_Pavarde");
- Kick(playerid);
- return 1;
- }
- for(new i = where+2; i < MAX_PLAYER_NAME; i++)
- {
- if(name[i] < 97 || name[i] > 122)
- {
- if(name[i] == 0){i = MAX_PLAYER_NAME; return 0;}
- SendClientMessage(playerid,RED,"* Serveris: Jusu slapyvardis netinkamas del: (didziosios raides arba skaiciai pavardes vidury)");
- SendClientMessage(playerid,RED,"* Serveris: Teisinga slapyvardzio forma butu:");
- SendClientMessage(playerid,RED,"* Serveris: Vardas_Pavarde");
- Kick(playerid);
- return 1;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment