Jump to content

Aibo

Retired Staff
  • Posts

    1,105
  • Joined

  • Last visited

Everything posted by Aibo

  1. and then you go to the scripting basics function giveArmor() local pC= getAlivePlayers() if (#pC >= 1 and #pC <= 3) then for id, player in ipairs(pC) do setPedArmor(player, 50) outputChatBox(getPlayerName(player).." has won 50% Armor For Alive on Round", root) outputChatBox("You Have won Free Armor for be Alive in Round", player) end end end
  2. because your element data is not synced. you set it only once, on player join (i assume he has 0 armor at that time) and never update it. also there's no real need for setting armor as element data, you can use getPedArmor() both in client and server to get the current armor value. PS: just noticed, why getPlayerMoney() goes into health variable?
  3. "if ( pC >= 1 or 2 or 3) then" will always return true (well in your case it will return table-number comparison error), read about operator precedence in Lua. and logical operators. and Lua.
  4. I've just corrected errors. almost every line in this script has errors, and the whole thing has no logic to it. you didnt "fixed" it all. and even then ">= 1" is not what topic starter wants. function() -- no function name local pC= getAlivePlayers() -- SERVER function, which returns a TABLE if ( pC >= 1 ) then -- not gonna work, pC is a TABLE for id, player in ipairs ( getElementsByType ( "player" ) ) do -- why ALL players now? setPlayerArmor ( player, 50 ) -- probably single correct line (oh wait, its not: setPedArmor) outputChatBox(..getPlayerName..Has won 50% Armor For Alive on Round,root,") -- ↑ no quotes, no function call, total mess at its finest outputChatBox("You Have won Free Armor for be Alive in Round",getLocalPlayer() -- missing parenthesis -- ↑ also getLocalPlayer is a CLIENT function, and you have SERVER function above. wtf? end end -- no end for the function -- PS oh look even forum lua highligther is freaked out.
  5. if you're setting from server and getting the data in client only once on script start there's a chance it is not properly synced yet. try moving your getElementData part inside stats() function.
  6. it does not, because it's a total mess.
  7. data shown in the scoreboard is taken from element data. so: function idtag(text, msgtype) local tag = getElementData(source, "ID") -- its source, not thePlayer if tag then cancelEvent() local name = getPlayerName(source) outputChatBox("#FF0000["..tag.."] #FFFFFF"..name..": "..text, root, 255, 255, 255, true) outputServerLog(name .. ": " .. text) end end addEventHandler("onPlayerChat", root, idtag)
  8. seems like you took some yourself, judging by "thePlayer" variable that doesn't even exist in your handler function.
  9. idlist = { 411, 558, 423, 435 } -- table of your ids to select from vehid = idlist[math.random(#idlist)] vehicle = createVehicle(vehid,0,0,-50)
  10. Steam: Valve Corporation XFire: MTV Networks bottom line: not gonna happen. unless you're willing to invest $ and hire people for this.
  11. function fckingMinutesHowDoTheyWork(minutes) return minutes*60*1000 end
  12. client-side does't have access to accounts and related functions, obviously. you'll have to use server for that.
  13. search for SQLite managers in google, there are few around. even firefox addon: https://addons.mozilla.org/en-US/firefo ... e-manager/
  14. if you do it that way, callback function should be: function result(ip, country) outputServerLog("IP: "..ip..", country: "..country) end
  15. а по-моему все правильно (кроме запятой): string.match('test','[a-zA-Z]') --> "t" string.match('test2[notvalid]','[a-zA-Z]') --> "t" -- что не хорошо not string.match('test','[^a-zA-Z]') --> true not string.match('test2[notvalid]','[^a-zA-Z]') --> false -- а так хорошо
  16. from my experience with MTA callRemote, it doesnt like JSON objects like {"Name1":"Value1", "Name2":"Value2"} (they were always nil/empty), only indexed arrays ["Value1", "Value2"] worked fine for me.
  17. no gate1 = createObject ( 980, -1753.9000244141, -115.90000152588, 5.3000001907349, 0, 0, 270.5 ) col = createColCircle ( -1753.9000244141, -115.90000152588, 5.3000001907349, 7 ) function opena51gates(thePlayer) local playerTeam = getPlayerTeam(thePlayer) if playerTeam and getTeamName(playerTeam) == "Security" then moveObject (gate1, 3000, -1754, -126, 5.3000001907349 ) end end addEventHandler( "onColShapeHit", col, opena51gates ) function closea51gates(thePlayer) local playerTeam = getPlayerTeam(thePlayer) if playerTeam and getTeamName(playerTeam) == "Security" then moveObject (gate1, 4000, -1753.9000244141, -115.90000152588, 5.3000001907349 ) end end addEventHandler( "onColShapeLeave", col, closea51gates )
  18. ну и зачем превращать список аргументов в строку?
  19. outputChatBox(unpack(text)) -- или c дефолтными вариантами для всех параметров: outputChatBox(text[1] or "Text", text[2] or root, text[3] or 255, text[4] or 255, text[5] or 255, text[6] or false) не?
  20. Aibo

    Help!

    eh this is MTA:Race server you got there.
  21. Aibo

    dx functions

    1. AchieivementUnlocked is called every frame when you attach it to "onClientRender". so "txt" variable is always nil in that calls. you should put your text to some variable, like: local achievementText addEvent("achUnlock",true) function AchieivementUnlocked() dxDrawImage(439.0,625.0,409.0,83.0,"ach.png",0.0,0.0,0.0,tocolor(255,255,255,180),false) dxDrawText(achievementText,539.0,671.0,812.0,700.0,tocolor(0,0,0,255),0.5,"bankgothic","left","top",true,true,false) end function achUnlock ( txt ) achievementText = txt addEventHandler("onClientRender", root, AchieivementUnlocked) end addEventHandler("achUnlock", root, achUnlock) 2. everything you'll do in a client script is visible only to single client. unless you trigger same event for everyone.
  22. merged your topics. please do not double-post.
  23. no. dxDrawText does not support color-coded text. you'll have to write your own function for that (or search the forums). and i believe race resource redefines getPlayerName function to strip color codes, you'll have to fix that also.
  24. maybe use some Windows version that is not a "Development Preview"?
  25. for time position: -- line 25: timepassed = dxText:create('0:00:00', screenWidth - 10, screenHeight - 25, false, 'bankgothic', 0.7, 'right'), -- change screenWidth - 10, screenHeight - 25 to your desired location for ranking: -- line 22-23: ranknum = dxText:create('1', screenWidth - 60, screenHeight - 95, false, 'bankgothic', 2, 'right'), ranksuffix = dxText:create('st', screenWidth - 40, screenHeight - 86, false, 'bankgothic', 1), -- i doubt you can simply remove these lines (that probably will generate 'nil' errors) -- you'll need to search through race resource to see where else these dxTexts are referenced. -- though you can always move them offscreen by changing coordinates.
×
×
  • Create New...