-
Posts
1,105 -
Joined
-
Last visited
Everything posted by Aibo
-
you need to login to use admin commands.
-
executeSQLQuery("SELECT milk FROM database ORDER BY milk DESC")
-
so you expect people to check every line of that load of code you've posted? from what i can tell from quick look: 1. g_screenX, g_screenY, g_Me — not defined anywhere 2. lots of strange unused variables like dxDrawIsOn, gui._placeHolders 3. server file is not in meta.xml 4. server and client events absolutely different. etc etc it all looks like a part of some other resource(s), isn't it?
-
actually, people should use debugging before posting a problem here :3
-
facepalm.jpg
-
"console" here means player console (~ or F8 key ingame), not server console.
-
are you sure? :3 get some SQLite database manager (http://code.google.com/p/sqlite-manager/ for example) and check if there is anything in your database. because it looks like you've edited a wiki example from executeSQLQuery page. and no mentions here that anything was stored in your milk database. PS: better not call your table "database". it can be confusing and no way to tell to which resource it belongs.
-
would be also nice to have "Lua" BBCode button like we have "Code" button :3
-
milk stores wins?
-
i honestly do not understand what are you trying to do with "Your not dropcar man" stuff. so the only thing i can help with is to fix basic/syntax erorrs.
-
this is pure randomness: if getElementType ( hitElement) == "vehicle" then local playeraccount = getPlayerAccount ( hitElement) vehicle account? :В and you lost "end" that closes first "if".
-
blueTimers = {} -- vehicle table for your blue timers redTimers = {} -- for your red timers function EmergencyLights(source) local theVehicle = getPedOccupiedVehicle(source) -- getPlayerOccupiedVehicle() is deprecated -- thevehicle must be local, since we can have more than 1 player with vehicles if theVehicle then if getVehicleOverrideLights(theVehicle) ~= 2 then setVehicleOverrideLights(theVehicle, 2) blueTimers[theVehicle] = setTimer(setLight, 400, 1, theVehicle) -- vehicle element must be passed to the timer/function, since theVehicle is now local else setVehicleOverrideLights(theVehicle, 0) if isTimer(blueTimers[theVehicle]) then killTimer(blueTimers[theVehicle]) end if isTimer(redTimers[theVehicle]) then killTimer(redTimers[theVehicle]) end end end end function setLight(car) setVehicleHeadLightColor(car, 0, 0, 255) redTimers[car] = setTimer(setLight2, 400, 1, car) end function setLight2(car) setVehicleHeadLightColor(car, 255, 0, 0) blueTimers[car] = setTimer(setLight, 400, 1, car) end addCommandHandler("elights", EmergencyLights)
-
playerName = string.gsub(playerName, '#%x%x%x%x%x%x', '')
-
getMapRating requires map name passed to it. local g_Root = getRootElement() addEventHandler('onGamemodeMapStart', g_Root, function(startedMap) local mapName = getResourceName(startedMap) local getrate = call(getResourceFromName("mapratings"), "getMapRating", mapName) outputChatBox ("#EE2C2C*This map is rated "..getrate.."!", 255,255,255, true) end )
-
https://wiki.multitheftauto.com/wiki/Server_Manual though my personal opinion since mta:race days: if you don't know how to start a server — you don't need one.
-
you dont need to use conditions when altering a table, because whole table is affected.
-
people who do want to learn - will learn. people who do not - wont, no matter what and how you'll tell them
-
well then you need to make main timer server-side, and on client join send to him the time that's left, and start his timer for dx display with that value. server: timer = setTimer(function() -- something to do when timer stops maybe end, 600000, 1) addEvent("requestTimeLeft", true) addEventHandler("requestTimeLeft", getRootElement(), function() local ms = 0 if isTimer(timer) then ms = getTimerDetails(timer) end triggerClientEvent(source, "serverStartsTimer", getRootElement(), ms) end) client: timer = false addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() triggerServerEvent("requestTimeLeft", getLocalPlayer()) -- asking the server how much time left on client resource start end) addEvent("serverStartsTimer", true) addEventHandler("serverStartsTimer", getRootElement(), -- reply from the server with time left function(ms) timer = setTimer(outputChatBox, ms, 1, "Time's up!") -- setting the timer with time we got from server end) function getTimeLeft(timer) if isTimer(timer) then local ms = getTimerDetails(timer) local m = math.floor(ms/60000) local s = math.floor((ms-m*60000)/1000) if m < 10 then m = "0"..m end if s < 10 then s = "0"..s end return m..":"..s else return "--:--" end end addEventHandler("onClientRender", getRootElement(), function() if timer then -- to check if timer started dxDrawText(getTimeLeft(timer),sWidth-0,sHeight-600,sWidth-347,sHeight-0,tocolor(225,225,225,255),1.3,"diploma","right","top",false,false,false) -- Timer end end)
-
guess it has something to do with how Lua treat signed/unsigned 32bit integers, because: string.format("%X", "0x7F0000FF") returns 7F0000FF but string.format("%X", "0xFF0000FF") returns FF000100 idk why, maybe some Lua pros will explain
-
oh my god timer = setTimer(outputChatBox, 600000, 1, "Time's up!") function getTimeLeft(timer) if isTimer(timer) then local ms = getTimerDetails(timer) local m = math.floor(ms/60000) local s = math.floor((ms-m*60000)/1000) if m < 10 then m = "0"..m end if s < 10 then s = "0"..s end return m..":"..s else return "--:--" end end addEventHandler("onClientRender", getRootElement(), function() dxDrawText(getTimeLeft(timer),sWidth-0,sHeight-600,sWidth-347,sHeight-0,tocolor(225,225,225,255),1.3,"diploma","right","top",false,false,false) -- Timer end)
-
instead of "tostring(timer)" place "getTimeLeft(timer)", assuming the "timer" variable exists.
-
since they are passed to the function the are local by default, or am i mistaken?
-
ok, but i'm looking for a more efficient way to get tocolor() value (since it's a signed integer) from RGB, possibly without using tocolor(). according to wiki, dx function can use hex AARRGGBB format for color, and they do, problem is (when ive tried simply put hex color without all those tonumber()'s and stuff): 0xFFFF0000 -- is red 0xFF00FF00 -- is green 0xFF0000FF -- is black (?) but 0x7F0000FF -- is blue (with half opacity) something to do with signed integers messed up somewhere, or i'm dumb
