Jump to content

tosfera

Members
  • Posts

    1,193
  • Joined

  • Last visited

Everything posted by tosfera

  1. The script is almost right, you should have gotten an error about a string. 'cause text is usually as a string. So, change the var to a string and it should work: function createText ( ) local nazov = "HELLO WORLD" dxDrawText( nazov,sw/2-350, sh/2-75, 700, 150, tocolor ( 255, 0, 0, 255 ), 1.02, "defalut-blod" ) end but before the dxDrawText is working, you need to use a onClientRender, try this: client: local screenWidth, screenHeight = guiGetScreenSize ( ) function errorMsg ( errorStr ) errorMsg = errorStr addEventHandler("onClientRender", root, drawErrorMsg ) setTimer ( function ( ) removeEventHandler("onClientRender", root, drawErrorMsg ) end ,5000, 1 ) end function drawErrorMsg ( ) dxDrawText ( errorMsg, (screenWidth / 2 ) + 10, (screenHeight /4), screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1, "default-bold" ) end To call this functions, use the clientTriggerEvent in the server script, like this: triggerClientEvent(thePlayer, "errorMsg", root, "This is being drawed on the screen!")
  2. tosfera

    Fuel system

    Hey, I'm not here for asking a script or so but I could use some help with thinking. Something my mind isn't thinking logical. So, i'm going to start and write a fuel system, but I need a way to safe the data, I was thinking about saving the fuel to the element, like the fuel is being saved as data to the car, but when the car explodes, it will be gone (I can reset it then), but the other thing I'm thinking about, when the player is driving the fuel will go down, and getting the elementdata every little second might bring lag? (I think) so I'm kinda,,, lost right now. Any help would be appreciated!
  3. woow, would have never tought about that, thanks mate!
  4. hey I'm trying to save some data into my db but it keeps saying that the colum: ID doens't exist. but I am creating it, I already dropped the database and remade it but it isn't working. addEventHandler("onResourceStart", root, function () db = dbConnect( "sqlite", "players.db" ) executeSQLQuery("CREATE TABLE IF NOT EXISTS player_vehicle (ID int, modelID int, color1 int, color2 int, color3 int, color4 int, vehicleOwner TEXT, upgrades TEXT, saveX TEXT, saveY TEXT, saveZ TEXT, vehicleHealth TEXT)") end ) function insertData_buyVehicle(vehiclecreated) local modelID = getElementModel(vehiclecreated) local accName = getAccountName ( getPlayerAccount ( source ) ) local color_1, color_2, color3, color4 = getVehicleColor(vehiclecreated) local owner = setElementData(vehiclecreated, "vehicle-owner", accName) insert = executeSQLQuery("INSERT INTO player_vehicle(ID, modelID,color1,color2,color3,color4,vehicleOwner, vehicleHealth, saveX, saveY, saveZ) VALUES(MAX(ID)+1,?,?,?,?,?,?,?,?,?,?)", modelID, color1, color2, color3,color4, accName, "1000", 2138.6918945313, -1120.3012695313, 26 ) if ( insert ) then outputChatBox("You're the new owner of this car!", source) else outputChatBox("Something went wrong!", source) end end
  5. okee let me test the code than, hang on a sec! edit: okee I made 2 commands out of it, it works now. The thing is, he didn't add the elementData to the player, so it couldn't go back. right now I've saved them in your account data, and it works. All you've to do it create the functions around it again. if you got a minute I'll do it for you: addCommandHandler("afk", function (source) local x,y,z = getElementPosition (source) setAccountData(getPlayerAccount(source),"away-x",x) setAccountData(getPlayerAccount(source),"away-y",y) setAccountData(getPlayerAccount(source),"away-z",z) setElementInterior ( source, 1, 681.5, -455.46, -25.6 ) end) addCommandHandler("back", function (source) if getAccountData(getPlayerAccount(source),"away-x") then local x = getAccountData(getPlayerAccount(source),"away-x") local y = getAccountData(getPlayerAccount(source),"away-y") local z = getAccountData(getPlayerAccount(source),"away-z") setElementInterior ( source, 0, x, y, z ) end end)
  6. You can use the client and server side scripting for this. Like, you can make a gui when the player hits the marker(client, server) or give the player money (server), warp him into a car and place them somewhere in the air! (server) The last one will be funny! local marker = createMarker(0,0,5, "cylinder", 2, 0, 255, 0, 150) -- create's the marker addEventHandler("onMarkerHit", root, function ( hitElement ) if ( source == marker ) then -- if he hits the right marker local v = createVehicle(602, 0, 0, 1200) -- create the vehicle warpPedIntoVehicle(hitElement, v) -- warp him into a vehicle outputChatBox("Dont look down!", hitElement) -- tell him that he is fcked! ;3 end end )
  7. tosfera

    Item

    You want to create custom guns? well I'd read something that you were able to make custom objects and use them as a gun...
  8. try this: function onIdle (thePlayer) for index, thePlayer in ipairs(getElementsByType("player"))do if (getPlayerIdleTime(thePlayer) > 5000) then --120000 local x,y,z = getElementPosition (thePlayer) setElementData(thePlayer,"away-x",x) setElementData(thePlayer,"away-y",y) setElementData(thePlayer,"away-z",z) setElementInterior ( thePlayer, 1, 681.5, -455.46, -25.6 ) end end end setTimer(onIdle, 1000, 0) function onBack (thePlayer) if getElementData(thePlayer,"away") then local x = tonumber(getElementData(thePlayer,"away-x")) local y = tonumber(getElementData(thePlayer,"away-y")) local z = tonumber(getElementData(thePlayer,"away-z")) setElementInterior ( thePlayer, 0, x, y, z ) end end addCommandHandler("back", onBack)
  9. tosfera

    Gridview's

    https://wiki.multitheftauto.com/wiki/GuiGridListClear Do you got a bassball bat? If so, HIT ME IN MY FACE AS HARD AS YOU CAN!
  10. tosfera

    i need help

    a nil value -> doesn't exist. So, you should give the getData to the client function as a parameter.
  11. tosfera

    i need help

    If you're not posting your errors, then how can I fix them?
  12. tosfera

    Gridview's

    hey guys, I could use some help with thinking, I'm writing a vehicle shop and trying to fill out the gridlist for my userpanel. Right now, when I'm filling the gridlist when the resource starts. BUT, if you buy a vehicle it wont get filled in because it needs a restart. So my question is, how can I fill in the grid without restarting the resource, and not getting it into my gridlist for like, 1000 times. (as far as I know there isn't something like; guiGridListClear. I've also been thinking about adding the last gridlistitem when the player buys a car but that wouldn't be helpfull when he reopens the panel... :\ Anyone that has some suggestions?
  13. already solved it. Still thanks! n_n Haven't thought about that
  14. tosfera

    i need help

    Just a quick reply for now; I would use executeSQLQuery Okee so if you post me your errors I'll take a look.
  15. Thats the point, it isn't in the admin resource hmm i checked the wiki. seems like its a server command; https://wiki.multitheftauto.com/wiki/Ser ... ands#whois noticed that too, I did the same reseach
  16. Thats the point, it isn't in the admin resource
  17. there is a /whois and /whowas command in admin resource. i think u can make it what you want by editing admin resource. yes, thats a good example! now I can finally say what I'm trying to do!! I want the command /whois to work with a serial, like; /whois if that isn't possible I might save it with the players account. edit: started thinking about it when I was downstairs, it gets saved by the players serial, time to find out where its hiding! edit2: Ill do the alternative thing I had in mind, cause this isn't working out. its hidding somewhere I can't find and its just for 1 single thing, aint that much of a big deal.
  18. tosfera

    help

    client: addEventHandler("onClientVehicleEnter", root, function(thePlayer, seat) local theVehicle = source if seat == 0 and thePlayer == localPlayer and getElementModel(theVehicle) == 601 then x, y, z = getElementPosition ( theVehicle ) rx, ry, rz = getElementRotation ( theVehicle ) minigunOne = createWeapon ( "minigun", x, y, z ) setElementAlpha ( minigunOne,0) attachElements ( minigunOne, theVehicle, 0.15, 0, 1.3, 0, 0, 93 ) bindKey ( "mouse1", "down", enableFire ) bindKey ( "mouse1", "up", disableFire ) end end ) addEventHandler("onClientVehicleExit", root, function(thePlayer, seat) local theVehicle = source if seat == 0 and thePlayer == localPlayer and getElementModel(theVehicle) == 601 then if minigunOne then destroyElement (minigunOne) unbindKey ( "mouse1", "down", enableFire ) unbindKey ( "mouse1", "up", disableFire ) end end end ) function enableFire() if isTimer(MGtimer) and minigunOne then killTimer(MGtimer) else MGtimer = setTimer(function() setWeaponState ( minigunOne, "firing" ) end, 50, 1) MiniSound = playSound( "Pro_Minigun.wav", true) setSoundVolume(MiniSound, 0.4) setSoundSpeed ( MiniSound, 0.9 ) end end function disableFire() if isTimer(MGtimer) and minigunOne then killTimer(MGtimer) else MGtimer = setTimer(function() setWeaponState ( minigunOne, "ready" ) end, 50, 1) stopSound ( MiniSound ) end end function mgRotate () if minigunOne then triggerServerEvent ("mgserver", source, mgserver) setElementRotation(minigunOne,rotX,rotY,rotZ) end end addEventHandler ( "onClientRender", root, mgRotate )
  19. Ehh wel I'm more searching for an function that gets the playername by a serial. And if I need to download that crappy source, and search for it... its going to take a while.
  20. hey hey, I'm trying to get the player from a serial. its kinda hard to explain... I got a serial, and with that serial I want to get user information. like the name of the player! how can I recover the name of the player by just having the serial? O_O Thanks in advance!
  21. Tested, worked, thanks!
  22. Any way to check if when the player enters as a occupant or as driver? (onVehicleStartEnter) cause I want to disable it when they dont got the rights (the rights are saved in the account data)
  23. Hey thanks man, sorry 'bout yesterday. Trolling isn't the best thing to do at those points but, it kinda worked! Thaanks :3
×
×
  • Create New...