harryh
Members-
Posts
108 -
Joined
-
Last visited
Everything posted by harryh
-
If you not going to help, please don't comment... I just looked at the wiki and thats what it said. Not my fault.
-
How do I do this. I currently have this which I got from the wiki but it doesn't work. As the GUI is off the screen. local sW, sH = guiGetScreenSize() showCursor(true) modwindow = guiCreateWindow(sW*442, sH*181, sW*506, sH*420, "Autoparts Modshop", false)
-
Thank you, you have taught me a lot
-
Thank you SolidSnake. But how can I set it so on the resource start It will setElementData for all cols not to be harvested. I know I will need: onResourceStart setElementData
-
Yes but the timer isnt respawning the weed, the timer and respawn weed has nothing to do with harvestweed also the timer is not even in the harvest weed function. I have also manually spawned the weed by putting respawnWeed ( Source ) it works but the element data is not set. function weedhit ( element, matchingDimension ) if ( isElement ( element ) and matchingDimension and getElementType ( element ) == "player" ) then thePlayer = getPlayerName(element) if isPedInVehicle ( element ) then local vehicle = getPedOccupiedVehicle ( element ) local vehicleID = getElementModel ( vehicle ) getHarvested = getElementData ( source, "isHarvested" ) if ( getHarvested == 1 ) then outputChatBox("Weed has already been harvested!", element) else if ( vehicleID == 532 ) then if ( getHarvested == 0 ) then setElementData ( source, "isHarvested", 1 ) harvestWeed ( thePlayer ) setTimer ( respawnWeed, 50, 1, source ) -- 300000 else outputChatBox("Weed has already been harvested!", element) setTimer ( respawnWeed, 50, 1, source ) end else outputChatBox ( "You can't harvest with this vehicle!!", element ) end end else outputChatBox ( "/pickbud to pick the weed!", element ) end else outputChatBox("Error!! Contact an Admin, F2", element ) end end addEventHandler ( "onColShapeHit", getResourceRootElement(), weedhit )
-
No that was why I assume its not working. Also it doesn't seem to let me harvest the weed after 5 seconds so its not working clearly.
-
Doesn't work no errors. function weedhit ( element, matchingDimension ) if ( isElement ( element ) and matchingDimension and getElementType ( element ) == "player" ) then thePlayer = getPlayerName(element) if isPedInVehicle ( element ) then local vehicle = getPedOccupiedVehicle ( element ) local vehicleID = getElementModel ( vehicle ) getHarvested = getElementData ( source, "isHarvested" ) if ( getHarvested == 1 ) then outputChatBox("Weed has already been harvested!", element) else if ( vehicleID == 532 ) then if ( getHarvested == 0 ) then setElementData ( source, "isHarvested", 1 ) harvestWeed ( thePlayer ) setTimer ( respawnWeed, 50, 1, source ) -- 300000 else outputChatBox("Weed has already been harvested!", element) setTimer ( respawnWeed, 50, 1, source ) end else outputChatBox ( "You can't harvest with this vehicle!!", element ) end end else outputChatBox ( "/pickbud to pick the weed!", element ) end else outputChatBox("Error!! Contact an Admin, F2", element ) end end addEventHandler ( "onColShapeHit", getResourceRootElement(), weedhit ) function respawnWeed ( col ) if isElement ( col ) then setElementData ( col, "isHarvested", 0 ) outputChatBox("Weed Grown ") -- debug end end
-
Ok a timer resWeed = setTimer ( respawnWeed, 300000, 1, source )
-
Thanks SolidSnake, but you know the setElementData harvested you helped me with yesterday, I cannot find away to set it back as I do not know what element it was binded to. function weedhit ( element, matchingDimension ) if ( isElement ( element ) and matchingDimension and getElementType ( element ) == "player" ) then thePlayer = getPlayerName(element) if isPedInVehicle ( element ) then local vehicle = getPedOccupiedVehicle ( element ) local vehicleID = getElementModel ( vehicle ) local getHarvested = getElementData ( source, "isHarvested" ) if ( getHarvested == 1 ) then outputChatBox("Weed has already been harvested!", element) else if ( vehicleID == 532 ) then setElementData ( source, "isHarvested", 1 ) harvestWeed ( thePlayer ) else outputChatBox ( "You can't harvest with this vehicle!!", element ) end end else outputChatBox ( "/pickbud to pick the weed!", element ) end else outputChatBox("Error!! Contact an Admin, F2", element ) end end addEventHandler ( "onColShapeHit", getRootElement(), weedhit ) function forceWeed () setElementData ( wc1, "isHarvested", 0 ) setElementData ( wc2, "isHarvested", 0 ) setElementData ( wc3, "isHarvested", 0 ) setElementData ( wc4, "isHarvested", 0 ) setElementData ( wc5, "isHarvested", 0 ) setElementData ( wc6, "isHarvested", 0 ) outputChatBox("Weed Grown") end addCommandHandler("forceweed", forceWeed)
-
Expected element got table, or with for k, val in pairs (wcols) do expected element is number. for index of were the colshape variable is in the table
-
Ah Solid look at the code below the loop, thats what I used the loop for.
-
Now I have a different problem. How can I check if someone is in any of the cols. Here is what I current have. I have tried using a for loop for _, value in pairs(wcols) do weed1 = createObject(3409, -1070.0712890625, -1621.3779296875, 75 ) wc1 = createColRectangle(-1071.9111328125, -1623.5166015625, 4, 4) weed2 = createObject(3409, -1061.048828125, -1621.3779296875, 75 ) wc2 = createColRectangle(-1062.865234375, -1623.3974609375, 4, 4) weed3 = createObject(3409, -1061.048828125+9, -1621.3779296875, 75 ) wc3 = createColRectangle(-1053.984375, -1623.375, 4, 4) weed4 = createObject(3409, -1052.1123046875, -1631.681640625, 75 ) wc4 = createColRectangle(-1054.1328125, -1633.4208984375, 4, 4) weed5 = createObject(3409, -1052.1123046875-9, -1631.681640625, 75 ) wc5 = createColRectangle(-1063.2421875, -1633.6806640625, 4, 4) weed6 = createObject(3409, -1070.0712890625, -1631.681640625, 75 ) wc6 = createColRectangle(-1072.0537109375, -1633.6484375, 4, 4) wcols = { wc1, wc2, wc3, wc4, wc5, wc6 } function pickBud( thePlayer ) if isElementWithinColShape(thePlayer, wcols) then if ( getHarvested == 0) then exports.global:sendLocalMeAction(element, "picks some bud.") local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, thePlayer) exports.global:giveItem(targetPlayer, 30, 0) exports.global:giveItem(targetPlayer, 30, 0) end end end addCommandHandler("pickbud", pickBud) Also (SolidSnake as you gave me the code) I am unable to reset the weed. function forceWeed () setElementData ( wc1, "isHarvested", 0 ) setElementData ( wc2, "isHarvested", 0 ) setElementData ( wc3, "isHarvested", 0 ) setElementData ( wc4, "isHarvested", 0 ) setElementData ( wc5, "isHarvested", 0 ) setElementData ( wc6, "isHarvested", 0 ) outputChatBox("Weed Grown") end addCommandHandler("forceweed", forceWeed)
-
Now I have a different problem. How can I check if someone is in any of the cols. Here is what I current have. I have tried using a for loop for _, value in pairs(wcols) do weed1 = createObject(3409, -1070.0712890625, -1621.3779296875, 75 ) wc1 = createColRectangle(-1071.9111328125, -1623.5166015625, 4, 4) weed2 = createObject(3409, -1061.048828125, -1621.3779296875, 75 ) wc2 = createColRectangle(-1062.865234375, -1623.3974609375, 4, 4) weed3 = createObject(3409, -1061.048828125+9, -1621.3779296875, 75 ) wc3 = createColRectangle(-1053.984375, -1623.375, 4, 4) weed4 = createObject(3409, -1052.1123046875, -1631.681640625, 75 ) wc4 = createColRectangle(-1054.1328125, -1633.4208984375, 4, 4) weed5 = createObject(3409, -1052.1123046875-9, -1631.681640625, 75 ) wc5 = createColRectangle(-1063.2421875, -1633.6806640625, 4, 4) weed6 = createObject(3409, -1070.0712890625, -1631.681640625, 75 ) wc6 = createColRectangle(-1072.0537109375, -1633.6484375, 4, 4) wcols = { wc1, wc2, wc3, wc4, wc5, wc6 } function pickBud( thePlayer ) if isElementWithinColShape(thePlayer, wcols) then if ( getHarvested == 0) then exports.global:sendLocalMeAction(element, "picks some bud.") local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, thePlayer) exports.global:giveItem(targetPlayer, 30, 0) exports.global:giveItem(targetPlayer, 30, 0) end end end addCommandHandler("pickbud", pickBud) Also I am unable to reset the weed. function forceWeed () setElementData ( wc1, "isHarvested", 0 ) setElementData ( wc2, "isHarvested", 0 ) setElementData ( wc3, "isHarvested", 0 ) setElementData ( wc4, "isHarvested", 0 ) setElementData ( wc5, "isHarvested", 0 ) setElementData ( wc6, "isHarvested", 0 ) outputChatBox("Weed Grown") end addCommandHandler("forceweed", forceWeed)
-
Ah, thank you Solid.
-
So say when you harvest colshape 1 you can still harvest colshape 2,6 but not 1 as setElementData to the colshape stopping it being harvested, it says expected element for boolean. so basically trying to get the colshape that the player is in and setting that colshape to harvested
-
function harvestWeed( thePlayer ) local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, thePlayer) exports.global:giveItem(targetPlayer, 30, 0) exports.global:giveItem(targetPlayer, 30, 0) exports.global:giveItem(targetPlayer, 30, 0) exports.global:giveItem(targetPlayer, 30, 0) end
-
Oh yeah woops. wrong code. Do you know how I would be able to set the setElementData to the colshape so if they go in it again it cannot be harvested? What I want to do is to assign setElementData to the colshape so if the player tries to harvest from the say colshape again it will say its already harvested. function weedhit ( element, matchingDimension ) if ( isElement ( element ) and matchingDimension and getElementType ( element ) == "player" ) then thePlayer = getPlayerName(element) if isPedInVehicle ( element ) then local vehicle = getPedOccupiedVehicle ( element ) local vehicleID = getElementModel ( vehicle ) getHarvested = getElementData( getElementColShape ( element ), "isHarvested" ) if (getHarvested == 1 ) then outputChatBox("Weed has already been harvested!", element) else if ( vehicleID == 532 ) then outputChatBox( tostring( getHarvested ) ) harvestWeed ( thePlayer ) sHar = setElementData( getElementColShape ( element ), "isHarvested", 1) else outputChatBox ( "You can't harvest with this vehicle!!", element ) end end else outputChatBox ( "/pickbud to pick the weed!", element ) end else outputChatBox("Error!! Contact an Admin, F2", element ) end end addEventHandler ( "onColShapeHit", getRootElement(), weedhit )
-
weed1 = createObject(3409, -1070.0712890625, -1621.3779296875, 75 ) wc1 = createColRectangle(-1071.9111328125, -1623.5166015625, 4, 4) weed2 = createObject(3409, -1061.048828125, -1621.3779296875, 75 ) wc2 = createColRectangle(-1062.865234375, -1623.3974609375, 4, 4) weed3 = createObject(3409, -1061.048828125+9, -1621.3779296875, 75 ) wc3 = createColRectangle(-1053.984375, -1623.375, 4, 4) weed4 = createObject(3409, -1052.1123046875, -1631.681640625, 75 ) wc4 = createColRectangle(-1054.1328125, -1633.4208984375, 4, 4) weed5 = createObject(3409, -1052.1123046875-9, -1631.681640625, 75 ) wc5 = createColRectangle(-1063.2421875, -1633.6806640625, 4, 4) weed6 = createObject(3409, -1070.0712890625, -1631.681640625, 75 ) wc6 = createColRectangle(-1072.0537109375, -1633.6484375, 4, 4) function weedhit ( element, matchingDimension ) if ( isElement ( element ) and matchingDimension and getElementType ( element ) == "player" ) then thePlayer = getPlayerName(element) if isPedInVehicle ( element ) then local vehicle = getPedOccupiedVehicle ( element ) local vehicleID = getElementModel ( vehicle ) getHarvested = getElementData( element, "isHarvested" ) if (getHarvested == 1 ) then outputChatBox("Weed has already been harvested!", element) else if ( vehicleID == 532 ) then outputChatBox( tostring( getHarvested ) ) harvestWeed ( thePlayer ) sHar = setElementData( getElementColShape ( element ), "isHarvested", 1) else outputChatBox ( "You can't harvest with this vehicle!!", element ) end end else outputChatBox ( "/pickbud to pick the weed!", element ) end else outputChatBox("Error!! Contact an Admin, F2", element ) end end addEventHandler ( "onColShapeHit", getRootElement(), weedhit )
-
I cannot seem to get the colshape variable name and assign it to setElementData. What I am trying to do is set the the colshape to harvested(true) so when you go back though that colshape it says "this has already been harvested". So basically if I harvest colshape wc, so I can still harvest colshape wc2. wc = colshape blah wc2 = colshape blah getHarvested = getElementData( element, "isHarvested" ) if (getHarvested == true ) then outputChatBox("Weed has already been harvested!", element) else if ( vehicleID == 532 ) then outputChatBox( tostring( getHarvested ) ) --debug harvestWeed ( ) sHar = setElementData( getElementColShape ( element ), "isHarvested", true)
-
Well, the idea here is that if the player is in a vehicle it executes the harvestWeed function and if he is not it tells him to /pickbud. But when the player is in a vehicle it says /pickbud. I do not understand why. Code: function weedhit( element, matchingDimension ) if (isElement(element)) and (getElementType(element)=="vehicle") and (matchingDimension) then local thePlayer = getVehicleOccupant(element) local vehName = getVehicleName(element) local vehicleID = getVehicleModelFromName(vehName) if (vehicleID==532) then harvestWeed() else outputChatBox("You can't harvest with this vehicle!!", thePlayer) end elseif (isElement(element)) and (matchingDimension) and not (getElementType(element)=="vehicle") then outputChatBox("/pickbud to pick the weed!", thePlayer) else outputChatBox("Error!! Contact an Admin, F2", thePlayer) end end addEventHandler ( "onColShapeHit", getRootElement(), weedhit )
-
Does anyone know the burned weed model name or Id as I cannot find it anywhere?
-
When I seem to get compatible vehicle upgrades for sultan, jester, uranus and other car upgrades will show up. For example, I would try to add upgrades to a sultan and upgrades for the jester uranus and flash would show. as you can see im in the jester and upgrades for them vehicles show up. My code has been checked and it will not go away.
-
Yeah, must be as it have cleared the gridlist and its still not working.
-
Problem is its for jester car and it doesn't fit. addVehicleUpgrade outputs false when trying to add it.
