Xabache Posted January 9, 2015 Share Posted January 9, 2015 At the center of the following otherwise fine top half of a function is my first successful code insertion outputChatBox("This works 002 " .. score .. " okay") Where it displays in the chat box This works 002 4.25 okay, with 4.25 being any score achieved, typically not a whole number. I want to make this number a whole number, if possible, then give that number in money to the player. I have tried a thousand times in a thousand ways... function showText() dxDrawText(string.format("",global_nombre,global_mejor),44,screenHeight-43,screenWidth,screenHeight,Yellow,1,"pricedown") vehicle = isValidVehicle() if not vehicle then return end if size > 1.3 then modo = -0.01 elseif size < 1.2 then modo = 0.01 end size = size + modo tick = getTickCount() local angulo,velocidad = angle() local tempBool = tick - (idleTime or 0) < 750 if not tempBool and score ~= 0 then anterior = score setElementData(player, "Last Drift", anterior) outputChatBox("This works 002 " .. score .. " okay") total = total+anterior setElementData(player, "Total Drift", total) if score > mejor then mejor = score setElementData(player, "Best Score", mejor) end triggerEvent("onVehicleDriftEnd", rootElem, tick-driftTime-750) score = 0 end Link to comment
Enargy, Posted January 9, 2015 Share Posted January 9, 2015 convert 4.25 in whole number? I cant understand you very well. Link to comment
John Smith Posted January 9, 2015 Share Posted January 9, 2015 math.floor -- or math.ceil -- e.g math.floor(score) Link to comment
Xabache Posted January 9, 2015 Author Share Posted January 9, 2015 Thank you NearGreen, for directing me how to make 4.25 the whole number, or integer 4. Leaving the primary problem, with no direction, how to award that number to the player with a raise in the Game's total $00000004? Link to comment
Enargy, Posted January 9, 2015 Share Posted January 9, 2015 you can multiply 4.25 by a value greater than 100, for example 4.25 * 100 = 425. the question is to play with the numbers. can you post the code where exactly the value 4.25 is defined? Link to comment
Xabache Posted January 9, 2015 Author Share Posted January 9, 2015 thanks i solved that with math.floor(x) the main question remains unsolved how to make .. score .. = money 4 points = $4 dollars to $00000000 I have tried a dozen unrelated examples for givePlayerMoney setPlayerMoney and cannot make any work in this example. outputChatBox("This works 002 " .. score .. " okay") it should go near this line ^^ Link to comment
John Smith Posted January 9, 2015 Share Posted January 9, 2015 givePlayerMoney(math.floor(score)) Link to comment
Xabache Posted January 9, 2015 Author Share Posted January 9, 2015 ...So I enter the Bank System (bank) to deposit the money acquired through the above mentioned method givePlayerMoney(math.floor(score)) to find this money is not real, it is theme only... how to solve this? I had no problem depositing $5 given to me by my admin console. Full Link to see right side of image: http://www.robertskyler.com/op/Fake-Money.jpg Link to comment
Dealman Posted January 9, 2015 Share Posted January 9, 2015 Money given to the player via client-side givePlayerMoney is considered "fake" by the server. You'll have to set their money server-side. Link to comment
Xabache Posted January 9, 2015 Author Share Posted January 9, 2015 little help here... givePlayerMoney ... not working. why> how fix? addEventHandler("driftNuevoRecord", root, function(score, name) outputChatBox("-" .. name .. score .. "-",source,255,255,255,true) givePlayerMoney(player name , score ) if score > drift_mejor then drift_mejor = score drift_nombre = name triggerClientEvent(root, "driftActualizarRecord", root, drift_mejor, drift_nombre) end end) Link to comment
Mizudori Posted January 9, 2015 Share Posted January 9, 2015 (edited) little help here... givePlayerMoney ... not working. why> how fix? addEventHandler("driftNuevoRecord", root, function(score, name) outputChatBox("-" .. name .. score .. "-",source,255,255,255,true) givePlayerMoney(player name , score ) if score > drift_mejor then drift_mejor = score drift_nombre = name triggerClientEvent(root, "driftActualizarRecord", root, drift_mejor, drift_nombre) end end) This is wrong syntax givePlayerMoney(player name , score ) Where is your player element? It's need to be your first variable If this is server side use client/source givePlayerMoney(source , score ) Edited January 10, 2015 by Guest Link to comment
Xabache Posted January 9, 2015 Author Share Posted January 9, 2015 givePlayerMoney(name , score ) Bad arguement @ givePlayerMoney [Expected Element at argument 1, got strng 'ExuberantHarbor7'] Link to comment
Mizudori Posted January 9, 2015 Share Posted January 9, 2015 givePlayerMoney(name , score )Bad arguement @ givePlayerMoney [Expected Element at argument 1, got strng 'ExuberantHarbor7'] You need to give money to element/player which is source addEventHandler("driftNuevoRecord", root, function(score, name) outputChatBox("-" .. name .. score .. "-",source,255,255,255,true) givePlayerMoney(source , score ) if score > drift_mejor then drift_mejor = score drift_nombre = name triggerClientEvent(root, "driftActualizarRecord", root, drift_mejor, drift_nombre) end end) Link to comment
Ficticious Posted January 10, 2015 Share Posted January 10, 2015 Wy do u need to create gui only create a command like /givemoney [playerName] [Amount] thats all i have the resource for this command if u need it i can give it for 6 dollars i have many other resources anyone who pays me 6 dollars ill help him to create servers and resources and many more advanced thing Huds,Weapons.etc. i receive payments from Paypal contact me in pm HERE IS A LIST OF RESOURCES I GOT 1.Admin shout system 2.Afk system 3.cctv sytem 4.Team system 5.Namestag (Shows name tags only to other players) 6.Crosshair (if a guy is of ur team then when you aim him u will get green sign on ur aim but if not then red) useful 7.Laserponter 8.2 huds means the screen tht appears ur Health Armour etc 9.VIP system panel 10.Team colour (shows ur team colour on ur name in scoreboard and on the minimap as a square or any icon whch i default) easy to recognise the teams on minimap These are the resources i can keep on sale 6$ for any three resources Thx. skype name (neelansh.mehta) Link to comment
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