Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Random:
- [added] [Pending Test] Player Spectating killer
- [added] [Working] reg & login + hash
- [added] [Working] textdraws upon login
- [not added] Range of the airport <- Player that goes out from the range of airport will be killed if not returned withing 5 seconds
- Perks:
- [not added] Camouflage <- set player Virtual world for % seconds (depending on the skill level)
- [not added] Hydra Damage <- Lower the hydra damage
- [not added] Shield <- Gives player 500 hp for 5 seconds
- VIP Perks:
- [not added] Tags <- Player name tag for example [ClanName] PlayerName
- [not added] Private airports <- Private airports for clans
- */
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- #include <a_samp>
- #include <YSI\y_ini>
- #define dregister 2011
- #define dlogin 2012
- #define UserPath "Users/%s.ini"
- #define WHITE 0xFFFFFFAA
- #define COL_WHITE "{FFFFFF}"
- #define COL_RED "{F81414}"
- #define COL_GREEN "{00FF22}"
- #define COL_LIGHTBLUE "{00CED1}"
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_RED 0xAA3333AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_BLUE 0x0000BBAA
- #define COLOR_LIGHTBLUE 0x33CCFFAA
- #define COLOR_ORANGE 0xFF9900AA
- #define COLOR_RED 0xAA3333AA
- #define COLOR_LIME 0x10F441AA
- #define COLOR_MAGENTA 0xFF00FFFF
- #define COLOR_NAVY 0x000080AA
- #define COLOR_AQUA 0xF0F8FFAA
- #define COLOR_CRIMSON 0xDC143CAA
- #define COLOR_FLBLUE 0x6495EDAA
- #define COLOR_BISQUE 0xFFE4C4AA
- #define COL_WHITE "{FFFFFF}"
- enum PlayerInfo
- {
- Pass[129],
- Adminlevel,
- VIPlevel,
- Money,
- Scores,
- Kills,
- Deaths
- }
- new pInfo[MAX_PLAYERS][PlayerInfo];
- new Float:RandomSpawns[][] =
- {
- {365.4037,2538.4521,17.7501,181.8172},
- {385.4970,2540.7581,17.4408,182.9258},
- {354.6383,2550.2571,17.4602,175.3287},
- {426.9488,2513.3225,17.4129,94.4121},
- {426.5472,2502.2146,17.2314,98.5555},
- {420.2510,2489.5217,17.3957,98.3015},
- {327.9721,2540.6008,17.7368,181.5695},
- {292.7176,2545.1101,17.7518,178.5204}
- };
- new Text:Textdraw0;
- new Text:Textdraw1;
- new Weather;
- new PayCheck[MAX_PLAYERS];
- native WP_Hash(buffer[],len,const str[]);
- forward GivePlayerCheck(playerid);
- forward spectateend(playerid);
- forward RandomWeather();
- forward exited(playerid);
- #if defined FILTERSCRIPT
- #else
- main()
- {
- print("\n----------------------------------");
- print(" World Of War Planes");
- print("----------------------------------\n");
- }
- #endif
- public OnGameModeInit()
- {
- SetGameModeText("Blank Script");
- AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- SetTimer("RandomWeather",150000,true); // 15 minutes random weather
- Textdraw0 = TextDrawCreate(680.000000, -52.000000, "BOX");
- TextDrawBackgroundColor(Textdraw0, 255);
- TextDrawFont(Textdraw0, 1);
- TextDrawLetterSize(Textdraw0, 2.799999, 21.100000);
- TextDrawColor(Textdraw0, -1);
- TextDrawSetOutline(Textdraw0, 0);
- TextDrawSetProportional(Textdraw0, 1);
- TextDrawSetShadow(Textdraw0, 1);
- TextDrawUseBox(Textdraw0, 1);
- TextDrawBoxColor(Textdraw0, 255);
- TextDrawTextSize(Textdraw0, -320.000000, -300.000000);
- Textdraw1 = TextDrawCreate(1493.000000, 366.000000, "BOX");
- TextDrawBackgroundColor(Textdraw1, 255);
- TextDrawFont(Textdraw1, 1);
- TextDrawLetterSize(Textdraw1, 4.209998, 25.100000);
- TextDrawColor(Textdraw1, -1);
- TextDrawSetOutline(Textdraw1, 0);
- TextDrawSetProportional(Textdraw1, 1);
- TextDrawSetShadow(Textdraw1, 1);
- TextDrawUseBox(Textdraw1, 1);
- TextDrawBoxColor(Textdraw1, 255);
- TextDrawTextSize(Textdraw1, -90.000000, 0.000000);
- 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)
- {
- 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);
- ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","Welcome back. This account is registered. \nInsert your password to login to your account","Login","Quit");
- }
- else
- {
- ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.","Register","Quit");
- return 1;
- }
- TextDrawShowForPlayer(playerid, Textdraw0);
- TextDrawShowForPlayer(playerid, Textdraw1);
- PayCheck[playerid]=SetTimerEx("GivePlayerCheck",600000,true,"i",playerid);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- KillTimer(PayCheck[playerid]);
- 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)
- {
- TextDrawHideForPlayer(playerid, Textdraw0);
- TextDrawHideForPlayer(playerid, Textdraw1);
- new Random = random(sizeof(RandomSpawns));
- SetPlayerPos(playerid, RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]);
- SetPlayerFacingAngle(playerid, RandomSpawns[Random][3]);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- pInfo[killerid][Kills]++;
- pInfo[playerid][Deaths]++;
- if ( killerid != INVALID_PLAYER_ID )
- {
- new szGameTextStr[128], killerName[24];
- GetPlayerName(killerid,killerName,24);
- TogglePlayerSpectating( playerid, 1 );
- if (IsPlayerInAnyVehicle(killerid))
- {
- PlayerSpectateVehicle( playerid, GetPlayerVehicleID( killerid ) );
- }
- else
- {
- PlayerSpectatePlayer( playerid, killerid );
- }
- format( szGameTextStr, 128, "~w~~n~killCamera~n~~>~Killer: %s ( ID: %i )~<~", killerName, killerid );
- GameTextForPlayer( playerid, szGameTextStr, 10000, 5 );
- SetTimerEx( "spectateend", true, 10000, "i", playerid );
- TextDrawShowForPlayer(playerid, Textdraw0);
- TextDrawShowForPlayer(playerid, Textdraw1);
- }
- GivePlayerMoney(killerid, 100);
- SendClientMessage(killerid, WHITE, "<!>You have killed an enemy, you received +100!");
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- new Rank[20];
- switch(GetPlayerScore(playerid))
- {
- case 0 .. 10: format(Rank, sizeof(Rank),"[Officer Cadet]");
- case 11 .. 20: format(Rank, sizeof(Rank),"[Pilot officer]");
- case 21 .. 30: format(Rank, sizeof(Rank),"[Flying officer]");
- case 31 .. 40: format(Rank, sizeof(Rank),"[Flight lieutenant]");
- case 41 .. 50: format(Rank, sizeof(Rank),"[Squadron leader]");
- case 51 .. 60: format(Rank, sizeof(Rank),"[Wing commander]");
- case 61 .. 70: format(Rank, sizeof(Rank),"[Group captain]");
- case 71 .. 80: format(Rank, sizeof(Rank),"[Air commodore]");
- case 81 .. 90: format(Rank, sizeof(Rank),"[Air marshal]");
- case 91 .. 100: format(Rank, sizeof(Rank),"[Air Force Marshal]");
- }
- new ChatText[128], Nameasd[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Nameasd, MAX_PLAYER_NAME);
- format(ChatText, sizeof(ChatText),"{F3FF02}%s %s:{FFFFFF} %s", Rank, Nameasd, text);
- SendClientMessageToAll(-1, ChatText);
- return 0;
- }
- 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)
- {
- SendClientMessage(playerid, COLOR_RED, "<!>You have 5 seconds to get back into your vehicle!");
- SetTimerEx( "exited", true, 5000, "i", playerid );
- 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)
- {
- if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
- {
- return 0;
- }
- 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,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
- 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,"You have been successfully registered");//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])) //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,"Welcome back! You have successfully logged in");//Tell them that they've successfully logged in
- }
- else //If they've entered an incorrect password
- {//then
- ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login","Welcome back. This account is registered. \nInsert your password to login to your account.\nIncorrect password!","Login","Quit");//We will tell to them that they've entered an incorrect password
- return 1;
- }
- }
- }
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- /* ===================================== [ Custom Stocks] =======================================*/
- stock Path(playerid)
- {
- new str[128],name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- format(str,sizeof(str),UserPath,name);
- return str;
- }
- /* ================================= [ Custom Functions] ========================================*/
- forward loadaccount_user(playerid, name[], value[]);
- public loadaccount_user(playerid, name[], value[])
- {
- INI_String("Password", pInfo[playerid][Pass],129); /*we will use INI_String to load user's password.
- ("Password",.. will load user's password inside of user's path. 'pInfo[playerid][Pass]',...We have defined our user's variable above called, pInfo. Now it's time to use it here to load user's password. '129',... 129 is a length of a hashed user's password. Whirlpool will hash 128 characters + NULL*/
- INI_Int("AdminLevel",pInfo[playerid][Adminlevel]);/*We will use INI_Int to load user's admin level. INI_Int stands for INI_Integer. This load an admin level. */
- INI_Int("VIPLevel",pInfo[playerid][VIPlevel]);//As explained above
- INI_Int("Money",pInfo[playerid][Money]); //As explained above
- INI_Int("Scores",pInfo[playerid][Scores]);//As explained above
- INI_Int("Kills",pInfo[playerid][Kills]);//As explained above
- INI_Int("Deaths",pInfo[playerid][Deaths]);//As explained above
- return 1;
- }
- /* ============================== [ Callbacks for Timers ] =========================================== */
- public spectateend(playerid)
- return TogglePlayerSpectating(playerid,0), SpawnPlayer(playerid), TextDrawHideForPlayer(playerid, Textdraw0), TextDrawHideForPlayer(playerid, Textdraw1);
- public exited(playerid)
- return SetPlayerHealth(playerid, 0), SendClientMessage(playerid, COLOR_RED, "<!>You have died since you didnt return into your vehicle!");
- public RandomWeather()
- {
- Weather = random(20);
- SetWeather(Weather);
- }
- public GivePlayerCheck(playerid)
- {
- GivePlayerMoney(playerid,100);
- SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
- SendClientMessage(playerid, COLOR_YELLOW, "[PAYDAY] You have received +100$");
- SendClientMessage(playerid, COLOR_YELLOW, "[PAYDAY] You received +1 Pilot Time");
- return 1;
- }
- /* ============================================ [ Public Commands ] ===================================*/
- CMD:car(playerid, params[])
- {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x,y,z);
- PutPlayerInVehicle(playerid, CreateVehicle(520, x, y, z, 90.0, 1, 2, -1), 0);
- return 1;
- }
- CMD:help(playerid, params[])
- {
- SendClientMessage(playerid, COLOR_YELLOW, "__________________________________________________________");
- SendClientMessage(playerid, COLOR_WHITE, "/b, /pm, /n, /stats");
- return 1;
- }
- CMD:stats(playerid, params[])
- {
- SendClientMessage(playerid, 0xFFFFFFFF, " |-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- |");
- new string[128];
- new aname[MAX_PLAYER_NAME];
- GetPlayerName(playerid, aname,sizeof(aname));
- format(string,sizeof(string), "%s These are your stats:", aname);
- SendClientMessage(playerid, 0xFFFFFFFF,string);
- format(string,sizeof(string), "- Cash: %i", GetPlayerMoney(playerid));
- SendClientMessage(playerid, 0xFFFFFFFF, string);
- format(string,sizeof(string), "- Kills: %i", pInfo[playerid][Kills]);
- SendClientMessage(playerid, 0xFFFFFFFF, string);
- format(string,sizeof(string), "- Deaths: %i", pInfo[playerid][Deaths]);
- SendClientMessage(playerid, 0xFFFFFFFF, string);
- format(string,sizeof(string), "- Admin Level: %i", pInfo[playerid][Adminlevel]);
- SendClientMessage(playerid, 0xFFFFFFFF, string);
- SendClientMessage(playerid, 0xFFFFFFFF, " |-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- |");
- return 1;
- }
- CMD:newb(playerid, params[]) return cmd_n(playerid, params);
- CMD:n(playerid, params[])
- {
- if (isnull(params)) return
- SendClientMessage(playerid, COLOR_RED, " Usage: /n <your question>");
- new szString[128], szName[28];
- GetPlayerName(playerid, szName, 28);
- format(szString, 128, "{33CCFF}Newbie %s(%d): %s", szName, playerid, params);
- SendClientMessageToAll(-1, szString);
- return 1;
- }
- COMMAND:pm(playerid,params[])
- {
- new ID;
- new PMstring[128];
- new string[128];
- new Iname[MAX_PLAYER_NAME], Pname[MAX_PLAYER_NAME];
- if (sscanf(params, "ds[128]", ID, PMstring))
- {
- SendClientMessage(playerid,COLOR_RED,"Usage: /pm (id) (message)");
- return 1;
- }
- GetPlayerName(ID,Iname,sizeof(Iname));
- GetPlayerName(playerid,Pname,sizeof(Pname));
- format(string,128,"PM from %i[%s]: %s",playerid,Pname,PMstring);
- SendClientMessage(ID,0xFFD720FF,string);
- format(string,128,"PM To %s: %s",Iname,PMstring);
- SendClientMessage(playerid,0xFFD720FF,string);
- PlayerPlaySound(ID,1085,0.0,0.0,0.0);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement