-
Posts
319 -
Joined
-
Last visited
-
Days Won
3
Everything posted by Lpsd
-
Just look at the example of the function he gave you on the Wiki, https://wiki.multitheftauto.com/wiki/SetAccountData Yes, you can use SQL. Use MTA's SQL functions, starting with https://wiki.multitheftauto.com/wiki/DbConnect
-
You just verified my point. You have skipped the problem. I'm not saying your "solution" doesn't stop the error from showing up - but it's really bad practice. I assume the OP is trying to create a system in which as long as the users 'level' or such is above 2 and they press F1, a GUI opens - but he's either entering the wrong value for "Stats" or simply not creating it at all. Your solution, I assume, will just return 0 every time - since "Stats" is false. This means no one will ever be able to open the GUI. The most practical approach would be to look at the stats/level system and work out why "Stats" isn't being saved or created correctly. No one is going to be able to increase their "Stats" if that system is broken.
-
@Abdul KariM Yes, I'm quite aware of that. However there is still a problem somewhere else in the code as I just explained. Your "fix" is actually quite useless, since without finding the underlying problem you'll never get past the if statement.
-
The problem is here: getElementData(localPlayer,"Stats") < 2 "Stats" does not contain a number value, instead it contains a boolean (true or false) - this means that somewhere else in your code you are not setting that player value correctly.
-
@Krazy the issue here is using fixVehicle on a vehicle that has been blown up. In the code that NeXuS provided he solves this issue by checking isVehicleBlown, if this returns true then fixVehicle is not called.
-
Very strange. I have just tested this myself and nothing relevant shows up in the console. Upon blowing the vehicle up, there is a slight freeze and the game crashes with the following information: Version = 1.5.4-release-11595.1.000 Time = Mon Aug 7 22:12:51 2017 Module = C:\Program Files (x86)\QuickTime\QTSystem\QuickTime.qts Code = 0xC000001D Offset = 0x00A13A73 EAX=00863C40 EBX=00300000 ECX=0C737400 EDX=00000000 ESI=0C737400 EDI=3F800000 EBP=00080000 ESP=0028FC70 EIP=66253A73 FLG=00210246 CS=0023 DS=002B SS=002B ES=002B FS=0053 GS=002B It should be worth noting that I used this code (as collider would return nil, I was just testing at Grove Street): addEventHandler("onClientVehicleCollision", root, function(collider,force, bodyPart, x, y, z, nx, ny, nz) if (source == getPedOccupiedVehicle(localPlayer)) then fixVehicle(source) end end ) Using the code you provided fixed the crashing (as it never got inside the isVehicleBlown block), however I did experience the slight freeze upon respawning. I only have the default play resource loaded, and of course this script. I suspect this is something to do with fixVehicle when used on a blown vehicle.
-
I don't mean to be "that guy", but have you tried re-installing MTA?
-
Woah, hold on there a minute bud. Just slow down Why should empty servers be shut down? The thing that doesn't make sense is that you're not the one paying for that server to be running, so what does it matter? I'm finding it hard to follow the logic of your other argument too; getting everyone to play on the popular servers, because those servers with few players are "a waste of time". People like to play in their own little communities, some of which have been around for over a decade now. Also I'm afraid that pushing the entire MTA playerbase to choose between a few servers just really isn't practical - I'm not even going to explain why, just try to think about it.
-
Are you sure it's a reserved word? I've never seen that before. For future reference, if you ever "need" to use reserved keywords in your query (plzno), simply use backticks, e.g: SELECT * FROM `SELECT` WHERE `COLUMN_NAME` = 'somedata'
-
Maybe I'm missing something but I don't see a problem with the code. Can you show us the errors it gives you?
-
local co4 = createColCuboid(2128.56665, -3001.31567, 9.56569, 66.225341796875, 68.13916015625, 19.98176612854) setElementID (co4, "Grupa") addEventHandler ("onColShapeHit", getRootElement(), function(thePlayer, matchingDimension) if not isElement(thePlayer) then return false end if (getElementType (thePlayer) == "player") and (getElementID (source) == "Grupa") and ( getElementData( thePlayer , "gang") == "Grupa" or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin"))) then outputChatBox ("#ffffff[#B08630Base Protection#ffffff] Welcome back to the base, member of Grupa!", thePlayer, 255, 0, 0, true) elseif (getElementType (thePlayer) == "player")and (getElementID (source) == "Grupa") and (not getElementData( thePlayer , "gang") == "Grupa" or not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin"))) then spawnPlayer ( thePlayer, 1851.1171875, -2893.87890625, 12.993751525879) end end) addEventHandler ("onColShapeLeave", getRootElement(), function(thePlayer, matchingDimension) if not isElement(thePlayer) then return false end if (getElementType (thePlayer) == "player") and (getElementID (source) == "Grupa") and ( getElementData( thePlayer , "gang") == "Grupa" or isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin"))) then outputChatBox ("#ffffff[#B08630Base Protection#ffffff] You left the Grupa base!", thePlayer, 255, 0, 0, true) elseif (getElementType (thePlayer) == "player") and (getElementID (source) == "Grupa") and (not getElementData( thePlayer , "gang") == "Grupa" or not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin"))) then outputChatBox ("#ffffff[#B08630Base Protection#ffffff]#ff0000 Access denied!", thePlayer, 255, 0, 0, true) end end)
-
Did you add a custom UV map/wrapping to your object also? If you don't have this then the texture doesn't know where to go
-
Yes, simply check the wiki page for that event https://wiki.multitheftauto.com/wiki/OnPlayerQuit Source The source of this event is the player that left the server.
-
The server manual can be found here https://wiki.multitheftauto.com/wiki/Server_Manual Once that's setup, you can download community resources from https://community.multitheftauto.com/index.php?p=resources (or alternatively search on these forums) You might want to take a look at the Scripting Introduction if you plan on customising any parts of your server. (https://wiki.multitheftauto.com/wiki/Scripting_Introduction)
-
I made something simple for you, play around with it and it should help you to understand Server: local bag = { locations = { --Store your bag locations here {x = 1547.68, y = -1348.78, z = 329.46}, --Tallest building {x = 2495.12, y = -1689.36, z = 14.38} --CJs house } } function bag.spawn(x,y,z) x,y,z = x or 0, y or 0, z or 0 bag.pickup = createPickup( x, y, z, 3, 1550 ) setElementCollisionsEnabled( bag.pickup, false ) end function bag.init(minutes) --bag.create(int minutes) if not minutes or isTimer(bag.timer) or isElement(bag.pickup) then return false end --If there is currently a timer, or a bag spawned on the map, then we can't create a new timer/bag bag.timer = setTimer (function() local loc = bag.locations local i = math.random(1,#loc) --Pick a random bag location from bag.locations bag.spawn(loc[i].x,loc[i].y,loc[i].z) --Spawns the bag. Here we're using a random bag location but you can just define your own x,y,z positions. Random location is optional end, (60*1000*minutes), 1) triggerClientEvent(getRootElement(), "createBagTimer", getRootElement(), minutes) --Setup new bag timer for all clients end addEvent("onBotWasted",true) addEventHandler("onBotWasted", root, function (killer) if (source == nemesilv) then destroyElement(BlipNemesislv) bag.init(20) --Makes a bag spawn after 20 minutes and sets everything up. end end) addEventHandler("onPickupHit", root, --A player picked up the bag function(player) destroyElement(bag.pickup) --Destroy bag pickup local name = getPlayerName(player) outputChatBox(name.." picked up the bag!") -- do whatever you want here end) Client: local sX,sY = guiGetScreenSize() local timerW, timerH = 150,100 local timerX, timerY = (sX / 2) - (timerW / 2), (sY*0.9) - (timerH / 2) --Position of the timer on screen local bag = {} function bag.dx() if not isTimer(bag.timer) then removeEventHandler("onClientRender", root, bag.dx); return end local clock = convertToClock(bag.timer) --Get the timer remaining in clock format dxDrawText("Next Bag In: "..clock, timerX, timerY, timerX+timerW, timerY+timerH, tocolor(255,0,0,225), 2, "default-bold", "center", "center") end function convertToClock(theTimer) --Returns timer in a clock format (e.g: "19:57"), returns false if timer doesn't exist if not isTimer(theTimer) then return false end local remaining = getTimerDetails(theTimer) -- Get the timers remaining (ms) local s = remaining/1000 --seconds from ms return string.format("%.2d:%.2d", s/60%60, s%60) --convert to clock format and return end function bag.setupTimer(minutes) bag.timer = setTimer(function() bag.timer = nil end, (60*1000*minutes), 1) addEventHandler("onClientRender", root, bag.dx) --Start drawing the timer on the clients screen end addEvent("createBagTimer", true) addEventHandler("createBagTimer", root, bag.setupTimer) Any questions, shoot!
-
is it really that hard to restart your mta server manually
-
FYI; you should create a serverside timer when you trigger the createBag event, that serverside timer will be used to create a new bag (or whatever you want to do when 20 minutes is up) as it is more consistent. The client shouldn't handle that.
-
Check the parameters for the onPlayerWasted event https://wiki.multitheftauto.com/wiki/OnPlayerWasted - there aren't any for the player who died You have to use source instead. (source of the onPlayerWasted event is the player who was killed) function deleteOnWasted ( ) if ( isElement ( markers [ source ] ) ) then destroyElement ( markers [ source ] ) end if ( isElement ( blips [ source ] ) ) then destroyElement ( blips [ source ] ) end if ( isElement ( peds [ source ] ) ) then destroyElement ( peds [ source ] ) end end addEventHandler ( "onPlayerWasted", root, deleteOnWasted ) addEventHandler("onPlayerWasted",root, function () if vehicle2 then if isElement( vehicle2 ) then destroyElement( vehicle2 ) end end end)
-
Can we see the code you've already tried?
-
Have you read these guidelines Firstly, what do you mean by PVP? Secondly, can we see an example of code you've already tried & an explanation to what the actual problem is.