Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Tazer Script by SlashQ
- This is a simple tazer script done in about 3 minutes. This will ONLY work for
- cop skins, and not everyone else. However, this can be adjusted.
- The SECONDS define means amount of seconds that the tazed player will get
- unfrozen and go back to normal in (10 by default).
- The TAZE_MS define means amount of milliseconds that the function
- "OnPlayerTazePlayer" gets called in each time (400 by default).
- Now look at the IsNotCop define, and change:
- ((GetPlayerSkin(%0) < 280 && GetPlayerSkin(%0) > 288))
- to ((PlayerInfo[%0][pMember] != 1))
- Or whatever variable you use for teams. Enjoy!
- */
- #include <a_samp>
- #tryinclude <angdist>
- #if !defined IsPlayerAimingAtPlayer
- #error You need the 'angdist' include. You can get it at the release topic.
- #endif
- #define SECONDS 10
- #define TAZE_MS 400
- #define IsNotCop(%0) ((GetPlayerSkin(%0) < 280 && GetPlayerSkin(%0) > 288))
- forward Unfreeze(playerid);
- forward OnPlayerTazePlayer(playerid);
- public OnFilterScriptInit() {
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- SetPVarInt(i, "TazeTimer", SetTimerEx("OnPlayerTazePlayer", TAZE_MS, true, "i", i));
- }
- return 1;
- }
- public OnPlayerConnect(playerid) {
- SetPVarInt(playerid, "TazeTimer", SetTimerEx("OnPlayerTazePlayer", TAZE_MS, true, "i", playerid));
- return 1;
- }
- public OnPlayerDisconnect(playerid) {
- KillTimer(GetPVarInt(playerid, "TazeTimer"));
- return 1;
- }
- public OnPlayerTazePlayer(playerid) {
- new
- Keys[3];
- GetPlayerKeys(playerid, Keys[0], Keys[1], Keys[2]);
- if(Keys[0] & KEY_FIRE) {
- if(IsNotCop(playerid)) return 1;
- else {
- if((GetPlayerWeapon(playerid) == 23) && (GetPVarInt(playerid, "HasTazer")) == 1) {
- new targetid = 0;
- while ((targetid < MAX_PLAYERS) && (IsPlayerConnected(targetid))) {
- if(GetDistanceBetweenPlayers(playerid, targetid) >= 4) {
- if(IsPlayerAimingAtPlayer(playerid, targetid) == 1) {
- if(IsPlayerInAnyVehicle(targetid) == 0 && IsPlayerInAnyVehicle(playerid) == 0) {
- if(targetid != playerid) {
- // Feel free to add some other stuff here...
- // Remember, variable 'targetid' is the player who got tazed!
- if(GetPVarInt(targetid, "Tazed") == 1) return 0;
- ApplyAnimation(targetid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
- TogglePlayerControllable(targetid, 0);
- SetTimerEx("Unfreeze", (SECONDS * 1000), false, "i", targetid);
- SetPVarInt(targetid, "Tazed", 1);
- }
- }
- }
- }
- targetid ++;
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[]) {
- if(!strcmp(cmdtext, "/tazer", true)) {
- if(IsNotCop(playerid))
- return 1;
- if(GetPVarInt(playerid, "HasTazer") == 0) {
- SetPVarInt(playerid, "HasTazer", 1);
- GivePlayerWeapon(playerid, 23, 65500);
- SendClientMessage(playerid, 0xFFFF00FF, "Tazer unholstered.");
- }
- else {
- DeletePVar(playerid, "HasTazer");
- SetPlayerAmmo(playerid, 23, 0);
- SendClientMessage(playerid, 0xFFFF00FF, "Tazer holstered.");
- }
- return 1;
- }
- return 0;
- }
- public Unfreeze(playerid) {
- TogglePlayerControllable(playerid, 1);
- DeletePVar(playerid, "Tazed");
- return ClearAnimations(playerid);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement