Jump to content

Castillo

Retired Staff
  • Posts

    21,935
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Castillo

  1. Ok, I fixed the error you mentioned, copy it again.
  2. Castillo

    spawn

    Oh, I supposed my impostor wasn't still active . 1: I don't use the "[MM]" tag since many months (a year maybe?). 2: I would never ask for Admin rights. 3: Can you PM me his IP & Serial maybe?
  3. Copy my last code again and see if it works, I changed it to just ONE table, as one table for each is just ridiculous.
  4. function creatingTables() exports.scoreboard:addScoreboardColumn("Cash") executeSQLCreateTable("playerData", "serial STRING, Cash INT, DMAttempts INT, DDAttempts INT") outputChatBox("Cash System by KHD started.") for index, player in ipairs(getElementsByType("player")) do addAccountIfNotExists(player) end end addEventHandler("onResourceStart", resourceRoot, creatingTables) function addAccountIfNotExists(player) local serial = getPlayerSerial(player) CheckPlayer = executeSQLSelect ( "playerData", "serial", "serial = '" .. serial .. "'" ) if ( type( CheckPlayer ) == "table" and #CheckPlayer == 0 ) or not CheckPlayer then executeSQLInsert ( "playerData", "'"..serial.."','0','0','0'" ) end end addEventHandler("onPlayerJoin",root,function () addAccountIfNotExists(source) end) function DestructionMoney(mapInfo,mapOptions,gameOptions) info = mapInfo.modename if mapInfo.modename == "Destruction derby" then for k,v in ipairs(getElementsByType("player")) do local serial = getPlayerSerial(v) local DDAttempts = executeSQLSelect ( "playerData", "DDAttempts","serial = '" .. serial .. "'") local DDAttempts = tonumber(DDAttempts[1]["DDAttempts"]) + 1 executeSQLUpdate ( "playerData", "DDAttempts = '"..DDAttempts.."'","serial = '" .. serial .. "'") setElementData(v,"data.DDAttempts",DDAttempts,true) end end end addEvent("onMapStarting") addEventHandler("onMapStarting", getRootElement(), DestructionMoney) function DestructionMoney2(thePlayer) local playername = getPlayerName(thePlayer) local serial = getPlayerSerial(thePlayer) local Cash = executeSQLSelect ( "playerData", "Cash","serial = '" .. serial .. "'") outputChatBox("*Wins: "..playername.." took $"..get('MoneyForDD').." for winning the map!",getRootElement(),255,255,0) local Cash = tonumber(Cash[1]["Cash"]) + get('MoneyForDD') setElementData(thePlayer ,"Cash", Cash) setElementData(thePlayer ,"data.money",Cash,true) setElementData(thePlayer ,"data.playername",playername,true) executeSQLUpdate ( "playerData", "Cash = '"..Cash.."'","serial = '" .. serial .. "'") end function hunterBonus(pickupID, pickupType, vehicleModel) if (info == "Destruction derby" and pickupType == "vehiclechange" and vehicleModel == 425) then local serial = getPlayerSerial(source) local Cash = executeSQLSelect ( "playerData", "Cash","serial = '" .. serial .. "'") local Cash = tonumber(Cash[1]["Cash"]) + 1000 outputChatBox("*Hunter: "..getPlayerName(source).." gets a $1000 hunter bonus!",source,25,125,225) setElementData(source ,"Cash", Cash) setElementData(source ,"data.money",Cash,true) executeSQLUpdate ( "playerData", "Cash = '"..Cash.."'","serial = '" .. serial .. "'") end end addEventHandler("onPlayerPickUpRacePickup",getRootElement(),hunterBonus)
  5. Show us your COMPLETE code.
  6. If you are new to Lua scripting, then you shouldn't start with hard things.
  7. This script is not complete, you are triggering this event: "onClientReady", but from where? Because, "ERROR: cashddDMKHD\cashdddm.lua:38: attempt to index field '?' (a nil value)", means that the user is not in the SQL table.
  8. Castillo

    spawn

    I think this is what you're looking for: https://community.multitheftauto.com/index.php?p= ... ls&id=1152
  9. Nice one, keep up the good work .
  10. Castillo

    Breath

    I don't think you can "cancel" the breath. You can hide it with showPlayerHudComponent and maybe use cancelEvent() onClientPlayerDamage, when the player is underwater.
  11. Yeah, maybe, but Ryden's MySQL module cannot load SQLITE databases, and this one can, since Jaysd was looking for that, Ryden's won't help him.
  12. They also work in 1.1 nightly builds as it says in the wiki.
  13. You may want to take a look at the new DB functions (just for nightly yet): https://wiki.multitheftauto.com/wiki/DbConnect It allows you to create your own SQLITE databases and connect to them.
  14. I doubt someone would use it as a guide, I guess mainly they will use it like it is.
  15. setTimer ( function () --setTimer para crear un delay entre el momento en que cambia en ID y cuando te da las ruedas vehicle = getPedOccupiedVehicle ( getLocalPlayer () ) --vehicle = obtener el vehiculo actual if (not vehicle) then return end currentWheel = getElementModel ( vehicle ) --currentWheel = el modelo actual ( del vehiculo ) if oldCurrentWheel == currentWheel then -- si el modelo viejo es igual al actual entonces... --no hacer nada else --pero si es distinto addVehicleUpgrade( vehicle, 1075 ) --agregarle a "vehicle" las ruedas 1075 end oldCurrentWheel = getElementModel ( vehicle ) --oldCurrentwheel = el vehiculo actual end, 100, 0 ) --delay de 100 ms.
  16. Castillo

    Table

    Well, that's because "marker" doesn't exists until you type "/pizza". function pizzaGuy() x, y, z = getRandomPosition() marker = createMarker(x, y, z, "cylinder", 1.5, 0, 255, 255, 255) blip = createBlipAttachedTo (marker, 41) outputChatBox("Deliver the pizza to the blip on the map") addEventHandler("onClientMarkerHit", marker, pizzaDeliver) end addCommandHandler("pizza", pizzaGuy) function pizzaDeliver(hitPlayer) if (hitPlayer ~= localPlayer) then return end if isPedInVehicle(hitPlayer) == true then triggerServerEvent("givePizzaMoney", hitPlayer) destroyElement(marker) destroyElement(blip) pizzaGuy() else cancelEvent() outputChatBox("You need your vehicle man, The pizza is in it...") end end
  17. Castillo

    Table

    You're welcome.
  18. Castillo

    Table

    function getRandomPosition() return unpack(pizzaTable[math.random(#pizzaTable)]) end local x, y, z = getRandomPosition() local marker = createMarker(x, y, z)
  19. Eso es lo que yo entendi que querias, me equivoque?
  20. Yo que vos uso el mio (no es por sea mejor o algo parecido), pero es mas simple.
  21. Yes, my bad, copy the code again, I forgot about an argument .
  22. You're welcome. P.S: Some administrator move this topic to the "Scripting" section .
  23. Ni yo, pero ultimamente me estan contratando para scripts de race, asi que tengo que saber que eventos existen .
  24. Gate1 = createObject ( 969, 209.69999694824, 1875.5, 12.39999961853, 0, 0, 0 ) function ToggleGate(thePlayer,command) moveObject (Gate1, 4000, 210.10000610352, 1875.5999755859, 8.8999996185303) setTimer(moveObject,6000,1,Gate1,4000,209.69999694824, 1875.5, 12.39999961853) end addCommandHandler ( "mgo", ToggleGate ) This will close it after 6 seconds.
×
×
  • Create New...