Jump to content

IIYAMA

Moderators
  • Posts

    6,089
  • Joined

  • Last visited

  • Days Won

    216

Everything posted by IIYAMA

  1. IIYAMA

    Vehicles

    local myVehicleTable = {} function createCar () local car = createVehicle(411,0,0,14) outputChatBox("TRUEm",thePlayer) myVehicleTable[#myVehicleTable+1]=car-- save inside a table end addCommandHandler("make",createCar) function destroyAllVehicles () for i=1,#myVehicleTable do local vehicle = myVehicleTable[i] if isElement(vehicle) then destroyElement(vehicle) end end myVehicleTable = {}-- reset end addCommandHandler("destroy",destroyAllVehicles)
  2. IIYAMA

    mysql question

    I have no knowledge of mysql, only lua.
  3. IIYAMA

    Random Maps

    Before you let somebody lock it, you also can use mapmanager. function setNextRound () local mapmanager = getResourceFromName ( "mapmanager" ) if mapmanager then local maps = call (mapmanager,"getMapsCompatibleWithGamemode",thisResource) if maps then call (mapmanager,"changeGamemodeMap",maps[math.random(#maps)]) end end end
  4. IIYAMA

    mysql question

    Depends how strong the server is, but yes it will use more memory then normal.
  5. net of jij zo duidelijk bent.... er zijn heel veel panels/scripts/gamemodes namelijk.
  6. client -- client -- function policeSirens( ) local occveh = getPedOccupiedVehicle ( localPlayer ) if occveh then local id = getElementModel ( occveh ) -- theVehicle if id == 596 or id == 597 then triggerServerEvent("vehicleSirens",occveh) end end end server -- server -- addEvent("vehicleSirens",true) addEventHandler("vehicleSirens",root, function () if isElement(source) then setVehicleSirens ( source, 7, -0.800, -2.849, 0.050, 60, 118, 224, 255, 255 ) addVehicleSirens ( source, 7, 3, true, false, true, false ) end end) @Dzsozi There are warnings. /debugscript 3 to see them. And next time put them at your post.
  7. Open the resource parachute and there you will find everything you need to know. The parachute from gta can't be used. That's why mta created the parachute resource to make it possible and synced.
  8. Indeed, Einheit-101. But there a lot of ways to do it. https://wiki.multitheftauto.com/wiki/Ge ... enPosition https://wiki.multitheftauto.com/wiki/ProcessLineOfSight https://wiki.multitheftauto.com/wiki/GetBoundKeys getPedOccupiedVehicle setElementHealth getElementHealth Event: Etc. People there is a lot possible with mta...
  9. It stays local at that block of the code. a= 10 if a then local a = 3 a = 3 end outputChatBox(a)--10 But before you wrote the local: a= 10 if a then a = 3 local a = 3 end outputChatBox(a)--3
  10. It is maybe also handy if you check if the ped still does exist. if isElement(ped) then or you may will have trouble when the ped somehow is deleted.(by another script)
  11. Well mister, 8 of the 10 people that use this forum(scripting section) don't understand a damn about it. Because they learn lua via mta and not via lua sites(like: http://lua-users.org/) There isn't enough information there to know what ways there are.
  12. @mrbrutus1467 and all who don't understand.... Now stringKey1 have to be a variable, which isn't defined. It is: local exampleTable = { stringKey1 = { "Value 1", "value 2", "value 3" } } or local exampleTable = { ["stringKey1"] = { "Value 1", "value 2", "value 3" } } or with the variable stringKey1 but defined. local stringKey1 = "stringKey1" local exampleTable = { [stringKey1] = { "Value 1", "value 2", "value 3" } }
  13. So anyone advise? Can't you read or are you blind? Or to lazy to follow somebody his advise, so you ask it again to get the same advice?
  14. IIYAMA

    Is this ok?

    This will count down from the highest array, and check if they are nil/false and count one down till it's found it's target. local myVariable for i=#myTable,1,-1 do -- counts down till 1. local variable = myTable[i] if variable then myVariable = variable break end end If you use they array I will recommend you to use table.remove, so you won't have trouble with empty places.
  15. IIYAMA

    [Solved]

    Then use castillo his exp table at clientside or what ever.
  16. IIYAMA

    [Solved]

    Then use castillo his exp table at clientside or what ever. I am not going to download his resource just to copy things out of it. -_-"
  17. local Bscore = 0 --typo: Bscrore local Wscore = 0 --typo: Wscrore function onWasted(killer, weapon, bodypart) if killer and getElementType(killer) == "player" then local kteam = getPlayerTeam(killer) if kteam then -- < first check if he is in a team if(getTeamName(kteam) == "WhiteTeam")then Wscore = Wscore + 1 elseif(getTeamName(kteam) == "BlackTeam") then -- you forgot a "then" Bscore = Bscore + 1 end end end end addEventHandler("onClientPedWasted", root, onWasted) function onRender() local team = getPlayerTeam(localPlayer) if team then -- < first check if you are in a team if(getTeamName(team) == "WhiteTeam" or getTeamName(team) == "BlackTeam") then dxDrawText("Black Team:".. Bscore, 0, 500, 319, 426, tocolor(0, 0, 0, 255), 1.00, "pricedown", "center", "center", true, true, true, true, false) dxDrawText("White Team:".. Wscore, 0, 600, 319, 426, tocolor(255, 255, 255, 255), 1.00, "pricedown", "center", "center", true, true, true, true, false) end end end addEventHandler("onClientRender", root, onRender) Next time use /debugscript 3! Also it is a bit stupid to calculate those score at clientside.
  18. IIYAMA

    [Solved]

    Because the xp isn't reset..... Try this: addEventHandler("onClientRender",root, function() local exp_ =( getElementData ( localPlayer, "exp" ) or 0) local ExpBar = 150 * (( exp_ % 350 )/350) dxDrawRectangle(sWidth-185,sHeight-186.5, 154, 6.5, tocolor ( 0, 0, 0, 255 ), false)-- Exp Bar dxDrawRectangle(sWidth-183,sHeight-185,ExpBar,3.5,tocolor(255,255,255,255) ,false) -- Exp end )
  19. You sure they aren't created? if isElement(PedM) then outputChatBox("PedM does exist.") end
  20. Well if you don't know the key, you can also detect it with this peace of code: addEventHandler("onElementDataChange",root, function (theName,oldValue) if getElementType(source) == "player" then outputChatBox("The string name: " .. theName .. " Old value: " .. oldValue,source) end end) setElementData(killer,"theName", 100)
  21. Replace givePlayerBlood with setElementHealth. make sure you check if there is a killer. if killer then setElementHealth(killer,100) end
  22. ok, well it is working. That is the point. The condition will see it as a equal result. We know the facts so I stop posting else I am ruining somebody his topic. @ksTakor Your answer. if not next(getVehicleOccupants(veh)) then -- empty else -- not empty end
  23. "Why are you doing a comparison between nil and false ??" You said it yourself, you don't have to mind if it is returning nil or false and that is one worry less. I only shared my prefer.
×
×
  • Create New...