Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Jeeveegee

  • Rank
  1. So if I understand you correctly you suggest that I create the functions in a new resource specificaly designed to load my queries, and export them to access them in other resources?
  2. I'm currently working on my own roleplay server and I have created serveral resources that all connect to one MySQL database with serveral tables that contain all the userdata. When I need the data ingame in a resource I load it from the MySQL database and store it in an array/table in my script This is usually when a new player logs into the server. When the user quits the server his data is saved again in the MySQL database. The problem is I somtimes need the same information from the database in multiple resources at the same time. Which means that if I load the data from the MySQL databas
  3. This script teleports you from one warp-marker to another warp-marker. The problem is, the script loops 2 or 3 times when people enter the marker, and while sometimes you end up at the right location, sometimes you just warp to your current location. I tried to fix it by setting timers and something like that, but that isn't working. Anyone who can help me? function hitMarker(hitElement, matchingDimension) function typeEnter() local elementType = getElementType(hitElement) if elementType == "player" then local warpID = getElementData(
  4. Alright so far it seems to work! So let's me try and get this straight: - triggerServerEvent() use localPlayer. - triggeringClientEvent() use source two times. Then it will always be that players gui only?
  5. Alright so I changed what you told me to do, but it's still showing the GUI to every player. Anything else I might have missed? Client-Side function createVehicleWindow() local Width = 200 local Height = 200 local X = 100 local Y = 400 vehicleWindow = guiCreateWindow(X, Y, Width, Height, "Vehicle Window", false) guiWindowSetSizable(vehicleWindow, false) guiSetVisible(vehicleWindow, false) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() bindKey ("F4", "down", showVehicleWi
  6. Here are the scripts, serverside and client-side. They are used to load the players vehicle from the mysql database, which can contain a maximum of two cars. Everytime the player presses F4 the gui pops up with the car data for that player, but then it also pops up at every other player. I read something about it having to do with using 'getRootElement()' and 'source' and I tried to figure that out but everything I tried failed. Here's the script. Client-Side function createVehicleWindow() local Width = 200 local Height = 200 local X = 100 local Y = 400
  7. That's exactly what I showed you, but I will post the whole script. it's made up of two seperate scripts, so I will post them both. --LOGIN SCRIPT function loginHandler(username, password) outputChatBox("Name: " .. username .. " and password: " .. password .. ".", client) local result = mysql_query(handler, "SELECT * FROM players WHERE playerName = '" .. username .. "' AND playerPassword = '" .. password .. "' ") local count = mysql_num_rows(result) if (count == 1) then if (client) then local row = mysql_fetch_assoc(result)
  8. function onPlayerDisconnect(quitType) local online = getElementData(source, "loggedIn") if (online == "WelcomeBack") then local playername = getPlayerName(source) local ID = mysql_query(handler,"SELECT playerID FROM players WHERE playerName = '"..playername.."'") local row = mysql_fetch_assoc(ID) local playerID = row['playerID'] outputDebugString("Disconnect Server Script "..playerID) triggerClientEvent("saveWeapons", getRootElement(), playerID) mysql_free_result(ID) local x, y, z
  9. I asked you that ( for server-side code ), you didn't answer me... I guess I did not define the source, how exactly do you suggest me doing that?
  10. Then how do I properly use getPedWeapon and getpedTotalAmmo? I read about it on the wiki and used it like I showed in my first post, but that is not working. Any idea how to get rid of that 'bad argument'?
  11. I changed 'root' to 'getRootElement()' like you told me too, but the client script is still not triggered.
  12. So now I am trying to trigger the function, which is now saved client-side, from a server-side script like this but nothing is happening. I checked an the client script is not triggered, any help? server script triggerClientEvent("saveWeapons", root, playerID) client script function weaponSaveHandler(playerID) outputDebugString("Disconnect Client Script"..playerID) local weaponSlot0 = getPedWeapon(getLocalPlayer(),0) local weaponAmmo0 = getPedTotalAmmo(getLocalPlayer(),0) local weaponSlot1 = getPedWeapon(getLocalPlayer(),1) local weaponAmmo1 = getPedTot
  13. Every time I try to use getPedWeapon and getPedTotalAmmo it returns the following in the console: Bad argument @ 'getPedWeapon' Bad argument @ 'getPedTotalAmmo' I use this script in a function after 'onPlayerQuit' to get the weapon and ammo and save it to a mysql database. Any idea how to fix this? This is how I try to retrieve the data local weaponSlot0 = getPedWeapon(source,0) local weaponAmmo0 = getPedTotalAmmo(source,0) local weaponSlot1 = getPedWeapon(source,1) local weaponAmmo1 = getPedTotalAmmo(source,1)
  14. It took serveral attemps and some random guessing on what to do, but now it's working! Thanks!
  15. Alright so I don't fully understand how to use the setElementData and getElementData, but this is what I tried in my script and it didn't work, so maybe you guys can tell me how to properly use them? added this to the login script: setElementData(source,"playerLoggedIn", true) and this is the changed disconnect script: function onPlayerDisconnect(quitType) if (getElementData(source, "playerLoggedIn") == true) then local x, y, z = getElementPosition(source) local rx,ry,rz = getElementRotation(source) mysql_query(handler,"UPDATE players SET playerH
  • Create New...