-
Posts
605 -
Joined
-
Last visited
-
Days Won
1
Everything posted by JeViCo
-
I'm so sorry. I used wrong event. I restarted resource and it works brilliant. Thanks!
-
well\ it didn't helped me ["stick"] is spare right here. r1[1] - table t1[1][1] - nil WTF r[1] must be {{value1,value2},{value3,value4} } if i remove toJSON and fromJSON i will get an empty cell in my database
-
Hello everyone! I have a little problem with fromJSON. Saving with toJSON works fine but loading with fromJSON causes warnings and i can't get value from database (i keep getting nil) saving(everything ok here) local result = dbPoll(dbQuery(db, "SELECT * FROM sticks WHERE ID = ? AND model = ?", id, getElementModel(veh)), -1) if type(result) == "table" then if #result ~= 0 then dbExec(db, "UPDATE sticks SET stick = ?, model = ? WHERE ID = ?", toJSON(sti), getElementModel(veh), id) else print(1111) --print(sti[1][1]) --if not sti then sti = {} end dbExec(db, "INSERT INTO sticks VALUES(?, ?, ?)", id, toJSON(sti), getElementModel(veh)) end end loading (a problem right here): local r1 = dbPoll(dbQuery(db, "SELECT * FROM sticks WHERE ID = ? AND model = ?", id, getElementModel(source)), -1) if type(r1) == "table" and #r1 ~= 0 then setElementData(source,"stick",fromJSON(r1)) --print(r1[1]) else setElementData(source,"stick",{}) end end appearence of value in database: what i get: Help!
-
Could you add some more functions for close button? I mean position of it, background images in 3 different states, like a simple button
-
uhhhh Here better example. script: dbExec(db, "UPDATE Vehicles SET Number = ? WHERE ID = ?", toJSON(newplate), vehid) database:
-
script code: sometable = {1, 2, 3} toJSON(sometable) -- OR toJSON({1, 2, 3}) in database (with toJSON) [[1, 2, 3]] it gives additional box brackets
-
March 22, 2014 lol That guy said about car disappearing. His script creates several cars. Restarting this script makes them disappear and he asked about saving those vehicles. On my opinion, it's impossible without additional resources
-
client: Multi Theft Auto v1.5.5-release-12411 server: Multi Theft Auto v1.5.5-release-12240
-
client: local ped_ = {} local peds = { {0, 2, 2}, {0, 4, 2}, {0, 6, 2}, } function findRotation( x1, y1, x2, y2 ) local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) return t < 0 and t + 360 or t end function spawnPed(i) ped_[i] = triggerServerEvent("createPed",localPlayer,math.random(26,41),peds[i][1],peds[i][2],peds[i][3],i) end addEventHandler("onClientResourceStart",resourceRoot,function() for i=1,#peds do spawnPed(i) end end) function atirar () if source then if getElementData(source,"ped:custom_ped") then ped = source givePedWeapon(ped, 31, 500, true) setPedControlState(ped, "fire", true) end end end addEvent ("pedAtira", true) addEventHandler("onClientPedDamage", root, atirar) --addEventHandler ("pedAtira", getRootElement(), atirar) function stopatirar () for _, ped in ipairs(getElementsByType("ped")) do if getElementData(ped,"ped:custom_ped") then if isElementStreamedIn (ped) then givePedWeapon(ped, 31, 500, false) setPedControlState(ped, "fire", false) end end end end addEvent ("stopPedatira", true) addEventHandler ("stopPedatira", getRootElement(), stopatirar) function handleRespawn() if getElementData(source,"ped:custom_ped") then index = getElementData(source,"ped:index") setTimer(destroyElement, 1000, 1, source) setTimer(spawnPed, 1500, 1, index) end end addEventHandler("onClientPedWasted", getRootElement(), handleRespawn) function rota () for _, ped in pairs(getElementsByType("ped")) do if getElementData(ped,"ped:custom_ped") then if isElementStreamedIn (ped) then local x1 ,y1, z1 = getElementPosition(ped) local x2, y2, z2 = getElementPosition(localPlayer) setPedAimTarget(ped, x2, y2, z2) setElementRotation(ped, 0,0,180+findRotation( x2, y2, x1, y1 )) end end end end addEventHandler("onClientRender", root, rota) server: addEvent("createPed",true) addEventHandler("createPed",getRootElement(),function(skin,x,y,z,i) ped = createPed(skin,x,y,z,0,true) setElementData(ped,"ped:custom_ped",true) setElementData(ped,"ped:index",i) end) you can this code test too. Just i don't know where to see my version, but i know that server and client have 1.5.5 version (after animations release)
-
Thanks! I fixed gridlist - i replaced: local gridlist = with gridlist = and it help me. So it was my fault
-
nope. It returns 0. You forgot about OR 0. Same condition at line 9, 12, 13
-
he used this setControlState("aim_weapon", true) Ped got aiming animation but it didn't affect on whole aiming
-
i think he created self-made gridlist but each element is drawing on top of previous one. dxDrawRectangle just a background
-
local CreatTop = executeSQLQuery( "SELECT * FROM SHLevel ORDER BY level DESC LIMIT 30" ) it has a nil value. I guess a table with name 'SHLevel' doesn't exists in registry.db. So - create it!
-
By the way. Adding column after gridlist creation does nothing. It works perfect when i create gridlist and wait a little amount of time
-
I found a strange bug. I created ped server-side. It starts to shoot me but i don't get any bullet damage. Well, that's okay. The main problem is here: i created ped again and minimised MTA. Ped killed me like GTA:SA single player ped. Sooo what is that? I get damage only if i close to ped or MTA client minimised
-
DGS = exports.dgs DGS:dgsCreateButton(0.88,0.93,0.1,0.05,"Leave", true, 0xFF000000) @thisdp, Help! Text color doesn't change :с Also... Could you add text colors for rows please ?
-
well.... i take it back
-
onClientGUIClick - to make everything happen when you clicked a button killPed - to kill the player getTeamFromName - you need this for function below setPlayerTeam - move player to the 'team' spawnPlayer - to spawn a player!
-
you need to hide just a HUD soo here (+ fixed a little bit): function hide() setPlayerHudComponentVisible ( "ammo", false ) setPlayerHudComponentVisible ( "armour", false ) setPlayerHudComponentVisible ( "breath", false ) setPlayerHudComponentVisible ( "clock", false ) setPlayerHudComponentVisible ( "health", false ) setPlayerHudComponentVisible ( "money", false ) setPlayerHudComponentVisible ( "weapon", false ) end addEventHandler ( "onClientResourceStart", resourceRoot, hide )
-
Nope. If you are using several setElementData functions with onClientRender event + triggerServerEventFunction function the server load of suck script would be like ~ 0.1% and lower i guess. Also most of scripts are using setElementData clientside soo you can do whatever you want with it and not be worried
-
I think it should work: pedwalk = { --[model id] = ped walking style, [0] = 121, } function style(_, skin,_,_,_,skin2) if eventName == "onResourceStart" then for _, player in ipairs(getElementsByType('player')) do setStyle(pl) end elseif eventName == "onElementModelChange" then if getElementType(pl) == "player" or getElementType(pl) == "ped" then setStyle(source,skin) end elseif eventName == "onPlayerSpawn" then setStyle(source,skin2) end end addEventHandler('onResourceStart', root, style) addEventHandler('onElementModelChange', root, style) addEventHandler('onPlayerSpawn', root, style) function setStyle(pl,b) if getElementType(pl) == "player" then -- only for players if not b then b = getElementModel(pl) end -- check if no skin here if pedwalk[b] setPedWalkingStyle(pl, pedwalk[b]) end end end
-
Lol\ Are u registered those 3-4 accounts for good reviews? What are you trying to achieve?