Jump to content

IIYAMA

Moderators
  • Posts

    6,097
  • Joined

  • Last visited

  • Days Won

    218

Everything posted by IIYAMA

  1. 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. -_-"
  2. 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.
  3. 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 )
  4. You sure they aren't created? if isElement(PedM) then outputChatBox("PedM does exist.") end
  5. 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)
  6. Replace givePlayerBlood with setElementHealth. make sure you check if there is a killer. if killer then setElementHealth(killer,100) end
  7. 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
  8. "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.
  9. nil isn't false and false isn't nil. I prefer using not, then you will never have trouble with it. True, I had already corrected myself in my last post.
  10. Just use this to check if the vehicle is empty: if not next(getVehicleOccupants(veh)) then -- empty else -- not empty end As simple as that, even a lua beginner can use this and put it at the right place. Else this beginner didn't begin at all.
  11. @Citizen You ever used the next function? if next(getVehicleOccupants(veh)) then It doesn't matter what the index(strings tables userdata,functions is, it can tell us if a table is empty or not. To get back on the topic, when "onVehicleStartEnter" got triggered, the getVehicleOccupants function will return also the players that are trying to enter the vehicle. I don't know why and I also don't know it is a bug, but it is doing it.
  12. Also: not seats-1 ? Since the loop starts at 0?
  13. P.s: Enable this: dxSetAspectRatioAdjustmentEnabled (true) Recommended when you are going to draw things near the hud. See wiki sample how to use it. https://wiki.multitheftauto.com/wiki/Dx ... entEnabled Every player can adjust their hud ratio, this will fix that.
  14. IIYAMA

    Working?

    True. But I meant what arguments that can be used inside the functions, which make the differences between serverside and clientside. Like this one: takePlayerMoney ( 5000 ) takePlayerMoney (thePlayer, 5000 )
  15. IIYAMA

    Working?

    addCommandHandler doesn't have a source, how does it suppose to work.... The player should be the localPlayer on clientside or the first parameter at serverside. Also serverside functions and clientside functions are mixed up in the code.
  16. Just, try to reduce the amount of handlers, then you will be fine.
  17. First try it yourself or you are a requester, which is at the wrong section.
  18. IIYAMA

    car damaging

    addEventHandler("onClientVehicleDamage", root, function (attacker,weapon) if attacker == localPlayer then outputChatBox("(( CAR DM IS NOT ALLOWED ))", 255,0,0 ) end if attacker then cancelEvent() end end) It is clientside and that("onClientPlayerWeaponFire") event can't be cancelled.
  19. Why are you checking a player it's element-type, when you already know it is a player? "onClientPlayerDamage"
  20. Mind your capitals from your variables. COLB2 > colB2
  21. IIYAMA

    solved

    np.
  22. IIYAMA

    solved

    CVC +1 local vehicleTable = {} addEvent( "sum", true) addEventHandler("sum", getRootElement(), function(car) local truck = vehicleTable[source] -- load if truck then -- check if isElement( truck ) then destroyElement( truck ) end vehicleTable[source]= nil -- clean end if isElement(source) then local truck = createVehicle ( 514, 70.21049, -233.00739, 2.33665 ) warpPedIntoVehicle ( source, truck ) vehicleTable[source]= truck --save end end ) -- extra, because I am in a good mood. addEventHandler("onPlayerQuit",root, function () local truck = vehicleTable[source] if truck then if isElement( truck ) then destroyElement( truck ) end vehicleTable[source]= nil end end) -- @CVC Lol you posted first,
  23. IIYAMA

    solved

    onClientMarkerHit doesn't get trigged with vehicles. See wiki: https://wiki.multitheftauto.com/wiki/OnClientMarkerHit hitPlayer: The player that hit the marker So: addEventHandler ( "onClientMarkerHit", root, function ( hitElement ) if source == truckerMarker and localPlayer == hitElement then local vehicle = getPedOccupiedVehicle ( localPlayer ) if vehicle and getElementModel(vehicle) == 514 then triggerServerEvent ( "givePlayerPay", localPlayer ) destroyElement ( truckerMarker ) if isElement(truckerBlip) then -- very important destroyElement ( truckerBlip ) end guiSetVisible(destinationwindow,true) showCursor(true) triggerEvent ( "createTruckerEvent", localPlayer ) end end end)
  24. No it doesn't. The variable hmm isn't defined when the addEventHandler ( "onClientGUIClick") is attached. Also the button hasn't been created yet. Because onClientResourceStart get triggered after the code has been loaded. GUIEditor = { window = {}, memo = {}, button = {} } addEventHandler( "onClientResourceStart", resourceRoot, function () -- Create our button GUIEditor.window[1] = guiCreateWindow(166, 127, 540, 359, "Rules", false) GUIEditor.button[1] = guiCreateButton(311, 254, 162, 19, "Rules", false, GUIEditor.window[1]) guiWindowSetSizable(GUIEditor.window[1], true) GUIEditor.memo[1] = guiCreateMemo(9, 22, 521, 327, "/n button not working", false, GUIEditor.window[1]) guiSetVisible(GUIEditor.memo[1],false) guiMemoSetReadOnly(GUIEditor.memo[1], true) showCursor (true) function hmm () --<< 1 if guiGetVisible (GUIEditor.memo[1]) == true then guiSetVisible (GUIEditor.memo[1],false) else guiSetVisible(GUIEditor.memo[1],true) end end addEventHandler ( "onClientGUIClick", GUIEditor.button[1], hmm, false ) --<< 2 end) -- end function (onClientResourceStart) --addEventHandler ( "onClientGUIClick", GUIEditor.button[1], hmm, false )
  25. What happened to the original gta light object? Because I have been searching for it, but I never found it as a object. Most light objects are able to use, but this one not.
×
×
  • Create New...