Jump to content

JR10

Retired Staff
  • Posts

    2,947
  • Joined

  • Last visited

Everything posted by JR10

  1. JR10

    Cafe System

    Also you made a mistake at outputChatBox here: outputChatBox( getPlayerName( thePlayer).."drunk tea.", 255, 255, 0 ) outputChatBox( getPlayerName( thePlayer).."drunk water.", 255, 255, 0 ) outputChatBox( getPlayerName( thePlayer).."drunks"..toplam..".["..water.."water"..tea.."tea]", 255, 255, 0 ) Should be outputChatBox( getPlayerName( thePlayer).."drunk tea.", root, 255, 255, 0 ) outputChatBox( getPlayerName( thePlayer).."drunk water.", root, 255, 255, 0 ) outputChatBox( getPlayerName( thePlayer).."drunks"..toplam..".["..water.."water"..tea.."tea]", root, 255, 255, 0 )
  2. JR10

    Cafe System

    Hmm,is it in an interior?, because i tested it the marker is visible but its in the sea
  3. that way it's already storing them ,hmm, it should work.
  4. JR10

    Cafe System

    Wont work because it will give warnings at the 2 addEventHandlers for markers they must be put inside the onResourceStart function. function ResourceStart() marker = createMarker ( 1449.3040771484, -2937.9020996094, 2.9447371959686, "cylinder", 1, 255, 255, 0) for i, v in ipairs(getElementsByType('player')) do setElementData(v,"all","0") setElementData(v,"tea","0") setElementData(v,"water","0") addEventHandler( "onMarkerHit", marker, MarkerHit ) addEventHandler( "onMarkerLeave", marker, markerLeave ) end end addEventHandler ( "onResourceStart", resourceRoot, ResourceStart ) function MarkerHit( hitElement, matchingDimension ) if getElementType( hitElement ) == "player" then outputChatBox( "You are now in my cafe.", hitElement, 255, 255, 0 ) outputChatBox( "If you want drink water use /water .", hitElement, 255, 255, 0 ) outputChatBox( "If you want drink tea use /tea .", hitElement, 255, 255, 0 ) addCommandHandler ( "water", water ) addCommandHandler ( "tea", tea ) end end function markerLeave( leaveElement, matchingDimension ) if getElementType( leaveElement ) == "player" then outputChatBox ( getPlayerName( thePlayer).."has left the cafe.", getRootElement(), 255, 255, 0 ) removeCommandHandler ("water", water) removeCommandHandler ("tea", tea) end end function water ( thePlayer, command ) outputChatBox( getPlayerName( thePlayer).."drunk water.", 255, 255, 0 ) setElementData ( thePlayer ,"water",tostring(tonumber(getElementData(thePlayer,"water"))+1)) end function tea ( thePlayer, command ) outputChatBox( getPlayerName( thePlayer).."drunk tea.", 255, 255, 0 ) setElementData ( thePlayer ,"tea",tostring(tonumber(getElementData(thePlayer,"tea"))+1)) end function all ( thePlayer, command ) local bira = tostring(tonumber(getElementData(thePlayer,"tea"))) local raki = tostring(tonumber(getElementData(thePlayer,"water"))) local toplam = tostring(tonumber(getElementData(thePlayer,"tea"))) + tostring(tonumber(getElementData(thePlayer,"water"))) outputChatBox( getPlayerName( thePlayer).."drunks"..toplam..".["..water.."water"..tea.."tea]", 255, 255, 0 ) end addCommandHandler ( "all", all )
  5. JR10

    Cafe System

    volk , look at your code again source instead of hitElement and that's not the problem, he had a bad arguments at the event handlers, this should work: function ResourceStart() marker = createMarker ( 1449.3040771484, -2937.9020996094, 2.9447371959686, "cylinder", 1, 255, 255, 0) for i, v in ipairs(getElementsByType('player')) do setElementData(v,"all","0") setElementData(v,"tea","0") setElementData(v,"water","0") end addEventHandler( "onMarkerHit", marker, MarkerHit ) addEventHandler( "onMarkerLeave", marker, markerLeave ) end addEventHandler ( "onResourceStart", resourceRoot, ResourceStart ) function MarkerHit( hitElement, matchingDimension ) if getElementType( hitElement ) == "player" then function MarkerHit( hitElement, matchingDimension ) if getElementType( hitElement ) == "player" then outputChatBox( "You are now in my cafe.", hitElement, 255, 255, 0 ) outputChatBox( "If you want drink water use /water .", hitElement, 255, 255, 0 ) outputChatBox( "If you want drink tea use /tea .", hitElement, 255, 255, 0 ) addCommandHandler ( "water", water ) addCommandHandler ( "tea", tea ) end end end function markerLeave( leaveElement, matchingDimension ) if getElementType( leaveElement ) == "player" then outputChatBox ( getPlayerName( thePlayer).."has left the cafe.", getRootElement(), 255, 255, 0 ) removeCommandHandler ("water", water) removeCommandHandler ("tea", tea) end end function water ( thePlayer, command ) outputChatBox( getPlayerName( thePlayer).."drunk water.", 255, 255, 0 ) setElementData ( thePlayer ,"water",tostring(tonumber(getElementData(thePlayer,"water"))+1)) end function tea ( thePlayer, command ) outputChatBox( getPlayerName( thePlayer).."drunk tea.", 255, 255, 0 ) setElementData ( thePlayer ,"tea",tostring(tonumber(getElementData(thePlayer,"tea"))+1)) end function all ( thePlayer, command ) local bira = tostring(tonumber(getElementData(thePlayer,"tea"))) local raki = tostring(tonumber(getElementData(thePlayer,"water"))) local toplam = tostring(tonumber(getElementData(thePlayer,"tea"))) + tostring(tonumber(getElementData(thePlayer,"water"))) outputChatBox( getPlayerName( thePlayer).."drunks"..toplam..".["..water.."water"..tea.."tea]", 255, 255, 0 ) end addCommandHandler ( "all", all )
  6. Because: addEventHandler("onClientResourceStart", getRootElement(), Should be: addEventHandler("onClientResourceStart", resourceRoot, getRootElement = all Resources resourceRoot = this resource only
  7. JR10

    Cafe System

    do this: function ResourceStart() marker = createMarker ( 1449.3040771484, -2937.9020996094, 2.9447371959686, "cylinder", 1, 255, 255, 0) for i, v in ipairs(getElementsByType('player')) do setElementData(v,"all","0") setElementData(v,"tea","0") setElementData(v,"water","0") end addEventHandler( "onMarkerHit", marker, MarkerHit ) addEventHandler( "onMarkerLeave", marker, markerLeave ) end addEventHandler ( "onResourceStart", getRootElement(), ResourceStart ) function MarkerHit( hitElement, matchingDimension ) if getElementType( hitElement ) == "player" then function MarkerHit( hitElement, matchingDimension ) if getElementType( hitElement ) == "player" then outputChatBox( "You are now in my cafe.", hitElement, 255, 255, 0 ) outputChatBox( "If you want drink water use /water .", hitElement, 255, 255, 0 ) outputChatBox( "If you want drink tea use /tea .", hitElement, 255, 255, 0 ) addCommandHandler ( "water", water ) addCommandHandler ( "tea", tea ) end end end function markerLeave( leaveElement, matchingDimension ) if getElementType( leaveElement ) == "player" then outputChatBox ( getPlayerName( thePlayer).."has left the cafe.", getRootElement(), 255, 255, 0 ) removeCommandHandler ("water", water) removeCommandHandler ("tea", tea) end end function water ( thePlayer, command ) outputChatBox( getPlayerName( thePlayer).."drunk water.", 255, 255, 0 ) setElementData ( thePlayer ,"water",tostring(tonumber(getElementData(thePlayer,"water"))+1)) end function tea ( thePlayer, command ) outputChatBox( getPlayerName( thePlayer).."drunk tea.", 255, 255, 0 ) setElementData ( thePlayer ,"tea",tostring(tonumber(getElementData(thePlayer,"tea"))+1)) end function all ( thePlayer, command ) local bira = tostring(tonumber(getElementData(thePlayer,"tea"))) local raki = tostring(tonumber(getElementData(thePlayer,"water"))) local toplam = tostring(tonumber(getElementData(thePlayer,"tea"))) + tostring(tonumber(getElementData(thePlayer,"water"))) outputChatBox( getPlayerName( thePlayer).."drunks"..toplam..".["..water.."water"..tea.."tea]", 255, 255, 0 ) end addCommandHandler ( "all", all )
  8. what you mean by "desactivate" ? quit the team or exits the marker explain better
  9. what you mean "desactivate" it?
  10. Wow you deleted the whole line here it is markers = {} markers[1] = createMarker(-706, 966, 12, "cylinder", 1, 255, 255, 0, 200) markers[2] = createMarker(-709, 966, 12, "cylinder", 1, 255, 255, 0, 200) vehicles = { [1] = {"Civilian","411"}, [2] = {"Army","432"} } function onMarkerHitGiveVehicle(hitPlayer,matchingDimension) for i,v in pairs(markers) do if (source == v) then if getElementType(hitPlayer) == "player" and matchingDimension then local team = getPlayerTeam1(hitPlayer) if not team then return end local teamName = getTeamName(team) if vehicles[i][1] ~= teamName then return end local x, y, z = getElementPosition(hitPlayer) vehicle = createVehicle(vehicles[i][2],x,y,z) warpPedIntoVehicle(hitPlayer,vehicle) end end end end addEventHandler("onMarkerHit",getRootElement(),onMarkerHitGiveVehicle) Remove 1 from getPlayerTeam can you do that yourself?
  11. JR10

    Cafe System

    function MarkerHit( hitElement, matchingDimension ) if getElementType( hitElement ) == "player" then outputChatBox( "You are now in my cafe.", source, 255, 255, 0 ) outputChatBox( "If you want drink water use /water .", source, 255, 255, 0 ) outputChatBox( "If you want drink tea use /tea .", source, 255, 255, 0 ) addCommandHandler ( "water", water ) addCommandHandler ( "tea", tea ) end You are talking to the marker function MarkerHit( hitElement, matchingDimension ) if getElementType( hitElement ) == "player" then outputChatBox( "You are now in my cafe.", hitElement, 255, 255, 0 ) outputChatBox( "If you want drink water use /water .", hitElement, 255, 255, 0 ) outputChatBox( "If you want drink tea use /tea .", hitElement, 255, 255, 0 ) addCommandHandler ( "water", water ) addCommandHandler ( "tea", tea ) end
  12. JR10

    Cafe System

    See my post again , nvm. here it is: How it's server side when you have setElementData(getLocalPlayer(),"all","0") setElementData(getLocalPlayer(),"tea","0") setElementData(getLocalPlayer(),"water","0") getLocalPlayer() is a client side function, you should do: function ResourceStart() marker = createMarker ( 1449.3040771484, -2937.9020996094, 2.9447371959686, "cylinder", 1, 255, 255, 0) for i, v in ipairs(getElementsByType('player')) do setElementData(v,"all","0") setElementData(v,"tea","0") setElementData(v,"water","0") end end addEventHandler ( "onResourceStart", getRootElement(), ResourceStart ) Also you got getRootElement() in onResourceStart in this way it will trigger it on any resource start should be: addEventHandler ( "onResourceStart", resourceRoot, ResourceStart )
  13. JR10

    Cafe System

    1. use [lua.][/lua] tags. 2. tell us what's the problem dont just say "it doesn't work". How it's server side when you have setElementData(getLocalPlayer(),"all","0") setElementData(getLocalPlayer(),"tea","0") setElementData(getLocalPlayer(),"water","0") getLocalPlayer() is a client side function, you should do: function ResourceStart() marker = createMarker ( 1449.3040771484, -2937.9020996094, 2.9447371959686, "cylinder", 1, 255, 255, 0) for i, v in ipairs(getElementsByType('player')) do setElementData(v,"all","0") setElementData(v,"tea","0") setElementData(v,"water","0") end end addEventHandler ( "onResourceStart", getRootElement(), ResourceStart )
  14. Also he posted that 5 minutes later how did he test it in 5 minutes that's without taking in consideration the time he took to see the post so obviously he is just trying to piss you off.
  15. You are really pathetic, How the hell did you test it so fast? I bet you didn't even test it, get the f*ck off castillo. If you really tested it post the errors
  16. on The apple first hit you create a ped and store it in newPed1 and then in appleHit you create a ped and attach it to newPed1 so it get attached to the first ped "newPed1" and you want it to get attached to the last created ped before it right? You can create a table and do this local newPed = {} function appelHit ( thePlayer ) local detection = isElementWithinColShape ( thePlayer, theAppleMarkerCol ) local randomMoney = math.random(50,500) local newPedCounter = #newPed + 1 newPed[newPedCounter] = createPed ( 0, 0, 0, 0, 0 ) local npX, npY, npZ = getElementPosition (newPed) if(detection) then -- outputChatBox( "You found the apple and got $" ..randomMoney ) givePlayerMoney ( thePlayer, randomMoney ) destroyElement ( theAppleMarkerCol ) destroyElement ( theAppleMarker ) destroyElement ( appleBlip ) setElementPosition ( newPed[newPedCounter], npX, npY + 0.1, npZ ) attachElements ( newPed[newPedCounter], newPed[#newPed - 1], npX, npY + 0.1, npZ) triggerEvent ( "loopCjSnake", getRootElement(), "" ) if(newPed) then outputChatBox ( "The new PED was created!") else outputChatBox ( "Failed to create the new PED!") end end end I think this will work.
  17. You can use this function to get the players back position function getPlayerBackPos(player) local rotz = getPedRotation(player) local x, y, z = getElementPosition(player) x = x + ( math.cos ( math.rad ( rotz-90 ) ) * 2) -- you can increase 2 to increase the space y = y + ( math.sin ( math.rad ( rotz-90 ) ) * 2) -- here too return x, y, z end
  18. triggerEvent ( "loopCjSnake", getRootElement(), "" ) It should be a player element. triggerEvent ( "loopCjSnake", getRootElement(), thePlayer )
  19. If you are using it in the zombie GM then it should work
  20. Exporting a function that gets the variable is easier, because you don't have to update it.
  21. Because you just copy paste without looking -.- If you really want to learn look at the code we give you, try to see what did you do wrong, this way you wont do it again. Copy paste get you in a bad habit, and you won't learn anything.
  22. No, you can't create a variable used in all resources. local variables are used only in thier block(function , etc, etc...), global variables are used in all the scripts in the resources. you can do something like that: function getMyVariable() return theVariable end and export it so it can be used in another scripts.
  23. JR10

    Premium Panel

    Dude, the post was a month ago and you are just posting "ok" ? DONT POST WITHOUT A REASON. Your just trying to increase your posts.
×
×
  • Create New...