-
Posts
2,947 -
Joined
-
Last visited
Everything posted by JR10
-
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 )
-
Hmm,is it in an interior?, because i tested it the marker is visible but its in the sea
-
that way it's already storing them ,hmm, it should work.
-
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 )
-
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 )
-
Lol, No problem.
-
Because: addEventHandler("onClientResourceStart", getRootElement(), Should be: addEventHandler("onClientResourceStart", resourceRoot, getRootElement = all Resources resourceRoot = this resource only
-
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 )
-
what you mean by "desactivate" ? quit the team or exits the marker explain better
-
what you mean "desactivate" it?
-
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?
-
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
-
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 )
-
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 )
-
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.
-
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
-
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.
-
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
-
triggerEvent ( "loopCjSnake", getRootElement(), "" ) It should be a player element. triggerEvent ( "loopCjSnake", getRootElement(), thePlayer )
-
If you are using it in the zombie GM then it should work
-
Exporting a function that gets the variable is easier, because you don't have to update it.
-
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.
-
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.
-
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.