Unique Posted August 1, 2020 Share Posted August 1, 2020 (edited) Hi! I want to make a this resource to work with item, if i have this item, then this /cmd will works, if i dont have this item, then resource will not works, can someone can say in wich row i need put a this one " if exports.global:hasItem(localPlayer, 88) then " ? --- THE CODE, SERVER SIDE only if not gpsBlips[playerID] then local vehicle = exports.pool:getElement("vehicle", vehID) if vehicle then local vehicleOwner = getElementData(vehicle, "owner") if vehicleOwner == playerID then local vehposX, vehposY, vehposZ = getElementPosition(vehicle) gpsBlips[playerID] = createBlip(vehposX, vehposY, vehposZ, 19, 2, 255, 0, 0, 255, 0, 99999.0, thePlayer) gpsMarkers[playerID] = createMarker(vehposX, vehposY, vehposZ, "checkpoint", 3, 255, 0, 0, 255, thePlayer) attachElements(gpsMarkers[playerID], vehicle) attachElements(gpsBlips[playerID], vehicle) if gpsBlips[playerID] then outputChatBox("Jūs varat sākt izsekot savu transportlīdzekli, kartē atzīmēts ar sarkanu karodziņu.", thePlayer, 0, 255, 0, true) end else outputChatBox("Transportlīdzeklis nepieder Jums!", thePlayer, 255, 0, 0, true) end end else outputChatBox("Jūs pašlaik jau izmantojat GPS. Lai ieslēgtu to atkārtoti, sākumā izslēdziet to /closevehgps", thePlayer, 255, 0, 0, true) end end addCommandHandler("trackingveh", gpsFunc) --- END Edited August 1, 2020 by Danex Link to comment
gubi Posted August 1, 2020 Share Posted August 1, 2020 (edited) Well, if i understood you properly, you want to allow this function to work, only if you have this item with ID 88? If soo then just add it in first IF statement. if not gpsBlips[playerID] and exports.global:hasItem(localPlayer, 88) then Also, you need to change localPlayer to player element. Edited August 1, 2020 by gubi Link to comment
Unique Posted August 1, 2020 Author Share Posted August 1, 2020 6 hours ago, gubi said: Well, if i understood you properly, you want to allow this function to work, only if you have this item with ID 88? If soo then just add it in first IF statement. if not gpsBlips[playerID] and exports.global:hasItem(localPlayer, 88) then Also, you need to change localPlayer to player element. mby better here? if gpsBlips[playerID] then Link to comment
gubi Posted August 2, 2020 Share Posted August 2, 2020 14 hours ago, Danex said: mby better here? if gpsBlips[playerID] then Thats literally what i wrote. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now