
ozulus
Members-
Posts
131 -
Joined
-
Last visited
Everything posted by ozulus
-
Ah c'mon man, this script is using in race gamemode with custom cash system. So cash saved on player's account. ON TOPIC: Please give handler of onPlayerBetWin function. Maybe there is error with addEventHandler.
-
Just use event parameter for get the account addEventHandler ("onPlayerLogin", getRootElement(), function ( _, currentAccount ) local account = getAccountName(currentAccount) local searchForAPlayer = executeSQLQuery("SELECT TEST1, TEST2, TEST3 FROM Avengers WHERE Account = ?", account) if #searchForAPlayer == 1 then setElementData(source, "TEST1", searchForAPlayer["TEST1"]) setElementData(source, "TEST2", searchForAPlayer["TEST2"]) setElementData(source, "TEST3", searchForAPlayer["TEST3"]) end end)
-
There is no such column named "name" dbExec(db, "CREATE TABLE IF NOT EXISTS `banking`(`id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` TEXT)") -- [b]edited take it again[/b]
-
addEventHandler("onClientVehicleDamage",getRootElement(),function(attacker,weapon,loss,x,y,z,tyre) local isPlayerAttackingToTyre = tyre and true or false if isPlayerAttackingToTyre then return end -- If player attacks to vehicle tyre, return and quit. cancelEvent() local parent = getElementData(source,"parent") if getElementData(parent,"vehicle_armor") > 0 then if getElementData(parent,"vehicle_armor")-loss < 1 then local hp = math.floor(getElementData(parent,"vehicle_armor") - loss) if hp < 0 then hp = hp * -1 end setElementHealth(source,getElementHealth(source) - hp) setElementData(parent,"vehicle_armor",0) return true end setElementData(parent,"vehicle_armor",getElementData(parent,"vehicle_armor")-loss) return true end for _, data in ipairs (details) do if parent and isElement(parent) then local detail = getElementData(parent,data[1]) or 0 if detail > 0 then local detail_dam = getElementData (parent,data[1].."dam") or 0 if detail_dam >= 6 then local random = math.random(1,#details) local detale = getElementData(parent,details[random][1]) or 0 if detale > 0 then setElementData(parent,details[random][1],detale - 1) setElementData(parent,details[random][1].."dam",0) checkVehicleMovable(source) break end else setElementData(parent, data[1].."dam", detail_dam+1) break end end end end setElementHealth (source,getElementHealth(source) - loss) end)
-
Try that. dbExec(db, "CREATE TABLE IF NOT EXISTS `banking`(`id` INTEGER PRIMARY KEY AUTOINCREMENT)")
-
addEventHandler( "onClientElementStreamIn", getRootElement( ), function ( ) if getElementType( source ) == "object" then applyCustomTextures( source, "testing") --[b]edited take it again..[/b] end end );
-
Seems you didn't get my point. You cant use "127.0.0.1", "root", "921994" in sql. There is no host, no username and no password in SQL. Try that. local connection = false function createTable() connection = dbConnect("sqlite", "database.db") if connection then dbQuery(connection, "CREATE TABLE IF NOT EXISTS `accounts`('usernames', 'password', 'kills', 'deaths', 'headshots', 'money', 'rank', 'class', 'timeplay', 'vip', 'adminlevel')") end end addEventHandler("onResourceStart", resourceRoot, createTable) If you want to use that connection in other resource, create a export for getting connection in this resource like that: function getSQLConnection() return connection end We must add this export function to the meta.xml function="getSQLConnection" type="server"/> Now, we can use this function in other resource. connection = exports.RESOURCENAME:getSQLConnection() if connection then dbExec(connection, ...) dbQuery(connection, ...) -- and so on... end
-
local GUI = {} GUI["label"] = {} GUI["label"][1] = guiCreateLabel( ... ) GUI["label"][2] = guiCreateLabel( ... ) GUI["label"][2] = guiCreateLabel( ... ) for _, guiElement in ipairs(GUI["label"]) do guiSetVisible(guiElement, true) end -- or guiSetVisible(GUI["label"][1], true) guiSetVisible(GUI["label"][2], true) guiSetVisible(GUI["label"][3], true) -- Both usage is the same. But the first usage look like clear than second one.
-
Wtf is this?! local connection = dbConnect("sqllitle", "dbsql/database.db", "127.0.0.1", "root", "921994") Correct usage is local connection = dbConnect("sqlite", "dbsql/database.db") Also check this out. https://wiki.multitheftauto.com/wiki/DbConnect
-
Lol, onMarkerHit and onMarkerLeave are server-sided function you can not use it in client-side. https://wiki.multitheftauto.com/wiki/OnClientMarkerHit https://wiki.multitheftauto.com/wiki/On ... arkerLeave
-
Dx functions is client-sided. You can't use them in server-side. Try again in client side...
-
local db = dbConnect("sqlite", "database.db") dbExec(db, "CREATE TABLE IF NOT EXISTS `banking`(`id` INT PRIMARY KEY AUTOINCREMENT)") NOT NULL AUTO_INCREMENT and PRIMARY KEY(id) is only for MySQL. So you can't use it. You can use PRIMARY KEY AUTOINCREMENT instead of them.
-
Unfortunately, yes. I use like that scripts for inspect (coding style etc..) but everyone isn't downloading for it.Like this guy, he just want to use this script, not learn Lua as you said. Seems i didn't read correct. My bad sorry..
-
Download GTI RPG resources you may find this script.
-
setTimer(function() removeEventHandler("onClientRender", root, dxDraw) end, 5000, 1)
-
Login Dx, Notification showing for all rather than 1
ozulus replied to Extinction's topic in Scripting
Just change getRootElement() to resourceRoot or source. -
You are appliying shader to object but you wrote vehicle texture name(vehiclegrunge256) in engineApplyShaderToTexture. Write the texture name of attached element instead of vehiclegrunge256
-
Also hostinger.com will work.. I am using for my php scripts which uses mysql to getting data and there is no problem with connection.
-
Hello, When the user logins on web server (I mean MTA's http web server), the user's name will be displayed ingame with dxDrawText. I wrote the draw stuff but, how can i get account name when the user logins? Did anyone try to add TriggerEvent when the logins on web? Is this even possible? Thanks in advance.
-
Use this code. progressBarMax = 479 -- = 100% width = (secs / 100) * progressBarMax dxDrawRectangle(17, 175, width, 4, tocolor(255, 255, 255, 255), false)
-
He is using NG scripts which shared by xXMADEXx(owner)
-
Create a table for storage sound elements. Also you must add an event which sets sound element to nil. (onClientPlayerQuit) English isn’t my first language, so please excuse any mistakes. function onClientPlayerQuit_Handler() if isElement(local_sound[source]) then local_sound[source] = nil end end addEventHandler("onClientPlayerQuit", root, onClientPlayerQuit_Handler) local local_sound = {} function engine_func() local veh = getPedOccupiedVehicle (localPlayer) local RPM = getVehicleRPM(veh) setElementData(veh,"RPM",RPM) --edit #1 if veh then if getVehicleEngineState (veh) == true then setSoundVolume(local_sound[localPlayer],1) setSoundSpeed(local_sound[localPlayer], RPM * 2.5 / 10000) else if getSoundVolume(local_sound[localPlayer]) == 1 then setSoundVolume(local_sound[localPlayer],0) end end else destroyElement(local_sound[localPlayer]) removeEventHandler("onClientRender",root,engine_func) end end addEventHandler ( "onClientVehicleEnter", getRootElement(), function( thePlayer ) if getElementModel ( source ) == 411 then setWorldSoundEnabled(40,false) local x,y,z = getElementPosition(source) if vehicles[source] then vehicles[source] = nil end --edit #2 local_sound[thePlayer] = playSound3D(engine_sound, x, y, z, true) setSoundVolume(local_sound[thePlayer],0) attachElements(local_sound[thePlayer],source) addEventHandler ( "onClientRender", getRootElement(), engine_func ) end end) addEventHandler ( "onClientVehicleExit", getRootElement(), function( thePlayer ) if getElementModel(source) == 411 then setWorldSoundEnabled(40,true) --edit #3 --destroyElement(local_sound[thePlayer]) --or local_sound[thePlayer] = nil removeEventHandler ( "onClientRender", getRootElement(), engine_func ) end end)
-
37?
-
Well, you must use SQL or XML to save the number count. Sql is better than xml but its your choice. I think XML won't create any lag because data is too short.