Want more features on Pastebin? Sign Up, it's FREE!
Guest

[FS]ChemTrails

By: yugecin on Mar 25th, 2012  |  syntax: PAWN  |  size: 4.01 KB  |  views: 163  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /*************************************************************
  2.  Chemtrails Filterscript
  3.  -» Author             : Claerhout Robin (yugecin)
  4.  -» Release Date       : 25th March 2012
  5.  -» Description        : Chemtrails for planes (not at-400 and andromada)
  6.  -» Video              : http://www.youtube.com/watch?v=r0MTiZ9xppU
  7.  -» forum post         : http://forum.sa-mp.com/showthread.php?t=328612
  8. **************************************************************/
  9. #include <a_samp>
  10. new ctrails[MAX_PLAYERS][2];
  11. public OnFilterScriptInit() return print("[FS]ChemTrails Loaded!");
  12. public OnFilterScriptExit() {
  13.         for(new i=0; i < MAX_PLAYERS+1; i++){
  14.                 if(ctrails[i][0]){
  15.                 DestroyObject(ctrails[i][0]);
  16.                 DestroyObject(ctrails[i][1]);
  17.                 ctrails[i][0] = 0;
  18.                 }
  19.         }
  20.         return print("[FS]ChemTrails Unloaded!");
  21. }
  22.  
  23. public OnPlayerCommandText(playerid, cmdtext[])
  24. {
  25.         if(!strcmp(cmdtext, "/ctrails", true)) {
  26.             //460 skimmer
  27.                 //520 hydra
  28.                 //511 beagle
  29.                 //512 cropduster
  30.                 //513 stuntplane
  31.                 //593 dodo
  32.                 //553 nevada
  33.                 //476 rustler
  34.                 //519 shamal
  35.             if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFF0000AA, "[Chemtrails] {FFFFFF}You must be in a supported plane!");
  36.             if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid, 0xFF0000AA, "[Chemtrails] {FFFFFF}You must be the driver!");
  37.             new Float:x, Float:y, Float:z;
  38.             switch(GetVehicleModel(GetPlayerVehicleID(playerid))){
  39.                 case 460: {
  40.                     x = 5.3;
  41.                     y = 0.0;
  42.                     z = -0.6;
  43.                 }
  44.                 case 476: {
  45.                     x = 5.3;
  46.                     y = 0.9;
  47.                     z = -2.0;
  48.                 }
  49.                 case 511: {
  50.                     x = 10.3;
  51.                     y = -1.0;
  52.                     z = -1.25;
  53.                 }
  54.                 case 512: {
  55.                     x = 5.3;
  56.                     y = 1.0;
  57.                     z = -0.4;
  58.                 }
  59.                 case 513: {
  60.                     x = 4.0;
  61.                     y = 0.0;
  62.                     z = -1.0;
  63.                 }
  64.                 case 519: {
  65.                     x = 9.7;
  66.                     y = -2.0;
  67.                     z = -1.8;
  68.                 }
  69.                 case 520: {
  70.                     x = 4.75;
  71.                     y = -1.0;
  72.                     z = -2.0;
  73.                 }
  74.                 case 553: {
  75.                     x = 14.0;
  76.                     y = 0.5;
  77.                     z = -1.25;
  78.                 }
  79.                 case 593: {
  80.                     x = 6.0;
  81.                     y = 0.0;
  82.                     z = -0.5;
  83.                 }
  84.                 default: return SendClientMessage(playerid, 0xFF0000AA, "[Chemtrails] {FFFFFF}You have to be in a supported plane!");
  85.             }
  86.                 if(ctrails[playerid][0]){
  87.                 DestroyObject(ctrails[playerid][0]);
  88.                 DestroyObject(ctrails[playerid][1]);
  89.                 ctrails[playerid][0] = 0;
  90.                 return 1;
  91.                 }
  92.             ctrails[playerid][0] = CreateObject(18728, 0.0, 0.0, 0.0, 0.0, 0.0, 256.0);
  93.             ctrails[playerid][1] = CreateObject(18728, 0.0, 0.0, 0.0, 0.0, 0.0, 256.0);
  94.             AttachObjectToVehicle(ctrails[playerid][0], GetPlayerVehicleID(playerid), x, y, z, 0.0, 0.0, 0.0);
  95.             AttachObjectToVehicle(ctrails[playerid][1], GetPlayerVehicleID(playerid), -x, y, z, 0.0, 0.0, 0.0);
  96.             return 1;
  97.         }
  98.         return 0;
  99. }
  100.  
  101. public OnPlayerStateChange(playerid, newstate, oldstate)
  102. {
  103.         if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT){
  104.         if(ctrails[playerid][0]){
  105.                 DestroyObject(ctrails[playerid][0]);
  106.                 DestroyObject(ctrails[playerid][1]);
  107.                 ctrails[playerid][0] = 0;
  108.                 }
  109.     }
  110.         if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_WASTED){
  111.         if(ctrails[playerid][0]){
  112.                 DestroyObject(ctrails[playerid][0]);
  113.                 DestroyObject(ctrails[playerid][1]);
  114.                 ctrails[playerid][0] = 0;
  115.                 }
  116.     }
  117.         return 1;
  118. }
  119.  
  120. public OnPlayerConnect(playerid) ctrails[playerid][0] = 0;
  121. public OnPlayerDisconnect(playerid, reason)
  122. {
  123.    if(ctrails[playerid][0]){
  124.         DestroyObject(ctrails[playerid][0]);
  125.         DestroyObject(ctrails[playerid][1]);
  126.         ctrails[playerid][0] = 0;
  127.         }
  128. }
clone this paste RAW Paste Data