Jump to content

Aibo

Retired Staff
  • Posts

    1,105
  • Joined

  • Last visited

Everything posted by Aibo

  1. ehm, you're getting player serial in both «name» and «pass» variables.
  2. Aibo

    Maps by SOAD

    as it says in description of youtube tag: use ID string of the video only. which is: youtube.com/watch?v=RG5NpNTykG0&feature
  3. make a grid then like 1 grid unit = X GTA units. and on object creation round the values to fit in grid and then place it. you can also try something with https://wiki.multitheftauto.com/wiki/Get ... oundingBox
  4. everything i wanted to post was already posted while i was typing. PS: and dont forget to login as admin.
  5. player functions gets player elements when you parse getRootElement(), it does work never thought of/tried that. my bad then
  6. Aibo

    wtf error?

    nil is not boolean it's just some function that returns position returned «false»
  7. what are you trying to do exactly? givePlayerMoney(getRootElement(), 1000) wont work either way, because getRootElement() is not a player element.
  8. https://wiki.multitheftauto.com/wiki/Scoreboard
  9. Aibo

    Function..Help

    while i was typing answer already was posted. though i'd like to add that it wont find «Drift» in «driftking», cause it is case-sensitive. you can convert strings to lower/upper case, for example. and also it will «return» on the first iteration (because of «else return» means return without any conditions), so it will check only first player in list function getPlayerFromNamePart(name) local player = getPlayerFromName(name) -- check if it is already a full player name if player then return player end for i, player in ipairs(getElementsByType("player")) do -- loop thru all players if string.find(getPlayerName(player):lower(), name:lower(), 1, true) then -- search for name part in player name return player -- return player element if a match found end end return false end
  10. onClientPreRender triggered before every frame, so you're attaching the function to it everytime in itself. place addEventHandler somewhere outside that function, so it would be called once. https://wiki.multitheftauto.com/wiki/OnClientPreRender
  11. https://wiki.multitheftauto.com/wiki/Resource:Runcode
  12. if this function is a handler for onClientGUIClick then thePlayer here is mouse button string, not player element. and also if you want to actually use this vehicle, create it server-side: https://wiki.multitheftauto.com/wiki/CreateVehicle
  13. function wordCensor(word) local asterisk = "*" local hide = word:sub(2, #word-1) return word:gsub(hide, asterisk:rep(#hide)) end for example: wordCensor("banana") will return b****a heh. I wanted to do it yourself yuo still have a lot to do
  14. yep, i had some speculations about frame time, thanks for the clarification. honestly, i dont see a point in using onClientRender either, since FPS are not that constant also. guess it was a bad idea from the start.
  15. function wordCensor(word) local asterisk = "*" local hide = word:sub(2, #word-1) return word:gsub(hide, asterisk:rep(#hide)) end for example: wordCensor("banana") will return b****a
  16. currently im making something liek a «tracker» (aha, i know it IS stupid ), and using timer to play sounds and stuff. so milliseconds for the timer are calcutated from BPM (beats per minute) like this: ms = math.floor(60000/bpm/4) thing is, for example: INFO: BPM: 89 - timer ms: 168 INFO: BPM: 111 - timer ms: 135 looks like 135 and 168 ms have absolutely no difference for the timer (89 and 111 BPM plays the same), so i am wondering what is the exact timer ms "precision", or "steps" maybe, cause right now i cant directly convert any BPM value to timer ms. PS: resource is here: https://community.multitheftauto.com/index.php?p= ... ls&id=1355
  17. because getLocalPlayer() is a client function.
  18. server-side command handler passes 1. player element as 1st argument 2. command name as 2nd 3. rest are command arguments player typed so getPlayerCash (source, cmd, player) wont work, use: function getPlayerCash (player, cmd, otherguy) player = getPlayerFromName(otherguy) or player local playerPoints = loadPlayerData (player, 'cash') outputChatBox (getPlayerName(player)..' #FF0000has '..tostring (playerPoints)..'$!', root, 255, 0, 0, true) end
  19. Aibo

    2 Questions

    add the dxDrawColorText function somewhere there, and use it instead of dxDrawText. arguments are the same but i havent made text alignment support there (yet?), so "center", "bottom" wont work.
  20. Aibo

    2 Questions

    don't works T_T works, i've tested, check your syntax.
  21. elseif (type(string.find(message,"bampot")) == "number") then and 600+ lines total. really? http://lua-users.org/wiki/TablesTutorial http://lua-users.org/wiki/ForTutorial http://lua-users.org/wiki/PatternsTutorial
  22. rubber has nothing to do with it, i had those issues too.
  23. Aibo

    2 Questions

    1. viewtopic.php?f=91&t=30227#p328304 2. if you post some code, at least say what problem exactly are you having with it, not just "what's wrong". addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), function() executeSQLCreateTable ( "pointsystem", "points INT, serial TEXT" ) end) addEventHandler ("onPlayerJoin",getRootElement(), function() local serial = getPlayerSerial(source) -- executeSQLUpdate ( "pointsystem", "serial = '"..serial.."'") -- ^^^ this query will affect ALL rows and set this serial everywhere. -- use condition string end) addEventHandler ("onPlayerRaceWasted",getRootElement(), function() local serial = getPlayerSerial(source) local Points = executeSQLSelect ( "pointsystem", "points","serial = '" .. serial .. "'") local givepoints2 = tonumber(Points[1]["points"]) + 3 executeSQLUpdate ( "pointsystem", "points = '"..givepoints2.."'","serial = '" .. serial .. "'" ) -- ^^^ SQL update will work if player's serial already in DB -- if it's not you should use executeSQLInsert() outputChatBox("#ff0000You reicive 3 points!",getRootElement(),255,0,0,true) end) function checkWinAndIfWinGiveWinCash () local getrank = exports.race:getPlayerRank(source) if (getrank == 1) then local serial = getPlayerSerial(source) local Points = executeSQLSelect ( "pointsystem", "points","serial = '" .. serial .. "'") local player = allAlivePlayers[1] -- where is allAlivePlayers defined? local playerCount = getPlayerCount() local pointsToWin = playerCount * 2 local givepoints = tonumber(Points[1]["points"]) + pointsToWin executeSQLUpdate ( "pointsystem", "points = '"..givepoints.."'","serial = '" .. serial .. "'" ) outputChatBox ("#ff0000["..getPlayerName(player).." #ff0000wins "..pointsToWin.." points]",getRootElement(),255,0,0,true) end end addEventHandler ("onPlayerWasted",getRootElement(),checkWinAndIfWinGiveWinCash) addEventHandler ("onPlayerQuit",getRootElement(),checkWinAndIfWinGiveWinCash) strange events you use, and i'd advise you lo load data from DB on player join and save it back on exit.
  24. Aibo

    goto line

    i dont think it is, not in an easy way at least.
×
×
  • Create New...