Guest User

Untitled

a guest
Oct 20th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.68 KB | None | 0 0
  1. function addCmds ( hitElement )
  2.         if ( getElementType ( hitElement ) == "vehicle" ) then
  3.             if( getElementModel ( hitElement ) == 535 ) then
  4.                 addCommandHandler ( "addsaftvanmod", slamvanMod )
  5.         else
  6.             outputChatBox ( "You need a vehicle to access the mod shop", source, 255, 0, 0 )
  7.             end
  8.     else
  9.         outputChatBox ( "You already have a Slamvan modded.", source, 255, 0, 0 )
  10.         end
  11.     end
  12. addEventHandler( "onMarkerHit", tbomstore, addCmds )
  13.  
  14. function removeCmds ( leftElement )
  15.     if ( getElementType ( leftElement ) == "vehicle" )  then
  16.         if( getElementModel ( leftElement ) == 535 ) then
  17.             removeCommandHandler ( "addsaftvanmod", slamvanMod )
  18.     else
  19.         outputChatBox ( "You need a vwouehicle to access the mod shop", source, 255, 0, 0 )
  20.         end
  21.     end
  22. end
  23. addEventHandler( "onMarkerLeave", tbomstore, removeCmds )
  24.  
  25.  
  26. function slamvanMod ( source )
  27.     if ( isPedInVehicle ( source ) ) then
  28.         if not getElementData( source, "moddedAlready" ) == 1 then
  29.             if ( getElementModel ( getPedOccupiedVehicle ( source ) ) == 535 ) then
  30.                 setElementData(getPedOccupiedVehicle(source), "moddedAlready", false )
  31.                 saftslamvanhood = createObject( 1005, 0, 0, -2000 )
  32.                 saftslamvanspoiler = createObject( 1001, 0, 0, -2000 )
  33.                 saftslamvanroof = createObject( 1006, 0, 0, -2000 )
  34.                 saftslamvanbv = createObject( 1143, 0, 0, -200 )
  35.                 saftslamvanbv2 = createObject( 1143, 0, 0, -2000 )
  36.                 attachElements(saftslamvanbv, getPedOccupiedVehicle( source ), 0.70, -1.85, 0.39, 0, 0)
  37.                 attachElements(saftslamvanspoiler, getPedOccupiedVehicle( source ), 0, -2.4, 0.4)
  38.                 attachElements(saftslamvanroof, getPedOccupiedVehicle( source ), 0, 0.2, 0.77)
  39.                 attachElements(saftslamvanhood, getPedOccupiedVehicle( source ), 0, 1.4, 0.42)
  40.                 attachElements(saftslamvanbv2, getPedOccupiedVehicle( source ), -0.70, -1.85, 0.39, 0, 0)
  41.                 outputChatBox ( "Slamvan mod was added successfully!", source, 0, 255, 0 )
  42.             else
  43.                 outputChatBox ( "This vehicle is not a Slamvan.", source, 255, 0, 0 )
  44.             end
  45.         else
  46.             outputChatBox ( "Thie vehicle is already modded.", source, 255, 0, 0 )
  47.         end
  48.     else
  49.         outputChatBox ( "You are not inside a Slamvan.", source, 0, 255, 0 )
  50.     end
  51. end
  52.  
  53. function destroySlamvanMod ( source )
  54.     for _,object in ipairs (getAttachedElements(getPedOccupiedVehicle( source ) ) ) do
  55.         destroyElement ( saftslamvanhood )
  56.         destroyElement ( saftslamvanspoiler )
  57.         destroyElement ( saftslamvanroof )
  58.         destroyElement ( saftslamvanbv )
  59.         destroyElement ( saftslamvanbv2 )
  60.         outputChatBox ( "Slamvan mod was removed successfully!", source, 0, 255, 0 )
  61.     end
  62. end
  63. addEventHandler ( "onPlayerLogout", getRootElement(), destroySlamvanMod )
  64. addCommandHandler ( "removesaftvanmod", destroySlamvanMod )
Add Comment
Please, Sign In to add comment