
RastaOrecha
Members-
Posts
21 -
Joined
-
Last visited
Everything posted by RastaOrecha
-
А вот так не получится? function guiClick() if source == ch_grdlist then outputChatBox("Вы кликнули по "..guiGridListGetSelectedItem(ch_grdlist)[1].." строчке") end end addEventHandler("onClientGUIClick",resourceRoot, guiClick)
-
Всем привет. Я создал гридлист с 2 строками(row) и одним столбцом (column). Затем хотел узнать какую из 2х строк игрок выбрал (в onClientGUIClick), нащёл функцию guiGridListGetSelectedItem, которая возвращает выбранный row и column, а мне нужно узнать только какую row игрок выбрал, как это сделать?
-
Скорее всего это из-за ошибок в коде, а именно: user_connect - getPlayerName(sourse) .." is connected") user_leave - getPlayerName(sourse) user_spawn - spawnPlayer ( sourse, Правильное написание - source
-
Yes, through the resources, but I can through admin
-
Yes, I'm sure. Maybe the problem ain't in this code? It appears from other resources ain't issued weapons, too. For example: giveWeapon(source, 24, 500, true) What can be the reason?
-
[ { "1": { "ammo": 0, "gun": 0 }, "2": { "ammo": 90, "gun": 24 }, "3": { "ammo": 0, "gun": 0 }, "4": { "ammo": 0, "gun": 0 }, "5": { "ammo": 90, "gun": 30 }, "0": { "ammo": 1, "gun": 0 } } ] Output: 0, 0 0, 1 24, 90 30, 90 0, 0
-
[ { "1": { "ammo": 0, "gun": 0 }, "2": { "ammo": 90, "gun": 24 }, "3": { "ammo": 0, "gun": 0 }, "4": { "ammo": 0, "gun": 0 }, "5": { "ammo": 90, "gun": 30 }, "0": { "ammo": 1, "gun": 0 } } ] Now there is no error, but the weapon isn't issued
-
I'm sorry, I didn't see the 2nd page SQL DB: Guns: [ { "ammo0": 1, "gun4": 32, "gun2": 22, "gun5": 30, "ammo3": 0, "gun3": 0, "gun0": 0, "gun1": 0, "ammo1": 0, "ammo5": 120, "ammo4": 64, "ammo2": 90 } ]
-
Yeah Save: local guns = { } for slot = 0, 5 do guns [ slot ] = { gun = getPedWeapon ( source, slot ), ammo = getPedTotalAmmo ( source, slot ) } end local save = dbExec ( hconnect, "UPDATE `users` SET `Guns`=? WHERE `Name`=?", toJSON ( guns ), getPlayerName ( source ) ) dbFree( save ) Load: local ld = dbQuery ( hconnect, "SELECT `Guns` FROM `users` WHERE `Name`=?", username ) local result = dbPoll ( ld, -1 ) local guns = fromJSON ( result [ 1 ].Guns ) if ( type ( guns ) == "table" ) then for _, weapon in pairs ( guns ) do if ( weapon.gun and weapon.ammo ) then giveWeapon ( source, weapon.gun, weapon.ammo ) end end end
-
attempt to index local 'weapon' (a number value) on: if ( weapon.gun and weapon.ammo ) then
-
This is a insert and how to extract?
-
Can you give an example, please?
-
Guns are not issued, I use this: local ld = dbQuery(hconnect, "SELECT `Guns` FROM `users` WHERE `Name`=?", username) local result = dbPoll(ld, -1 ) local gunz = fromJSON( result[1].Guns ) giveWeapon(source, gunz.gun0, gunz.ammo0)
-
How to use next? gunz.gun0 gunz.ammo0 ???
-
That's what I'm doing, I do not know how to assign a variable value from JSON cell
-
How to get arguments from the toJSON in fromJSON from the table the query sql? local guns = toJSON ( { gun0=getPedWeapon(source,0),ammo0=getPedTotalAmmo(source,0), gun1=getPedWeapon(source,1),ammo1=getPedTotalAmmo(source,1) } ) local save = dbQuery( hconnect, "UPDATE `users` SET `Guns`=? WHERE `Name`=?", guns, getPlayerName(source) ) dbFree( save ) Now, how to retrieve data and to give the player weapons?
-
Which is better? (trigger versus elementData)
RastaOrecha replied to RastaOrecha's topic in Scripting
Okay, thx. -
Good day. I would like to know what is best: 1) client: setElementData (localPlayer, "DriftMod.Login",guiGetText (GUIEditor.edit[1])) setElementData (localPlayer, "DriftMod.Passwd",guiGetText (GUIEditor.edit[2])) triggerServerEvent ( "onGetLogin", getLocalPlayer() ) server: addEvent( "onGetLogin", true ) addEventHandler( "onGetLogin", getRootElement(), DriftLogInCheck ) function DriftRegnCheck () regLogin = getElementData (source, "DriftMod.RLogin") regPasswd = getElementData (source, "DriftMod.RPasswd") end or: 2) client: triggerServerEvent("onGetLogin",localPlayer,guiGetText (GUIEditor.edit[1]),guiGetText (GUIEditor.edit[2])) server: addEvent("onGetLogin",true) function DriftLogInCheck(username,password) end addEventHandler("onGetLogin",root,DriftLogInCheck)
-
Здравствуйте. У меня возник вопрос по MySQL. Как мне обновить данные в БД, знаю что UPDATE, а примерный запрос кто-нибудь может привести?