Jump to content

tosfera

Members
  • Posts

    1,193
  • Joined

  • Last visited

Everything posted by tosfera

  1. tosfera

    cursor

    if the input is enabled, it will show the... oh god. I think I just deleted 20k lines of code for nothing. #facepalm edit1; Nope, it is still the same. Somehow the cursor shows whenever I create the dx... edit2; oke I got this now, whenever you use guiBringToFront it will enable your cursor for 50%. Any input change will change the state of your cursor. For example; open F8, and close F8. It will make the cursor dissapear. Not sure if this is a bug, but it did gave me a pain in the but.
  2. tosfera

    cursor

    I can't disable the cursor, showCursor ( false ) doesn't work. I can't remove the cursor any way. Stopped all the resource I had running, restarted runcode, restarted my account system, nothing. The cursor didn't want to leave. But I deleted my script which contained 20k lines of code and started over again.
  3. tosfera

    table ...

    What doesn't work, is your gui not showing, you can't sell your vehicle, what's going wrong.
  4. tosfera

    SQL Amounts

    Cause you have no vehicles anymore, haha. The table has been remade if I'm correct. If not, delete the table and then run the script again. else you'll have to add some outputChatBox debug lines around your code and see where it goes wrong.
  5. tosfera

    table ...

    Oke, so one user can have 1 vehicle?
  6. tosfera

    SQL Amounts

    Oke I've rewritten it abit, try this. NOTE THAT, I CHANGED YOUR TABLE LAYOUT! You didn't had the data types in it either. client local vehPrices = { { 571, 250000 } }; function showVehWindow( vehicles ) vehicleWindow() if ( vehWdw ~= nil ) then guiSetVisible ( vehWdw, true ); guiSetInputEnabled ( true ); showCursor ( true ); centerWindow( vehWdw ); for i, v in ipairs ( vehicles ) do row = guiGridListAddRow(veh_vehGrid) guiGridListSetItemText(veh_vehGrid, row, 1, v[i]["vehicleName"], false, false) guiGridListSetItemText(veh_vehGrid, row, 2, v[i]["vehiclePrice"], false, false) end end end addEvent("openVehWindow", true) addEventHandler("openVehWindow", getRootElement(), showVehWindow) server; function createTables() executeSQLQuery ( "CREATE TABLE IF NOT EXISTS vehicles ( vehicleID INT, vehicleModel INT, vehicleName TEXT, vehiclePrice INT, locked INT, x INT, y INT, z INT, hidden INT, account TEXT ) " ); end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), createTables) vehTable = { } function openVehWindow(thePlayer, cmd) local acc = getAccountName ( getPlayerAccount ( thePlayer ) ); local vehRes = executeSQLQuery("SELECT COUNT(*) FROM `vehicles` WHERE `account`=?", acc); if not ( #vehRes == 0 ) then for i,v in pairs ( vehRes ) do table.insert ( vehTable, v["vehicleId"] ); end triggerClientEvent ( "openVehWindow", thePlayer, vehTable ); else outputChatBox ( "You don't have any vehicles!", thePlayer, 255, 0, 0 ); end end addCommandHandler ( "open", openVehWindow )
  7. we don't help you with stolen scripts Aye, that's true. didn't read it propperly, I can write these files for you. but no one out of the community will support you with any stolen / leaked scripts.
  8. You are right, you can use a triggerClientEvent to trigger an event in the client side of your system. Giving the triggerClientEvent a few parameters would allow you to set the text. The easiest way to do so is to send a table filled with data to the client side. loop through all your players and use table.insert to insert them into a table. Which you will use as a parameter in your triggerClientEvent. Dont forget to add the event client sided using addEvent.
  9. tosfera

    table ...

    Oke, so you're trying to create a script that allows people to sell their car for 50% of the price? Just create a list of all the vehicle's that the user owns ( if you saved them in a database ). Then whenever the player selects a vehicle and presses; 'sell'. Search for the vaue in the cars3 ( your array ). Giving the player the money and removing the record out of the database.
  10. I can create quite some good scripts combined with SQL. What can you offer me?
  11. tosfera

    SQL Amounts

    server sided; triggerClientEvent("openVehWindow", getRootElement(), vehicles, price) clientside; function showVehWindow(vehicles, price) Using the # only counts arguments etc, it can not be used to count the rows in tables. Also, getRootElement() can be anything in a trigger, change it to thePlayer. That should fix a few of the problems I guess.
  12. tosfera

    cursor

    Hey guys, Somehow, I can't disable the cursor in my scripts. I've created a login system using the dx functions. Works good, but at the joining it already starts being gay. The cursor is shown, without any code. I commented all my showCursor's, in every single file/script/gamemode etc. But it's still there. Now, when I press F8 twice ( to open and close the debug log thing ), the cursor will be gone. I'll have to enable it using runcode. After that, I'm getting my char screen. I can still dis- and en-able the cursor using runcode. But whenever I spawn as one of my characters. There is no way I can disable my cursor... stopping all the resources, runcode, nothing... o.o' Anyone had this problem before or something like that? I aint gonne post 20k lines of code...
  13. tosfera

    a question

    What do you mean with a custom blip? You want to create an image attached to a player on your radar? Just a random idea; create a static image as an element, attach that element over and over again with onClientRender?
  14. tosfera

    a question

    Aww sh*t, haha. Thanks, fixed it. Not sure if it works anyway, should wait on darhal.
  15. tosfera

    a question

    You can create a blip attached to a player, if you want to do that... addCommandHandler ( "placehit", function ( thePlayer, theCommand, hitPerson, hitPrice ) if ( ( hitPerson ) and ( hitPrice ) ) then if ( getPlayerFromName ( tostring ( hitPerson ) ) ) then local blip = createBlipAttachedTo ( getPlayerFromName ( tostring ( hitPerson ) ), 41 ); setElementData ( getPlayerFromName ( tostring ( hitPerson ) ), "hitprice", hitPrice ); outputChatBox ( tostring ( hitPerson ) .."'s is now worth $".. hitPrice ); else outputChatBox ( "This player is not online.", thePlayer ); end else outputChatBox ( "Wrong usage. example: /placehit billy 500", thePlayer ); end end );
  16. Why didn't you just create seperate functions instead of everything in 1 function, and creating new functions inside the eventHandler. And why didn't you do alot of these things client sided? Would actually fix the biggest problems with it. ps. checking the code now. edit1; rewritten the code for you, in a client/server format. I did not test it! client; addEvent ( "removeCols", true ); addEventHandler ( "removeCols", getRootElement(), function () for i, c in ipairs ( getElementsByType ( "colshape" ) ) do local colOwner = getElementData ( c, "colowner" ); if ( colOwner == getPlayerName ( getLocalPlayer() ) ) then destroyElement ( c ); end end end ); addEvent ( "createTrainCols", true ); addEventHandler ( "createTrainCols", getRootElement(), function ( thePlayer ) if ( thePlayer == getLocalPlayer() ) then for i, c in ipairs ( trainStopPos ) do local col = createColCuboid ( unpack ( envy ) ); setElementData ( col, "colowner", getPlayerName ( getLocalPlayer() ) ); setElementData ( col, "trainStop", i ); createBlipAttachedTo ( col, 19 ); end end end ); addEventHandler("OnClientColShapeHit", getRootElement(), function ( thePlayer ) if ( thePlayer == getLocalPlayer() ) then local stop = getElementData ( source, "trainStop" ); if ( stop ) then setTrainSpeed ( getPedOccupiedVehicle ( getLocalPlayer() ), 0 ); --setTrainSpeed ( thePlayer, 0 ); -- not sure which one works. destroyElement ( source ); takePlayerMoney ( 500 ); if not ( getPlayerMoney () > 499 ) then triggerServerEvent ( "destroyTrain", getLocalPlayer(), getLocalPlayer() ); end setTimer ( function() setTrainSpeed(myTrain, 3) end, 5000, 1 ); end end end ); server; local startMarker = createMarker ( 0, 0, 3, "marker", 2, 255, 255, 255, 255 ); addEventHandler ( "onMarkerHit", startMarker, function ( hitElement ) local money = getPlayerMoney ( hitElement ); local playerName = getPlayerName ( hitElement ); if ( money > 499 ) then local myTrain = createVehicle ( 537, 1453.8831787109, 2628.9331054688, 11.392612457275 ); setElementData ( myTrain, "owner", playerName ); setTrainDerailable ( myTrain, false ); warpPedIntoVehicle ( hitElement, myTrain ); setTrainSpeed ( myTrain, 3 ); triggerClientEvent ( "createTrainCols", hitElement, hitElement ); else outputChatBox ( "You can't afford to go to the next station!", hitElement, 255, 0, 0, true ); end end ); addEvent ( "destroyTrain", true ); addEventHandler ( "destroyTrain", getRootElement(), function ( thePlayer ) local vehicle = getPedOccupiedVehicle ( thePlayer ); if ( vehicle ) then destroyElement ( vehicle ); end outputChatBox ( "You can't afford to go to the next station!", thePlayer, 255, 0, 0, true ); end ); addEventHandler ( "onVehicleStartExit", getRootElement(), function ( thePlayer ) local model = getElementModel ( source ); if ( model == 537 ) then local speed = getTrainSpeed ( getPedOccupiedVehicle ( thePlayer ) ); if not ( speed == 0 ) then return; end end end ); addEventHandler ( "onVehicleExit", getRootElement(), function ( thePlayer ) local model = getElementModel ( source ); if ( model == 537 ) then local owner = getElementData ( source, "owner" ); if ( owner == getPlayerName ( thePlayer ) ) then destroyElement ( source ); triggerClientEvent ( "removeCols", thePlayer ); end end end ); PS. It's not the best way to do it, it will work if your playerbase is low. Else there is a small chance on lag.
  17. That makes no sense as there is no event for that in the script, and there is no 'thePlayer' defined neither. Second of all, there is already a check for the vehicle model, but apparently I've done it wrong accidentally. There is no need to guide me, though, since I have been scripting for around 15 years. Didn't want to guide you, but I wanted to guide Sane-Hosting haha.
  18. look for the; addEventHandler("onVehicleEnter", ... under the function (...) place; local model = getPedOccupiedVehicle ( thePlayer ); if ( model == or model == ) then -- the function which shows the gui etc end
  19. tosfera

    Cursor

    Omg I love you, I totally forgot about the getCursorPosition THANKS!
  20. Just wanted to look into the converter to the distance in meters.
  21. Imma have a look at it, mind if I rewrite it and use it for some other projects?
  22. tosfera

    Cursor

    Hey guys, It's a quite... weird question but is there any idea to return the cursor as an element? I know you can get elements with some specific data, but I'm not sure if the cursor has any data assigned to it or something like that. I was thinking about storing the ShowCursor into a variable but it returns a bool instead of an element. Anyone that knows if there is any data assigned to it, if you can return it as an element? Thanks!
  23. tosfera

    MySQL

    Oke, before you can use MySQL you should install and configure the mysql service. If you don't want a big ass download you can go for Wampp ( which I prefer ) or for Xampp. They both have a MySQL service running in the background, no need to setup a website or hwatever. They are used for it, but you can also just use the mysql service from them. Please note that the mysql service from wamp and xampp has no default password, you should add a password to it in their files or accounts. To access your mysql you're going to use phpMyAdmin which you can find on; localhost/phpmyadmin ( once you installed one of the 2 ). The mysql connection string would be; local db = mysql_connect("localhost", "root", ""); Goodluck with this, alot of servers are using a small service like wamp or xampp to test their server. But I wouldn't prefer to host your database on the same server as your mta server. If they get access to one you'll lose them both. If they only get access somehow to your mysql server, its not a big pain. You can just put a back-up back and you're ready to go. Although you have to open the mysql's accepted connections to external connections. Which is kinda dangerous... Also, if you have problems installing / running the apache service ( which is used for website's, but you also have to got it running ( not sure anymore ) to access the phpmyadmin address ). Turn off your skype and try it again. If you want to turn your skype or teamviewer or such off. Go to the conf.ini in the apache folder and change the listing 80 to 8080, 81, 92, or whatever. This will be the new port. You have to add this port at then end of your address: localhost:8080/phpmyadmin/
  24. Ehm I think you should try this; removeWorldModel(17388, 10000, -1200, -1600, 0, 0); but are you sure it is 17388? Cause I've been trying to search the object related to it but I couldn't find it.
×
×
  • Create New...