Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define FILTERSCRIPT
- new g_bCrackState[MAX_PLAYERS];
- new g_tCrackTick[MAX_PLAYERS];
- new g_bDownState[MAX_PLAYERS];
- main( ) { }
- #undef MAX_PLAYERS
- #define MAX_PLAYERS 15
- forward AutoCrack(playerid);
- public OnFilterScriptInit( )
- {
- SetGameModeText("Blank Script");
- AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- return 1;
- }
- public OnFilterScriptExit( )
- {
- 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)
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- SetTimer("AutoCrack", 2500, true);
- SetPlayerSkin(playerid, 28);
- GivePlayerWeapon(playerid, 24, 50);
- GivePlayerWeapon(playerid, 25, 50);
- GivePlayerWeapon(playerid, 29, 300);
- GivePlayerWeapon(playerid, 30, 300);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new
- Float:health;
- GetPlayerHealth(playerid, health);
- if (strcmp("/getup", cmdtext, true, 6) == 0)
- {
- GetPlayerHealth(playerid,health);
- if(health < 20.0)
- if ((GetTickCount() - g_tCrackTick[playerid]) > 15000)
- {
- SetPlayerHealth(playerid, 21);
- TogglePlayerControllable(playerid, true);
- ApplyAnimation(playerid,"PED","getup_front",5.0,0,1,1,1,1,1);
- SendClientMessage(playerid, 0x4AF8FF, "You've successfully got up! Remember to roleplay your injuries. ");
- g_bCrackState[playerid] = 0;
- g_tCrackTick[playerid] = GetTickCount();
- }
- }
- if (strcmp("/crackme", cmdtext, true, 8) == 0)
- {
- SetPlayerHealth(playerid, 10);
- return 1;
- }
- if (strcmp("/unfreeze", cmdtext, true, 9) == 0)
- {
- TogglePlayerControllable(playerid, true);
- return 1;
- }
- if (strcmp("/tackle", cmdtext, true, 7) == 0) {
- new victimid = GetClosestPlayer(playerid);
- if(GetDistanceBetweenPlayers(playerid,victimid) < 2)
- {
- new Chance = random(10);
- {
- switch(Chance)
- {
- case 5,10:
- {
- ApplyAnimation(playerid,"DODGE","Cover_Dive_01",5.0,0,1,1,1,1,1);
- TogglePlayerControllable(victimid, false);
- ApplyAnimation(victimid,"PARACHUTE","FALL_skyDive_DIE",5.0,0,1,1,1,1,1);
- g_bDownState[victimid] = 1;
- SendClientMessage(playerid, 0x4AF8FF, " You have successfully downed your target! ");
- SendClientMessage(victimid, 0x4AF8FF, " You have been tackle'd down by someone! ");
- SetTimer("Tackle", 30000, false);
- }
- case 1,2,3,4,7,8,9:
- {
- SendClientMessage(playerid, 0x4AF8FF, " You've failed to tackle your target. ");
- SendClientMessage(victimid, 0x4AF8FF, " Someone tried to tackle you! ");
- }
- }
- }
- }
- return 1;
- }
- return 1;
- }
- 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[])
- {
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- public AutoCrack(playerid)
- {
- new Float:health;
- GetPlayerHealth(playerid,health);
- if(health < 20.0 && !g_bCrackState[playerid])
- {
- TogglePlayerControllable(playerid, false);
- ApplyAnimation(playerid,"PED","KO_spin_L",3.0,0,1,1,1,1,1);
- g_bCrackState[playerid] = 1;
- g_tCrackTick[playerid] = GetTickCount();
- }
- return 1;
- }
- forward Tackle(victimid);
- public Tackle(victimid)
- {
- if ((g_bDownState[victimid] = 1))
- {
- TogglePlayerControllable(victimid, false);
- }
- return 1;
- }
- forward Float:GetDistanceBetweenPlayers(p1,p2);
- public Float:GetDistanceBetweenPlayers(p1,p2)
- {
- new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
- if(!IsPlayerConnected(p1) || !IsPlayerConnected(p2)) {
- return -1.00;
- }
- GetPlayerPos(p1,x1,y1,z1);
- GetPlayerPos(p2,x2,y2,z2);
- return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
- }
- forward GetClosestPlayer(p1);
- public GetClosestPlayer(p1)
- {
- new x,Float:dis,Float:dis2,player;
- player = -1;
- dis = 99999.99;
- for (x=0;x<MAX_PLAYERS;x++) {
- if(IsPlayerConnected(x)) {
- if(x != p1) {
- dis2 = GetDistanceBetweenPlayers(x,p1);
- if(dis2 < dis && dis2 != -1.00) {
- dis = dis2;
- player = x;
- }
- }
- }
- }
- return player;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement