FuriouZ Posted June 30, 2013 Posted June 30, 2013 Hello,help me with this,i need to convert it only client-side.. Client: local delayvalue = false datmarker = createMarker (4805.2998,-1599.5,20,"corona",5,12,7,77,153) function changeVehFunc ( hitPlayer, matchingDimension ) if (matchingDimension and hitPlayer == localPlayer) then if delayvalue == false then triggerServerEvent("changeVeh", localPlayer) delayvalue = true setTimer(function () delayvalue = false end, 1500, 1) end end end addEventHandler("onClientMarkerHit", datmarker, changeVehFunc) Server: vehicles = {602,545,496,517,401,410,518,600,527,436,589,580,419,439533,549,526,491,474,445,604,507,585,587,466,492,546,551,516,467,426,547,405,409,550,566,540,421,529,581,509,481,462,521,463,510,522,461,448,468,586,485,552,431,438,437,574,420,525,408,416,433,427,490,528,407,544,523,470,598,596,597,599,601,428,499,609,498,524,532,578,486,406,573,455,588,403,514,423,414,443,515,531,456,459,422,482,605,530,418,572,582,413,440,543,583,478,554,536,575,534,567,535,576,412,402,542,603,475,568,424,504,457,483,508,571,500,444,556,557,471,495,539,429,541,415,480,562,565,323,492,502,503,411,559,561,560,506,451,558,555,477,579,400,404,489,505,479,442,458} function changeVehicle (state) if state == "Running" then setTimer (function () local players = getAlivePlayers () for playerKey, playerValue in ipairs(players) do setElementModel (getPedOccupiedVehicle(playerValue), vehicles[math.random(#vehicles)]) end end, 1000, 1) end end addEvent("onRaceStateChanging", true) addEventHandler ("onRaceStateChanging", getRootElement (), changeVehicle) function changePlayersVeh () setElementModel (getPedOccupiedVehicle(source), vehicles[math.random(#vehicles)]) end addEvent("changeVeh", true) addEventHandler("changeVeh", getRootElement(), changePlayersVeh) Homepage @ http://rageresources.blogspot.com/ Offical Facebook @ https://www.facebook.com/pages/Rage-Scr ... fref=photo
bandi94 Posted June 30, 2013 Posted June 30, 2013 it's not possible bk "getAlivePlayers ()" it's only server side. And there is a reason why it has server side to . Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
Castillo Posted June 30, 2013 Posted June 30, 2013 You can create your own function, you don't have to use the native one. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
FuriouZ Posted June 30, 2013 Author Posted June 30, 2013 Well,i basically i need that,if i hit that marker (x,y,z),then i get another car..It need to be possible someway.. Homepage @ http://rageresources.blogspot.com/ Offical Facebook @ https://www.facebook.com/pages/Rage-Scr ... fref=photo
Moderators IIYAMA Posted June 30, 2013 Moderators Posted June 30, 2013 Why the f* is it too hard to do this? local players = getElementsByType("player") for playerKey, playerValue in pairs(players) do if getElementHealth(playerValue)>0 then setElementModel (getPedOccupiedVehicle(playerValue), vehicles[math.random(#vehicles)]) end end The rest is yours. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
FuriouZ Posted July 1, 2013 Author Posted July 1, 2013 Why the f* is it too hard to do this?Because i am NOT that good as you in scripting -.- Homepage @ http://rageresources.blogspot.com/ Offical Facebook @ https://www.facebook.com/pages/Rage-Scr ... fref=photo
Moderators IIYAMA Posted July 1, 2013 Moderators Posted July 1, 2013 Learn the basic first, instead of requesting scripting modifications (of work from other people). Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now