Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Warn players camping on vehicle for 140 seconds
- -- if the players are still on vehicle another 14O seconds after the warning
- -- then players are punished as to say killed
- -- I miss phasor.
- api_version = "1.12.0.0"
- local warningCampTime = 140000
- function OnScriptLoad()
- register_callback(cb['EVENT_VEHICLE_ENTER'], "OnVehicleEnter")
- end
- function OnScriptUnload()
- end
- function OnVehicleEnter(PlayerIndex, Seat)
- timer(warningCampTime, "IsCampingVehiWarning", PlayerIndex)
- end
- function IsCampingVehiWarning(PlayerIndex)
- if(IsInVehi(PlayerIndex)) then
- say(PlayerIndex, "Stop camping vehicle")
- timer(warningCampTime, "IsCampingVehiPunishment", PlayerIndex)
- end
- return false
- end
- function IsCampingVehiPunishment(PlayerIndex)
- if(IsInVehi(PlayerIndex)) then
- say(PlayerIndex, "You have been warned...")
- kill(PlayerIndex)
- end
- return false
- end
- function IsInVehi(PlayerIndex)
- local PlayerObj = get_dynamic_player(PlayerIndex)
- local VehicleObjID = read_dword(PlayerObj + 0x11C)
- local vehicle = get_object_memory(VehicleObjID)
- if (vehicle ~= 0 and vehicle ~= nil) then
- return true
- end
- return false
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement