Advertisement
FoxHound

vehParams Fixxer

Mar 7th, 2011
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.99 KB | None | 0 0
  1. /*
  2.  *                      Mini-INC
  3.  *          VehicleParams Automatic Fixxer
  4.  *       (c) Copyright 2010-2011 by FoxHound
  5.  *
  6.  * @author    : FoxHound aka PSPgamer_10
  7.  * @date      : 03 November 2010
  8.  * @version   : v 0.1
  9.  * @function_ : fixxes SetVehicleParams automatically
  10.  *
  11.  * This file is provided as is (no warranties).
  12.  *
  13.  */
  14.  
  15. #include <a_samp>
  16.  
  17. #define PLUG_n_PLAY //Uncomment this (remove the '//' before '#define', if you wanna use the Plug'n'Play Function, then you must ONLY write the name of this Script in your GameMode/FilterScript
  18.  
  19. forward VPF_OnVehicleStreamIn(vehicleid, forplayerid);
  20. forward VPF_SetVehicleParamsForPlayer(vehicleid,playerid,objective,doorslocked);
  21. forward SetVehicleParamsForAll(vehicleid,objective,doorslocked);
  22.  
  23. new vehP_objective[MAX_VEHICLES][MAX_PLAYERS],
  24.     vehP_doorslocked[MAX_VEHICLES][MAX_PLAYERS];
  25.  
  26. public VPF_SetVehicleParamsForPlayer(vehicleid,playerid,objective,doorslocked) //New Function
  27. {
  28.     vehP_objective[vehicleid][playerid] = objective;
  29.     vehP_doorslocked[vehicleid][playerid] = doorslocked;
  30.     if(IsVehicleStreamedIn(vehicleid,playerid))
  31.     {
  32.         SetVehicleParamsForPlayer(vehicleid,playerid,objective,doorslocked);
  33.     }
  34.     return 1;
  35. }
  36.  
  37. public SetVehicleParamsForAll(vehicleid,objective,doorslocked)
  38. {
  39.     for(new i=0;i<GetMaxPlayers();i++)
  40.     {
  41.         vehP_objective[vehicleid][i] = objective;
  42.         vehP_doorslocked[vehicleid][i] = doorslocked;
  43.         if(IsVehicleStreamedIn(vehicleid,i))
  44.         {
  45.             SetVehicleParamsForPlayer(vehicleid,i,objective,doorslocked);
  46.         }
  47.     }
  48.     return 1;
  49. }
  50.  
  51. public VPF_OnVehicleStreamIn(vehicleid, forplayerid) //Callback Function
  52. {
  53.     SetVehicleParamsForPlayer(vehicleid,forplayerid,vehP_objective[vehicleid][forplayerid],vehP_doorslocked[vehicleid][forplayerid]);
  54.     #if defined PLUG_n_PLAY
  55.         return CallLocalFunction("OnVehicleStreamIn","ii",vehicleid,forplayerid);
  56.     #else
  57.         return 1;
  58.     #endif
  59. }
  60.  
  61. #if defined PLUG_n_PLAY
  62.     #define OnVehicleStreamIn VPF_OnVehicleStreamIn
  63.     #define SetVehicleParamsForPlayer VPF_SetVehicleParamsForPlayer
  64. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement