А вот так не получится?
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, 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?
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
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)