Jump to content

IIYAMA

Moderators
  • Posts

    6,089
  • Joined

  • Last visited

  • Days Won

    216

Everything posted by IIYAMA

  1. 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.
  2. 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.
  3. @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.
  4. Also: not seats-1 ? Since the loop starts at 0?
  5. 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.
  6. 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 )
  7. 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.
  8. Just, try to reduce the amount of handlers, then you will be fine.
  9. First try it yourself or you are a requester, which is at the wrong section.
  10. 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.
  11. Why are you checking a player it's element-type, when you already know it is a player? "onClientPlayerDamage"
  12. Mind your capitals from your variables. COLB2 > colB2
  13. 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,
  14. 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)
  15. 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 )
  16. 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.
  17. IIYAMA

    Need help...

    hmmm, that depends if bmat has set up something that can use it. You should ask him that on the other forum. Because as far as I know the meta only controls the elements in the map file, but not in what interior they spawn. or use a little script: (when it isn't supported) make a file in to the same folder as your map: server.lua Add to meta.xml. (between the already existed meta tags .... ) Open server.lua and add: addEventHandler("onPlayerSpawn",root, function (x,y,z) setElementInterior ( source, 10,x,y,z) end)
  18. IIYAMA

    Need help...

    You set the cod2mod properties? (and spawnpoints) After you set them, the map editor can't read it any more.
  19. Beste Europe, Ik ben 19 jaar. (student). Scripten is mijn ding. Maar ik ben niet geïnteresseerd om alleen te scripten, sinds ik dat al erg lang doe. Ik heb zelf een hekel aan roleplay, dat komt overeen. Daarnaast kan ik niet voor de server betalen, ik heb eigen server kosten. Laat me wat screenshots zien van je werk, dan kan ik er over nadenken. Met vriendelijke groet, IIYAMA
  20. IIYAMA

    Mute Problem

    myonlake, true. Trigger event's have also a light sync variant. (triggerLatentClientEvent) There is only just 1 bug and it is a very known one.(I bet everybody has had this problem before) It happens when the client hasn't loaded yet. triggerClientEvent will have problems with sending to the client when he hasn't loaded yet. (he won't be displayed as muted) Also: Elementdata will have a problem when the player is unmuted after the resource has been stopped. (he will be displayed as muted when the resource starts even if he is unmuted) So a call back would be the fix. (not that you have to spend more time on the code you have already written )
  21. IIYAMA

    Mute Problem

    Same question to you ... Why didn't you wrote the your code according to myonlake's post ? Your code is just confusing Jade. Your code should look like what WhoAmI wrote just because it's exactly what myonlake wrote and that it's a way better than your triggers. (Why ? Just because element datas are synced between the two sides and you can use that element data everywhere else on the client side where you need it) Why I didn't write code as myonlake, because every scripter has it's own style, I don't have to follow anybody his style. and no I don't write it down as WhoAmI, simply because it isn't how computers communicate between each other. Computers communicate directly and only to the ones that need information, the rest don't need those useless global information. Showing the score, ok fine. But this information is meant for 1 player and 1 player only. Dream on, the performance will drop after a amount of players(take mini-mission as example, true collapse), I am not going to discus this with you what is better. After you send it, you can even so use element data without synchronisation. So that isn't truly a super benefit after all. Discussed. (PM)
  22. IIYAMA

    Spectator Mode

    Indeed it is, but since this gta death camera starts working after a few seconds, I don't know. But see the benefit of it, you can focus the camera on your enemy's/friends/players from the air. Like GTA 1.
  23. IIYAMA

    Mute Problem

    server. function mutePlayer(player,command,victimName) if victimName then local victim = getPlayerFromName(victimName) if victim then if ( not isPlayerMuted(victim) ) then setPlayerMuted(victim, true) triggerClientEvent(victim,"changeMuteEffect",victim,true) outputChatBox("You have been muted.",victim) end else outputChatBox("Could not find player with name: "..tostring(victimName),player) end else outputChatBox("Usage: /mute ",player) end end addCommandHandler("mute",mutePlayer) And the client code at clientside. (not on the same file)
  24. IIYAMA

    Mute Problem

    You didn't defined victim. Must be a player. (or string when you send it to all) @WhoAmI If I am make working code, why the hell are you going to rewrite it?
×
×
  • Create New...