Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #include <linegen>
- #define OBJECTS_FOR_ROPE 150
- #define ROPE_LENGTH 5.0
- #define MIN_ROPE_HEIGHT 70.0
- enum RopeData {
- RopeID[OBJECTS_FOR_ROPE],
- Float:RopeX,
- Float:RopeY,
- Float:RopeZ
- };
- new Ropes[MAX_PLAYERS][RopeData];
- new Float:RealPlayerHP[MAX_PLAYERS];
- new IsRappeling[MAX_PLAYERS] = false;
- new Float:OldPos[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Blank Filterscript by your name here");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- stock CreateRope(playerid)
- {
- new Float:z;
- GetPlayerPos(playerid, Ropes[playerid][RopeX], Ropes[playerid][RopeY], z);
- new Float:Angle;
- GetPlayerFacingAngle(playerid, Angle);
- for(new i = 0; i < OBJECTS_FOR_ROPE; i++)
- {
- Ropes[playerid][RopeID][i] = CreateDynamicObject(19089, Ropes[playerid][RopeX], Ropes[playerid][RopeY], z-(i*ROPE_LENGTH), 0, 0, Angle);
- }
- }
- stock DestroyRope(playerid)
- {
- for(new i = 0; i < OBJECTS_FOR_ROPE; i++)
- {
- DestroyDynamicObject(Ropes[playerid][RopeID][i]);
- }
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- IsRappeling[playerid] = false;
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- if(IsRappeling[playerid])
- {
- ApplyAnimation(playerid, "ped", "abseil", 4.1, 1, 1, 1, 0, 0, 1);
- SetPlayerHealth(playerid, 0x7FFFFFFF);
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- if(z == OldPos[playerid])
- {
- ClearAnimations(playerid, 1);
- IsRappeling[playerid] = false;
- SetPlayerHealth(playerid, RealPlayerHP[playerid]);
- DestroyRope(playerid);
- }
- else OldPos[playerid] = z;
- }
- return 1;
- }
- CMD:slapme(playerid, params[]) // Just for testing
- {
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- SetPlayerPos(playerid, x, y, z+100);
- return 1;
- }
- CMD:drop(playerid, params[])
- {
- if(IsRappeling[playerid]) return SendClientMessage(playerid, -1, "Error: You are already rappeling!");
- new Float:x, Float:y, Float:z;
- GetPlayerPos(playerid, x, y, z);
- if ( z < MIN_ROPE_HEIGHT ) return SendClientMessage(playerid, -1, "Error: Tell the driver to go higher!");
- OldPos[playerid] = z;
- GetPlayerHealth(playerid, RealPlayerHP[playerid]);
- IsRappeling[playerid] = true;
- ApplyAnimation(playerid, "ped", "abseil", 4.1, 1, 1, 1, 0, 0, 1);
- SetPlayerHealth(playerid, 0x7FFFFFFF);
- CreateRope(playerid);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement