Jump to content

Imposter

Members
  • Posts

    188
  • Joined

  • Last visited

Everything posted by Imposter

  1. still not working, i tried it just now. [2012-07-25 15:59:01] ERROR: [roleplay]\bank\server.lua:26: attempt to perform arithmetic on local 'bankMoney' (a boolean value)
  2. function checkBalance(thePlayer) local account = getPlayerAccount ( thePlayer ) local bankMoney = getAccountData ( account, "bankcash" ) if ( bankMoney==false ) then setAccountData ( account, "bankCash", 0 ) bankMoney=0 outputChatBox ("hi") else outputChatBox ("EagleBot: " .. getPlayerName(thePlayer) .. " has $" .. bankMoney .. " in his bank!" ) end end addCommandHandler ( "bank" , checkBalance ) function saveBalance() end addEventHandler ( "onPlayerQuit", getRootElement(), saveBalance ) function withdrawBalance() end function storeMoney( thePlayer, command, cash) local account = getPlayerAccount ( thePlayer ) local bankMoney = getAccountData ( account, "bankcash" ) local store = bankMoney+cash takePlayerMoney ( cash ) setAccountData ( account, "bankCash", store ) outputChatBox ( "You stored $" .. cash .. "in your bank!", thePlayer) end addCommandHandler ( "store" , storeMoney ) [2012-07-25 14:44:21] ERROR: [roleplay]\bank\server.lua:26: attempt to perform arithmetic on local 'bankMoney' (a boolean value) why am i getting an error?
  3. yea, i figured that is what happened, its all good now, thanks again AMARANT and SolidSnake14
  4. What the hell...?? this is a retarded error..im using npp [2012-07-25 14:05:02] WARNING: Loading script failed: [roleplay]\bank\server.lua:2: unexpected symbol near 'Â'
  5. i want it to check if the player has a value for bankMoney, if not then it sets it as 0 but i cant get it to work cause im a noob. serverside function checkBalance() playerName = getPlayerName(thePlayer) account = getPlayerAccount ( source ) bankMoney = getAccountData ( account, "bankcash" ) if ( bankMoney==nil ) then setAccountData ( account, "bankCash", 0 ) bankMoney=0 else outputChatBox ( "EagleBot: " .. playerName .. " has $" .. bankMoney .. " in his bank!" ) end end addCommandHandler ( "bank" , checkBalance )
  6. He has it on meta, not the file is not on the resource. oh lool, didnt see that...
  7. or he didnt add it into the meta.
  8. One more thing, how do i make this so that the args after command are counted as one string. function addPickup ( thePlayer, command, desc ) outputChatBox ( desc ) end addCommandHandler ("makeclue", addPickup)
  9. serverside function giveClue ( hitElement, matchingDimension) destroyElement( clueMarker ) local cash = math.random( 10000, 15000 ) givePlayerMoney ( hitElement, cash ) outputChatBox ( hitElement .. " has found the clue, he got $" .. cash .. "! The new clue will be spawned in 10 minutes!" ) setTimer ( putClue, 600000, 1 ) end i need the player name but get this error [2012-07-25 10:08:16] ERROR: [roleplay]\clue\server.lua:6: attempt to concatenate local 'hitElement ' (a userdata value)
  10. Thanks, but there are still some errors [2012-07-24 17:44:21] ERROR: [roleplay]\rrtrucker\rrtrucker_server.lua:237: bad argument #1 to 'pairs' (table expected, got nil) [2012-07-24 17:46:38] ERROR: [roleplay]\rrtrucker\rrtrucker_server.lua:199: attempt to index field '?' (a nil value) im going to try to find out why these happen I CANT TELL YOU GUYS HOW GREAT YOU ARE, I GOT IT WORKING!
  11. Thanks, but there are still some errors [2012-07-24 17:44:21] ERROR: [roleplay]\rrtrucker\rrtrucker_server.lua:237: bad argument #1 to 'pairs' (table expected, got nil) [2012-07-24 17:46:38] ERROR: [roleplay]\rrtrucker\rrtrucker_server.lua:199: attempt to index field '?' (a nil value) im going to try to find out why these happen
  12. OK i got that problem solved, but now i am getting this error for this part of the code. [2012-07-24 17:22:58] WARNING: [roleplay]\rrtrucker\rrtrucker_server.lua:142: Bad argument @ 'getElementPosition' [2012-07-24 17:22:58] WARNING: [roleplay]\rrtrucker\rrtrucker_server.lua:151: Bad argument @ 'getDistanceBetweenPoints3D' serverside: addEvent("givePoint", true) function givePoint( playerSource ) -- playerJobLocation[ playerSource ] = { }; -- playerJobLocation[ playerSource ] = { ["x"]=x, ["y"]=y, ["z"]=z }; local numLocations = #truckerLocations repeat local x,y,z = getElementPosition(playerSource) local dropOffPoint = math.random(numLocations) dropOffx = truckerLocations[dropOffPoint]["x"] dropOffy = truckerLocations[dropOffPoint]["y"] dropOffz = truckerLocations[dropOffPoint]["z"] local jobDistance = getDistanceBetweenPoints3D ( x, y, z, dropOffx, dropOffy, dropOffz ) until jobDistance > 1000 and jobDistance < 35000 local dropOffBlip = createBlip ( dropOffx, dropOffy, dropOffz, 41, 2, 255, 0, 0, 255, 1, 99999.0, playerSource) playerBlips[ playerSource ] = { }; table.insert( playerBlips[ playerSource ], dropOffBlip ); pedMarker = createMarker ( dropOffx, dropOffy, 0, cylinder, 6.5, 255, 255, 0, 150, playerSource) playerCols[ playerSource ] = { }; table.insert( playerCols[ playerSource ], pedMarker ); addEventHandler( "onMarkerHit", pedMarker, arriveDropOff ) outputChatBox ( "Drive your products to the destination marker.", playerSource ); end addEventHandler("givePoint", getRootElement(), givePoint)
  13. This is a modification of rrtrucker, i am trying to change it so when you get to the ped, it spawns a trailer, and when trailer is attached to you, it gives you a destination, but i am having problems at function givePoint(), it gives an error saying no ponts specified, can somebody help? serverside: addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() truckSkins = { [206]=true, [133]=true } trucks = { [515]=true, [514]=true, [403]=true } playerClients = { } playerCols = { } playerBlips = { } jobClients = { } playerJobLocation = { }; local XMLTruckerLocations = xmlLoadFile ( "XML\\trucker_locations.xml" ) if ( not XMLTruckerLocations ) then local XMLTruckerLocations = xmlCreateFile ( "XML\\trucker_locations.xml", "trucker_locations" ) xmlSaveFile ( XMLTruckerLocations ) end local trucker_locations = xmlNodeGetChildren(XMLTruckerLocations) truckerLocations = {} for i,node in ipairs(trucker_locations) do truckerLocations[i] = {} truckerLocations[i]["x"] = xmlNodeGetAttribute ( node, "posX" ) truckerLocations[i]["y"] = xmlNodeGetAttribute ( node, "posY" ) truckerLocations[i]["z"] = xmlNodeGetAttribute ( node, "posZ" ) truckerLocations[i]["r"] = xmlNodeGetAttribute ( node, "rot" ) end xmlUnloadFile ( XMLTruckerLocations ) end ) function enterVehicle ( thePlayer, seat, jacked ) if ( trucks[getElementModel ( source )] ) and ( not truckSkins[getElementModel ( thePlayer )] ) and (seat == 0) then cancelEvent() outputChatBox ( "Only truckers drivers can drive Transports!", thePlayer ) end end addEventHandler ( "onVehicleStartEnter", getRootElement(), enterVehicle ) function startJob ( playerSource ) local x, y, z = getElementPosition ( playerSource ) if not playerClients[ playerSource ] then local numLocations = #truckerLocations if ( numLocations > 0 ) then repeatCount = 0; repeat local pickupPoint = math.random(numLocations) pickupx = truckerLocations[pickupPoint]["x"] pickupy = truckerLocations[pickupPoint]["y"] pickupz = truckerLocations[pickupPoint]["z"] pickupr = truckerLocations[pickupPoint]["r"] local jobDistance = getDistanceBetweenPoints3D ( x, y, z, pickupx, pickupy, pickupz ); repeatCount = repeatCount+1 until jobDistance > 100 and jobDistance < 800 + repeatCount*100 repeat local id = math.random( 10, 270 ) ped = createPed( tonumber( id ), pickupx, pickupy, pickupz ) setPedRotation ( ped, pickupr ) until ped playerClients[ playerSource ] = { }; table.insert( playerClients[ playerSource ], ped ); table.insert( jobClients, ped ); local pedBlip = createBlipAttachedTo ( ped, 41, 2, 255, 0, 0, 255, 1, 99999.0, playerSource) playerBlips[ playerSource ] = { }; table.insert( playerBlips[ playerSource ], pedBlip ); pedMarker = createMarker ( pickupx, pickupy, 0, cylinder, 6.5, 255, 255, 0, 150, playerSource) playerCols[ playerSource ] = { }; table.insert( playerCols[ playerSource ], pedMarker ); addEventHandler( "onMarkerHit", pedMarker, arrivePickup ) outputChatBox ( "Pickup the passenger with delivery located at the marker.", playerSource ); else outputChatBox ( "No passenger pickup points specified, contact an admin!", playerSource ); end else outputChatBox ( "You already have an assignment!", source ); end end addCommandHandler ("startjob", startJob); function arrivePickup ( playerSource ) if playerClients[ playerSource ] then for k, ped in pairs( playerClients[ playerSource ] ) do if ped then local x,y,z = getElementPosition(ped); local tx,ty,tz = getElementPosition(playerSource); setPedRotation(ped, findRotation(x,y,tx,ty) ); local numLocations = #truckerLocations if ( numLocations > 0 ) then local playerVehicle = getPedOccupiedVehicle ( playerSource ); if playerVehicle and trucks[getElementModel ( playerVehicle )] then local speedx, speedy, speedz = getElementVelocity ( playerSource ); local actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5); if actualspeed < 0.25 then local occupants = getVehicleOccupants(playerVehicle); local seats = getVehicleMaxPassengers(playerVehicle); local freeSeats = 0; for seat = 0, seats do local occupant = occupants[seat]; if not occupant and tonumber(freeSeats) == 0 then freeSeats = freeSeats + 1; warpPedIntoVehicle ( ped, playerVehicle, seat ); if playerBlips[ playerSource ] then for k, blip in pairs( playerBlips[ playerSource ] ) do if blip then destroyElement( blip ); playerBlips[ playerSource ] = nil; end end end if playerCols[ playerSource ] then for k, col in pairs( playerCols[ playerSource ] ) do if col then destroyElement( col ); playerCols[ playerSource ] = nil; end end end trailer = createVehicle ( 435, x-2 ,y-2 ,z+1) triggerEvent("givePoint") end end if tonumber(freeSeats) == 0 then outputChatBox ( "You don't have an empty seat for the passenger!", playerSource ); end else outputChatBox ( "Slow down to pick up the passenger!", playerSource ); end else outputChatBox ( "You do not have a driver vehicle!", playerSource ); end else outputChatBox ( "No passenger pickup points specified, contact an admin!", playerSource ); end end end end end addEvent("givePoint", true) function givePoint( playerSource ) local x,y,z = getElementPosition(ped); playerJobLocation[ playerSource ] = { }; playerJobLocation[ playerSource ] = { ["x"]=x, ["y"]=y, ["z"]=z }; repeat local dropOffPoint = math.random(numLocations) dropOffx = truckerLocations[dropOffPoint]["x"] dropOffy = truckerLocations[dropOffPoint]["y"] dropOffz = truckerLocations[dropOffPoint]["z"] local jobDistance = getDistanceBetweenPoints3D ( x, y, z, dropOffx, dropOffy, dropOffz ); until jobDistance > 1000 and jobDistance < 35000 local dropOffBlip = createBlip ( dropOffx, dropOffy, dropOffz, 41, 2, 255, 0, 0, 255, 1, 99999.0, playerSource) playerBlips[ playerSource ] = { }; table.insert( playerBlips[ playerSource ], dropOffBlip ); pedMarker = createMarker ( dropOffx, dropOffy, 0, cylinder, 6.5, 255, 255, 0, 150, playerSource) playerCols[ playerSource ] = { }; table.insert( playerCols[ playerSource ], pedMarker ); addEventHandler( "onMarkerHit", pedMarker, arriveDropOff ) outputChatBox ( "Drive your products to the destination marker.", playerSource ); end addEventHandler("givePoint", getRootElement(), givePoint) function arriveDropOff ( playerSource ) if playerClients[ playerSource ] then for k, ped in pairs( playerClients[ playerSource ] ) do if ped then local pedVehicle = getPedOccupiedVehicle ( ped ); local playerVehicle = getPedOccupiedVehicle ( playerSource ); if playerVehicle and trucks[getElementModel ( playerVehicle )] then if pedVehicle == playerVehicle then local speedx, speedy, speedz = getElementVelocity ( playerSource ); local actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5); if actualspeed < 0.22 then removePedFromVehicle ( ped ); if playerClients[ playerSource ] then for k, ped in pairs( playerClients[ playerSource ] ) do if ped then destroyElement( ped ); playerClients[ playerSource ] = nil; end end for k, blip in pairs( playerBlips[ playerSource ] ) do if blip then destroyElement( blip ); playerBlips[ playerSource ] = nil; end end for k, col in pairs( playerCols[ playerSource ] ) do if col then destroyElement( col ); playerCols[ playerSource ] = nil; end end dx = tonumber(playerJobLocation[ playerSource ]["x"]); dy = tonumber(playerJobLocation[ playerSource ]["y"]); dz = tonumber(playerJobLocation[ playerSource ]["z"]); local tx,ty,tz = getElementPosition(playerSource); local jobDistance = getDistanceBetweenPoints3D ( dx, dy, dz, tx, ty, tz ); local jobDistanceKM = round(jobDistance/1000,2); local jobReward = round(10+(jobDistanceKM^0.75)*3000); givePlayerMoney ( playerSource, jobReward ); for k, jobLocation in pairs( playerJobLocation[ playerSource ] ) do if jobLocation then playerJobLocation[ playerSource ] = nil; end end outputChatBox ( "Job succesful, you earned "..jobReward.." dollar.", playerSource ); end else outputChatBox ( "Slow down to drop off the passenger!", playerSource ); end else outputChatBox ( "You have lost your passenger!", playerSource ); end else outputChatBox ( "You do not have a driver vehicle!", playerSource ); end end end end end function quitJob ( playerSource ) if playerClients[ playerSource ] then for k, ped in pairs( playerClients[ playerSource ] ) do if ped then destroyElement( ped ); playerClients[ playerSource ] = nil; end end for k, blip in pairs( playerBlips[ playerSource ] ) do if blip then destroyElement( blip ); playerBlips[ playerSource ] = nil; end end for k, col in pairs( playerCols[ playerSource ] ) do if col then destroyElement( col ); playerCols[ playerSource ] = nil; end end if playerJobLocation[ playerSource ] then for k, jobLocation in pairs( playerJobLocation[ playerSource ] ) do if jobLocation then destroyElement( jobLocation ); playerJobLocation[ playerSource ] =
  14. this isnt working, im making a truck job, when the trailer attaches, it is supposed to trigger the event, but it isnt even outputting clientside addEvent( "createTrailer", true) function createTrailer() local localPlayer = getLocalPlayer ( ) local x,y,z = getElementPosition(localPlayer) trailer = createVehicle ( 435, x+1 ,y+1 ,z+1) end addEventHandler ( "createTrailer", getRootElement(), createTrailer ) function onAttach() outputChatBox("trailerattached") triggerServerEvent ( "givePoint", getLocalPlayer() ) end addEventHandler("onClientTrailerAttach", getRootElement(), onAttach)
  15. Nope. Ok, then i was right, damn the limitations of gtasa
  16. I need help importing a model/texture, i know how you can replace a model/texture, but i dont want to replace a model/texture, is it possible to import a mode/texturel on to a NEW ID?
  17. thanks to you, i successfully got my car system finished AMARANT FTW!
  18. if getElementID(cari) = getPlayerAccount (source), "cari") then --some code-- else outputChatBox ( "This car is not yours!" , source) setElementHealth (getElementData (source, "hiscari"), 0) destroyElement(cari) removeElementData (source, "hiscari") end what am i doing wrong, im getting an error saying that 'then' isnt there but it is...
  19. I recently made a few scripts, and I was wondering why they have conflicts when i put them as one. s_base and c_base conflict with s_cars and c_cars. the Angel deal is suppose to come on death, but it comes on resource load and the markers are not created, any idea why its broken? Here is a link to the resource. http://delta.gamerush.si6.us/mtasa/basemode.zip
  20. I tried both, they both work, but i find the way you told me more comfortable
×
×
  • Create New...