Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp> //0.3 r7 required
- #include <mapandreas> //you have to set it up on your own (see http://forum.sa-mp.com/index.php?topic=145196.0 )
- #define players 500 //maximum of players in your server
- #define chopperid 497 //ID of the vehicle model ( http://wiki.sa-mp.com/wiki/Vehicles:Helicopters )
- #define ropelength 50 //length of slideable rope (ingame meters)
- #define skinid 285 //the skin, who may slide down the rope ( http://wiki.sa-mp.com/wiki/Skins:All )
- #define offsetz 12
- #define dur 250
- new r0pes[players][ropelength],Float:pl_pos[players][5]; //cause pvar + array = sux
- public OnFilterScriptInit()
- {
- MapAndreas_Init(MAP_ANDREAS_MODE_FULL);
- print("\n--------------------------------------");
- print(" <Advanced Rope (v1)> ");
- print(" (c) Trooper([Y]) , 2010 (Nicksoft) ");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(GetPVarInt(playerid,"roped") == 1)
- {
- for(new destr=0;destr<=ropelength;destr++)
- {
- DestroyObject(r0pes[playerid][destr]);
- }
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(GetPVarInt(playerid,"roped") == 1)
- {
- for(new destr2=0;destr2<=ropelength;destr2++)
- {
- DestroyObject(r0pes[playerid][destr2]);
- }
- SetPVarInt(playerid,"roped",0);
- DisablePlayerCheckpoint(playerid);
- }
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- if(GetVehicleModel(vehicleid) == chopperid)
- {
- for(new shg=0;shg<=players;shg++)
- {
- if(GetPVarInt(shg,"chop_id") == vehicleid && GetPVarInt(shg,"roped") == 1)
- {
- DisablePlayerCheckpoint(shg);
- SetPVarInt(shg,"roped",0);
- DisablePlayerCheckpoint(shg);
- ClearAnimations(shg);
- TogglePlayerControllable(shg,1);
- for(new destr3=0;destr3<=ropelength;destr3++)
- {
- DestroyObject(r0pes[shg][destr3]);
- }
- }
- }
- }
- return 1;
- }
- forward syncanim(playerid);
- public syncanim(playerid)
- {
- if(GetPVarInt(playerid,"roped") == 0) return 0;
- SetTimerEx("syncanim",dur,0,"i",playerid);
- ApplyAnimation(playerid,"ped","abseil",4.0,0,0,0,1,0);
- return 1;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- if(GetVehicleModel(vehicleid) == chopperid && ispassenger)
- {
- SetPVarInt(playerid,"chop_id",GetPlayerVehicleID(playerid));
- SetPVarInt(playerid,"roped",0);
- }
- else SetPVarInt(playerid,"chop_id",0);
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- if(GetPVarInt(playerid,"roped") == 1 && GetPlayerSkin(playerid) == skinid)
- {
- SetPVarInt(playerid,"roped",0);
- SetPVarInt(playerid,"chop_id",0);
- ClearAnimations(playerid);
- TogglePlayerControllable(playerid,0);
- TogglePlayerControllable(playerid,1);
- DisablePlayerCheckpoint(playerid);
- for(new destr4=0;destr4<=ropelength;destr4++)
- {
- DestroyObject(r0pes[playerid][destr4]);
- }
- }
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if(GetPlayerSkin(playerid) == skinid && GetPVarInt(playerid,"roped") == 0 && GetPlayerVehicleSeat(playerid) != 0 && IsPlayerInAnyVehicle(playerid) && (newkeys & KEY_SUBMISSION || newkeys == KEY_SUBMISSION))
- {
- GetPlayerPos(playerid,pl_pos[playerid][0],pl_pos[playerid][1],pl_pos[playerid][2]);
- MapAndreas_FindZ_For2DCoord(pl_pos[playerid][0],pl_pos[playerid][1],pl_pos[playerid][3]);
- pl_pos[playerid][4] = floatsub(pl_pos[playerid][2],pl_pos[playerid][3]);
- if(pl_pos[playerid][4] >= ropelength) return SendClientMessage(playerid,0xAA3333AA,"You are too scared to slide from this height");
- if(pl_pos[playerid][4] <= 2) return RemovePlayerFromVehicle(playerid);
- SetPVarInt(playerid,"roped",1);
- SetPlayerCheckpoint(playerid,pl_pos[playerid][0],pl_pos[playerid][1],floatsub(pl_pos[playerid][3],offsetz),20);
- SetPlayerPos(playerid,pl_pos[playerid][0],pl_pos[playerid][1],floatsub(pl_pos[playerid][2],2));
- SetPlayerVelocity(playerid,0,0,0);
- for(new rep=0;rep!=10;rep++) ApplyAnimation(playerid,"ped","abseil",4.0,0,0,0,1,0);
- for(new cre=0;cre<=pl_pos[playerid][4];cre++)
- {
- r0pes[playerid][cre] = CreateObject(3004,pl_pos[playerid][0],pl_pos[playerid][1],floatadd(pl_pos[playerid][3],cre),87.640026855469,342.13500976563, 350.07507324219);
- }
- SetTimerEx("syncanim",dur,0,"i",playerid);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement