Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- THIS IS A SUPERJUMP FS MADE BY COMPILER. FORUM TOPIC ( http://forum.sa-mp.com/showthread.php?p=3669671#post3669671 ).
- INTRODUCTION:-
- • This Filterscript is made by Me( Compiler ), Please don't remove the credits.
- • Forum Member ( http://forum.sa-mp.com/member.php?u=271074 ).
- • This is a Filterscript that will allow the player to jump high.
- • This Filterscript also contains saving system with Y_ini.
- COMMAND(S):-
- • /superjump - Enables / Disables superjump.
- • /sj - Does the same work of /superjump.
- CREDITS:-
- • Compiler - For making this Filterscript.
- • Sreyas - For explaining me( Compiler ) Y_ini.
- */
- //==============================================================================
- // -> Includes
- //==============================================================================
- #include <a_samp>
- #include <zcmd>
- #include <YSI\y_ini>
- //==============================================================================
- // -> Defines
- //==============================================================================
- #define GREEN "{11ED65}"
- #define RED "{FF0000}"
- #define GREY "{C0C4C4}"
- #define JUMP_HEIGHT 5
- //==============================================================================
- // -> Saving Path
- //==============================================================================
- #define JumpSave "SuperJump/%s.ini"
- //==============================================================================
- // -> Forward(s)
- //==============================================================================
- forward Jump0(playerid);
- forward Jump1(playerid);
- //==============================================================================
- // -> Enum
- //==============================================================================
- enum Jump
- {
- pJump,
- }
- //==============================================================================
- // -> Variable(s)
- //==============================================================================
- new SJump[MAX_PLAYERS][Jump];
- //==============================================================================
- //----------------------------------------------------------------------
- // -> Saving Stock
- //----------------------------------------------------------------------
- //==============================================================================
- stock Jfile(playerid)
- {
- new string[128],playername[MAX_PLAYER_NAME];
- GetPlayerName(playerid,playername,sizeof(playername));
- format(string,sizeof(string),JumpSave,playername);
- return string;
- }
- //==============================================================================
- //----------------------------------------------------------------------
- // -> Loading Filterscript.
- //----------------------------------------------------------------------
- //==============================================================================
- public OnFilterScriptInit()
- {
- print("\n===========================================");
- print("Super-Jump Filterscript by Compiler Loaded!");
- print("===========================================\n");
- return 1;
- }
- //==============================================================================
- //----------------------------------------------------------------------
- // -> Unloading Filterscript.
- //----------------------------------------------------------------------
- //==============================================================================
- public OnFilterScriptExit()
- {
- print("\n===========================================");
- print("Super-Jump Filterscript by Compiler Unloaded!");
- print("===========================================\n");
- return 1;
- }
- //==============================================================================
- //----------------------------------------------------------------------
- // -> The Key Pressing.
- //----------------------------------------------------------------------
- //==============================================================================
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(SJump[playerid][pJump] == 1)
- {
- if(newkeys & KEY_JUMP)
- {
- new Float:SJ[3];
- GetPlayerVelocity(playerid, SJ[0], SJ[1], SJ[2]);
- SetPlayerVelocity(playerid, SJ[0], SJ[1], SJ[2] + JUMP_HEIGHT);
- SJump[playerid][pJump] = 0;
- SetTimer("Jump0", 2000, false); // I used it so that players don't jump again before landing.
- }
- }
- return 1;
- }
- //==============================================================================
- //----------------------------------------------------------------------
- // -> Jump CallBack.
- //----------------------------------------------------------------------
- //==============================================================================
- public Jump0(playerid)
- {
- SJump[playerid][pJump] = 0;
- SetTimer("Jump1", 1, false);
- }
- public Jump1(playerid) SJump[playerid][pJump] = 1;
- //==============================================================================
- //----------------------------------------------------------------------
- // -> When the player Disconnects
- //----------------------------------------------------------------------
- //==============================================================================
- public OnPlayerDisconnect(playerid,reason)
- {
- if(SJump[playerid][pJump] == 1)
- {
- new INI:file = INI_Open(Jfile(playerid));
- INI_WriteInt(file, "SuperJump", 1);
- INI_Close(file);
- }
- return 1;
- }
- //==============================================================================
- //----------------------------------------------------------------------
- // -> When the player Connects
- //----------------------------------------------------------------------
- //==============================================================================
- public OnPlayerConnect(playerid)
- {
- if(fexist(Jfile(playerid)))
- {
- SJump[playerid][pJump] = 1;
- fremove(Jfile(playerid));
- }
- else
- {
- SJump[playerid][pJump] = 0;
- }
- return 1;
- }
- //==============================================================================
- //----------------------------------------------------------------------
- // -> Command(s)
- //----------------------------------------------------------------------
- //==============================================================================
- CMD:superjump(playerid, params[])
- {
- if(SJump[playerid][pJump] == 1)
- {
- SJump[playerid][pJump] = 0;
- SendClientMessage(playerid, -1, RED"[SUPERJUMP]"GREY" SuperJump has been "RED"Disabled"GREY"!");
- }
- else if(SJump[playerid][pJump] == 0)
- {
- SJump[playerid][pJump] = 1;
- SendClientMessage(playerid, -1, RED"[SUPERJUMP]"GREY" SuperJump has been "GREEN"Enabled"GREY"!");
- }
- return 1;
- }
- CMD:sj(playerid, params[]) return cmd_superjump(playerid, params);
- //=======================================================================================================
- //-------------------------------------------------------------------------------------------------------
- // END OF IT
- //-------------------------------------------------------------------------------------------------------
- //=======================================================================================================
Add Comment
Please, Sign In to add comment