-
Posts
1,312 -
Joined
-
Last visited
Everything posted by KariiiM
-
That's because something is broken in the table. If the script complied you can't edit it
-
EDIT: Après ça, J'ai essayé de faire une bus system avec une distance prix comme ton example mais je reçois d'une erreur dans le debug, aussi la gui et invisible quant je hit le marker car cette error Error: attempt to compare boolean with nil -Line 20 J'espère que tu comprends mon problem, --server side: local markerlocations = { [1]={name="(1)", x=2220.43, y=2469.49, z=10.82, bx=2221.24, by=2468.76, blip=8, dim=0, int=0}, [2]={name="(2)", x=1625.00, y=1850.43, z=10.82, bx=1625.00, by=1850.43, blip=8, dim=0, int=0}, [3]={name="(3)", x= 1718.26, y=1484.68, z=10.82, bx= 1718.26, by=1484.68, blip=8, dim=0, int=0} } local theTable = { --locations, areas, prices,x,y,z [1]={"LVPD", "The Emerald Isle", tonumber(earnings), 2220.43, 2469.49, 11.82}, --ici ,je veux laisser le price 'earnings' visible dans la gridlist, mais je ne suis pas sure,si cette facon et correct comme je crois [2]={"LV General Hospital", "Las Venturas Airport", tonumber(earnings), 1625.00, 1850.43, 11.82}, [3]={"LV Airport", "Las Venturas Airport", tonumber(earnings), 1718.26, 1484.68, 10.82} } addEventHandler("onResourceStart",resourceRoot, function (thePlayer,pos) for index, pos in pairs(markerlocations) do local marker = createMarker(pos.x, pos.y, pos.z-1, "cylinder", 1.3, 247,187, 7, 120) local blp = createBlip(pos.bx, pos.by, 100, pos.blip, 2, 255, 255, 255, 255, 0, 400) local x, y = theTable[pos][4], theTable[pos][5] local distance = getDistanceBetweenPoints2D(px, py, x, y) if (distance < miniumDistance) then miniumDistance = distance setElementInterior(busmarker, pos.int) setElementDimension(busmarker, pos.dim) addEventHandler("onMarkerHit",busmarker,onBusMarkerHit) setElementData(busmarker,"busName",pos.name) setElementData(marker, "forPlayer", thePlayer) local px, py, pz = getElementPosition(thePlayer) setElementData(thePlayer, "startedFromPos", {px, py, pz}) end end end) function onBusMarkerHit(hitPlayer, dim) if not dim then return end local forPlayer = getElementData(source, "forPlayer") if hitElement == forPlayer then local x, y, z = getElementPosition ( source ) local loc = getZoneName ( x, y, z ) local busName = getElementData(source,"busName") local sPos = getElementData(hitElement, "startedFromPos") local mx, my, mz = getElementPosition(source) local distance = getDistanceBetweenPoints2D(sPos[1], sPos[2], mx, my) local earnings = distance*0.5 if earnings >= 1 then distance = math.round(distance) earnings = math.round(earnings) triggerClientEvent(hitPlayer,"bus:show",hitPlayer,busName,theTable) end end end addEvent ("bus:warpplayer",true) addEventHandler ("bus:warpplayer",root, function (cityname,earnings,id) local x, y, z = theTable[id][4], theTable[id][5], theTable[id][6] if ( getPlayerMoney ( source ) < tonumber(earnings) ) then outputChatBox("You need ".. tonumber(earnings).."$ to use this service.", source, 255,0,0) else takePlayerMoney (source, tonumber(earnings)) fadeCamera(source, false) setTimer(fadeCamera, 5000, 1, source, true) setTimer(setElementPosition, 5000, 1,source, x,y,z) end end) function math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) end end
-
Merci pour ton aidé, je suis marocan,ma deuxième langue ces't francais apres anglais, mais malheureusement il est long temps je n'ai pas etude la langue mais je comprend tres bien. De toute façon,merci beaucoup pour ton aide et votre temps..
-
You mean you want to change an object to TXD?
-
salut les gars, jai essayé de faire la distance de prix entre les positions et des marqueurs, mais jai échoué, pour devenir plus cleir, Entre le marqueur et marqueur, il ya une distance, donc je veux utiliser cette distance que numéros et je le remplace le comme une prix. --Part of my code: local markerlocations = { [1]={x=2220.43, y=2469.49, z=10.82}, [2]={x=1625.00, y=1850.43, z=10.82}, [3]={x= 1718.26, y=1484.68, z=10.82} } local theTable = { [1]={"LV", 2220.43, 2469.49, 11.82}, [2]={"LS", 1625.00, 1850.43, 11.82}, [3]={"SF", -2682.52, 574.32, 15.67} } addEventHandler("onResourceStart",resourceRoot, function () local px, py, pz = getElementPosition(source) local miniumDistance = 2000 for index, pos in pairs(markerlocations) do local marker = createMarker(pos.x, pos.y, pos.z-1, "cylinder", 1.3, 247,187, 7, 120) local x, y = pos[1], pos[2] local distance = getDistanceBetweenPoints2D(px, py, x, y) if (distance < miniumDistance) then miniumDistance = distance end end end) Cordialement, KariM
-
Between marker and marker there's an distance ,so i want to use this "distance" as numbers and it will remplace the price.
-
Hey, i tried to make the reward distance between markers positions but i failed, thanks in advance --Part of my code: local markerlocations = { [1]={x=2220.43, y=2469.49, z=10.82}, [2]={x=1625.00, y=1850.43, z=10.82}, [3]={x= 1718.26, y=1484.68, z=10.82} } local theTable = { [1]={"LV", 2220.43, 2469.49, 11.82}, [2]={"LS", 1625.00, 1850.43, 11.82}, [3]={"SF", -2682.52, 574.32, 15.67} } addEventHandler("onResourceStart",resourceRoot, function () local px, py, pz = getElementPosition(source) local miniumDistance = 2000 for index, pos in pairs(markerlocations) do local marker = createMarker(pos.x, pos.y, pos.z-1, "cylinder", 1.3, 247,187, 7, 120) local x, y = pos[1], pos[2] local distance = getDistanceBetweenPoints2D(px, py, x, y) if (distance < miniumDistance) then miniumDistance = distance end end end)
-
I think you can save it in xml not in lua file but 'not sure 100%'
-
It should works. local marker = createMarker(1650.01, 1750.13, 9.67, "cylinder", 2, 53, 53, 255, 255) veh = {} function spawn(player,x,y,z,rt) if getElementType(player) == "player" then local x,y,z = getElementPosition(source) veh[player] = createVehicle(596, x,y,z+1,0,0,rt) warpPedIntoVehicle(player, veh[player]) else outputChatBox("You already are in a vehicle!", player,255,255,2255) end end addEventHandler("onMarkerHit", marker, spawn) function vehicleExit () setTimer(destroyElement, 60000, 1, veh[player]) end addEventHandler ( "onPlayerVehicleExit", getResourceRootElement(getThisResource()), vehicleExit )
-
It no matter if i know RP or RPG just explain your problem more clear to let people understand it, if you can't explain then post some screenshots / videos..
-
BTW, your code is full of errors, also you are using localPlayer in server side, since localPlayer is client side only.. i got its server side from "onMarkerHit" setElementHealth(localPlayer, hp+100) Tell me the idea and i'll try to help you out to make what you want Do you want to make when a player click on "x" he healt himself?
-
I still didn't get your point, use translation or something to be more clear
-
You mean that? --Server side: You have to add your account name in ACL group "OffDutyAdmin" and "Admin" local offdutyTeam = createTeam ("OffDuty",100,100,100) local theTeam = createTeam ("Admin",255,255,255) addCommandHandler ( "duty", function (thePlayer) local accountname = getAccountName ( getPlayerAccount ( thePlayer )) if isObjectInACLGroup ( "user." ..accountname, aclGetGroup ( "OffDutyAdmin" )) then setPlayerTeam (thePlayer,offdutyTeam) else if isObjectInACLGroup ( "user." ..accountname, aclGetGroup ( "Admin" )) then setPlayerTeam (thePlayer,theTeam) end end end)
-
local offdutyTeam = createTeam ("OffDuty",100,100,100) local theTeam = createTeam ("Admin",255,255,255) addCommandHandler ( "duty", function (thePlayer) local accountname = getAccountName ( getPlayerAccount ( thePlayer )) if isObjectInACLGroup ( "user." ..accountname, aclGetGroup ( "OffDutyAdmin" )) then setPlayerTeam (thePlayer,theTeam) end end) addCommandHandler ("offduty", function (thePlayer) setPlayerTeam (thePlayer,offdutyTeam ) end)
-
I already fixed the code, what you need exactly? Because i didn't get your point EDIT: you want if the player typed /offduty he get in another team?
-
--Server side only ! addCommandHandler ( "duty", function (thePlayer) local theTeam = createTeam ("Admin",255,255,255) local accountname = getAccountName ( getPlayerAccount ( thePlayer )) if isObjectInACLGroup ( "user." ..accountname, aclGetGroup ( "OffDutyAdmin" )) then setPlayerTeam (thePlayer,theTeam) end end)
-
Not stolen ok,you scripted all that and you can't fix this problem alone?
-
Now, each warp the message sends not only for the same location/Cord
-
Checking if the x,y,z egal to the cordinations, it doesn't works as it must be like, disable all warps no errors/warns .. addEvent ("bus:warpplayer",true) addEventHandler ("bus:warpplayer",root, function (cityname,price,id) local loc = getZoneName(theTable[id][4], theTable[id][5], theTable[id][6]) local x, y, z = theTable[id][4], theTable[id][5], theTable[id][6] local location = getZoneName(x, y, z) if ( getPlayerMoney ( source ) < tonumber(price) ) then if loc == location then outputChatBox("You need ".. tonumber(price).."$ to use this service.", source, 255,0,0) else outputChatBox("You're already in "..location..".",source,225,0,0) takePlayerMoney (source, tonumber(price)) setTimer(setElementPosition, 5000, 1,source, x,y,z) end end end)
-
Thanks, my problem is solved
-
My bad.. Thanks it worked but the first row isn't selectable and give this error ERROR: attempt to index field '?' (a nil value) also the first row cordinations went to the 2nd row..
-
I sent you the full code via private message
