Search the Community
Showing results for tags 'clientside'.
-
Map loader This is a map loader, which can let specific players download a map of choice. Maps will be generated clientside and the resource is capable of loading extreme large maps. Loading the map will be done with a speed the pc can handle. The code execution time will be reduced to circa 10 ms. Which is the frame time of a player with 100 fps. So technically when you have 100 fps you still have 98/100 fps when this resource is loading a map. But this is based on running only this resource and based on predictions/knowledge. Which you can't trust... The .map files are unloaded afterwards reading them. But the resource will keep a buffer of the processed data until no more players are using that map. This will speed up the resource when it is used for multiply players. The resource can be managed with the following functions (serverside): loadMapForTarget() Require: element player/root, string mapName Returns: boolean success, string message unloadMapForTarget() Require: element player/root, string mapName Returns: boolean success, string message getPlayerDownloadProgress() Require: element player Returns: int percentages or boolean false Version 1.0.1 or higher getPlayerMapStatus() Require: element player, string mapName Returns: string status or boolean false Status list: string "DOWNLOADING" -- Player is downloading the map. string "LOADING" -- Player is generating/loading the map string "LOADED" -- Player has loaded the map. boolean false -- Player value is invalid or the player hasn't started downloading this map. Events(serverside): "onPlayerLoadedMap" Source: element player Parameters: string mapName int loadTime "onPlayerUnloadedMap" Source: element player Arguments: string mapName Version 1.0.1 or higher "onPlayerCancelMapDownload" Source: element player Arguments: string mapName Events(clientside): "onClientPlayerLoadedMap" Source: element localPlayer Arguments: string mapName, int loadTime "onClientPlayerUnloadedMap" Source: element localPlayer Arguments: string mapName The same information about the functions and the events can be found inside the meta.xml Element types that are supported: objects, peds, vehicles, markers and pickups If you found any bugs, which might be in there. Don't be shy and let me know, I will exterminate them. And don't forget, this resource require some rights in order to read map files from other resources: DOWNLOAD 1.0.2 For developers a quick source code preview: Server Client
- 14 replies
-
- 1
-
Im working on a script wich create flames on the Thrusters of a vehicle (Mammoth Thruster of GTA Online), works well if you are the only that has a Thruster, but if someone also has a Thruster and gets out the vehicle, your Thruster will keep the attached elements and will not destroy the flames if you get out of the vehicle: Here is a video of what is happening: https://www.youtube.com/watch?v=Q3z9fdnBG0w and serverside and clientside scripts that are involved Serverside: (Functions for creating the flames) function LightOn(vehicle, x, y, z) if thePlayer ~= localPlayer then return end light = createMarker ( x , y , z, "corona", 0.5, 255, 160, 0, 170 ) attachElements(light, vehicle, 0, -0.3, -0.8) end addEvent("lighton", true) addEventHandler("lighton", getRootElement(), LightOn) function LightOff() if thePlayer ~= localPlayer then return end if light then destroyElement(light) end end addEvent("lightoff", true) addEventHandler("lightoff", getRootElement(), LightOff) function ThrustersOn(vehicle, x, y, z) if thePlayer ~= localPlayer then return end superhitbox = createObject (3471, x , y , z) setElementAlpha(superhitbox, 0) firethrustl = createObject (2031, x , y , z) firethrustr = createObject (2031, x , y , z) attachElements(superhitbox, vehicle, 0, -10, -1) attachElements(firethrustl, vehicle, 0.47, -0.4, -0.2) attachElements(firethrustr, vehicle, -0.47, -0.4, -0.2) setElementCollisionsEnabled(firethrustl, false) setElementCollisionsEnabled(firethrustr, false) end addEvent("thrusterson", true) addEventHandler("thrusterson", getRootElement(), ThrustersOn) function ThrustersOff() if thePlayer ~= localPlayer then return end if not firethrustl then return end destroyElement(firethrustl) destroyElement(firethrustr) end addEvent("thrustersoff", true) addEventHandler("thrustersoff", getRootElement(), ThrustersOff) Clientside: (Functions that triggers serverside events when you are in the Thruster) Thruster = 465 function SitOnThruster(thePlayer) if thePlayer ~= localPlayer then return end local vehicle = getPedOccupiedVehicle(localPlayer) if ( vehicle and getElementModel (vehicle) == Thruster ) then bindKey("vehicle_fire", "down", shootProjectile) triggerServerEvent ( "onthruster", resourceRoot) local x, y, z = getElementPosition(vehicle) local h, m = getTime() triggerServerEvent("thrusterson", getRootElement(), vehicle, x, y, z) if h > 20 then triggerServerEvent("lighton", getRootElement(), vehicle, x, y, z) else return end end end addEventHandler ( "onClientVehicleEnter", root, SitOnThruster ) function Notsit(thePlayer) if thePlayer ~= localPlayer then return end if Thruster then triggerServerEvent("thrustersoff", getRootElement(), vehicle, x, y, z) triggerServerEvent("lightoff", getRootElement(), vehicle, x, y, z) else return end end addEventHandler ( "onClientVehicleExit", root, Notsit ) function killed() if Thruster then if (isPedInVehicle(localPlayer) and Cars[getElementModel(getPedOccupiedVehicle(localPlayer))]) then if getPedOccupiedVehicleSeat ( localPlayer ) == 1 then return end triggerServerEvent("thrustersoff", getRootElement(), vehicle, x, y, z) triggerServerEvent("lightoff", getRootElement(), vehicle, x, y, z) else return end end end addEventHandler ( "onClientPlayerWasted", localPlayer, killed ) function shootProjectile() if not disparado then local vehicle = getPedOccupiedVehicle(localPlayer) if ( vehicle and getElementModel (vehicle) == Thruster ) then if isVehicleOnGround(vehicle) == false then local x, y, z = getElementPosition(vehicle) projectile = createProjectile(vehicle, 15, x, y+4, z-10) disparado = true setTimer ( function() disparado = false end, 1500, 1 ) else local x, y, z = getElementPosition(vehicle) createProjectile(vehicle, 15, x, y, z-3) disparado = true setTimer ( function() disparado = false end, 1500, 1 ) end end end end I'm very confused, i'm trying to make the script only create element for each player.
- 2 replies
-
- destroyelement
- problem
-
(and 6 more)
Tagged with:
-
I got a problem with created effects. In normal dimension I created an effect that is attached to the player's vehicle. The problem is that players from other dimensions can see it too moving around. Any idea how I can restrict the effects only for dimension 0? local attachedEffects = {} function getPositionFromElementOffset(element,offX,offY,offZ) local m = getElementMatrix ( element ) -- Get the matrix local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] -- Apply transform local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] return x, y, z -- Return the transformed point end function attachEffect(effect, element, pos) attachedEffects[effect] = { effect = effect, element = element, pos = pos } addEventHandler("onClientElementDestroy", effect, function() attachedEffects[effect] = nil end) addEventHandler("onClientElementDestroy", element, function() attachedEffects[effect] = nil end) return true end addEventHandler("onClientPreRender", root, function() for fx, info in pairs(attachedEffects) do local x, y, z = getPositionFromElementOffset(info.element, info.pos.x, info.pos.y, info.pos.z) setElementPosition(fx, x, y, z) end end ) local fire = {} function createCustomEffect(player, vehicle, value) if value then local x, y, z = getElementPosition(vehicle) if not fire[player] then fire[player] = createEffect("fire_bike", x, y, z, 0, 0, 0, 0, true) attachEffect(fire[player], vehicle, Vector3(0, 0, 0)) setElementDimension(fire[player], 0) end else if fire[player] then attachedEffects[fire[player]] = nil destroyElement(fire[player]) fire[player] = nil end end end addEvent("triggerCustomEffect", true) addEventHandler("triggerCustomEffect", root, createCustomEffect) The event is triggered in server when a player enters a vehicle, motorcycle in this case. Attaching functions are taken from 'MTA Wiki > Suggested functions function onPlayerVehicleEnter(vehicle, seat, jacked) if getElementModel(vehicle) == 463 then if seat == 0 then triggerClientEvent("triggerCustomEffect", source, source, vehicle, false) end end end addEventHandler("onPlayerVehicleExit", root, onPlayerVehicleEnter)
- 4 replies
-
- effect
- clientside
-
(and 2 more)
Tagged with:
-
Hi I'm getting a error on debugscript each time I start the resource, could anyone explain to me the cause of this error ? Thanks for any help ..
- 13 replies
-
- serverside
- clientside
-
(and 2 more)
Tagged with:
-
I saw a server that shows me custom hud on my screen such as pictures and texts, I opened my files and I saw that only the pictures of this server have downloaded without even a one clientside script, how they have done that? thanks for helpers
-
Estou criando um script de eventos, nesse script o admin pode criar 1 evento de cada vez e os jogadores podem participar caso queiram. O que estou com dificuldade seria para eventos de corrida, pois como a maioria deve saber, os mapas de corrida simplesmente não funcionam se não estiver no gamemode race. Só que se eu alterar o gamemode do server, vai mudar para todo mundo, inclusive pra quem não está participando do evento. Eu gostaria de saber se é possível alterar o gamemode para somente alguns jogadores ou então algum jeito de ativar um mapa de corrida específico sem alterar o gamemode atual do servidor. O mapa é escolhido no script de evento pelo admin. Eu estava dando uma olhada no resource 'race' e vi que ele ativa uma série de outros resources junto, como por exemplo o votemanager dos mapas, placares, contagem regressiva, tempo de corrida, etc...No meu script a maioria deles não será necessário. No gamemode race, ele carrega outro mapa de corrida automaticamente após terminar a corrida atual, mas no meu script o evento deve terminar e os jogadores voltam para a posição que estavam antes de participar.
- 17 replies
-
- race
- clientside
-
(and 1 more)
Tagged with:
-
Hello there, I could never figure out myself proper way to make markers bouncing like in vanilla gta sa. I have tried moveObject in clientside but doesn't seem to work well. Anyone having ideas, what functions I should use in order to create bouncing arrow marker?