[Release] Roll Windows

release
roleplay
windows
rollwindow
script

#1

So I made a simple script which is pretty self explanatory,
if you type /rollw
the driver and passenger windows roll down, type it again, and they go up!

_resource.lua

-- RollWindows written by JAF
-- Made for www.lacountyrp.com
-- Version 1.0.0

resource_manifest_version '77731fab-63ca-442c-a67b-abc70f28dfa5'    --(Thank you @Vespura)

-- Add a client script 
client_script 'client.lua'

client.lua

local windowup = true
RegisterNetEvent("RollWindow")
AddEventHandler('RollWindow', function()
    local playerPed = GetPlayerPed(-1)
    if IsPedInAnyVehicle(playerPed, false) then
        local playerCar = GetVehiclePedIsIn(playerPed, false)
		if ( GetPedInVehicleSeat( playerCar, -1 ) == playerPed ) then 
            SetEntityAsMissionEntity( playerCar, true, true )
		
			if ( windowup ) then
				RollDownWindow(playerCar, 0)
				RollDownWindow(playerCar, 1)
				TriggerEvent('chatMessage', '', {255,0,0}, 'Windows down')
				windowup = false
			else
				RollUpWindow(playerCar, 0)
				RollUpWindow(playerCar, 1)
				TriggerEvent('chatMessage', '', {255,0,0}, 'Windows up')
				windowup = true
			end
		end
	end
end )

RegisterCommand("rollw", function(source, args, raw)
    TriggerEvent("RollWindow")
end, false) --False, allow everyone to run it(thnx @Havoc)

Enjoy! More scripts are coming!


Windows DOWN on ARROW KEY
#2

You know you can make this thing entirely client-side right? Just remove the “chatMessage” handler on the server and use the RegisterCommand native on the client.

Also, it’s bad practice to have no manifest version for the resource. You should at least use 77731fab-63ca-442c-a67b-abc70f28dfa5.

http://docs.fivem.net/resources/manifest-versions/


#3

had no idea what is does, remove it, script still works. What does that actually do?


#4

Also i don’t think many people care. They just want the script to work, but thanks, I’ll keep that in mind for later


#5

Talking about the RegisterCommand or the resource manifest?


Resource Manifest info

http://docs.fivem.net/resources/manifest/

…and…


Register Command Reference
http://runtime.fivem.net/doc/reference.html#_0x5fa79b0f


#6

I used the register command like on my other scripts, but didn’t seem to work, so i did it server sided,
thanks for answer tho


#7

Well, sorry to say, you used it wrong.

RegisterCommand("rollw", function(source, args, raw)
    TriggerEvent("RollWindow")
end, false) --False, allow everyone to run it

#8

Oh okay. i probably did,
I only started scripting a couple of weeks ago :confused:


#9

Not sure if someone can help, the mod works great clientside, but serverside the windows will go down but not up. any ideas?


#10

I will check that. Didnt realize this.


#11

Thank you, please keep me informed.


#12

Is there a download? Or do we just make a folder in resources called rollw and make the client script?


#13

Works just like any other resource.


#14

Did you check out the server side roll up not working? only shows for the client that does the action.


#15

@callmejaf my rollw folder wont load

PIC