• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua mysql statement

Stellow

C++/C#/PHP/LUA
Joined
Oct 23, 2008
Messages
1,106
Reaction score
214
Location
Germany
GitHub
eubrunomiguel
update player_skills set value = 15 where skillid = 1 and (select players.id from players where players.name = 'gm old' limit 1)


know how to make it work? I had my players_skills erased, now I will have to give everyone it manually.
I tried to make a talkaction
function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
return true
end
local t = string.explode(param, ",")
print(t[1])
print(t[2])
print(t[3])
db.executeQuery("UPDATE `player_skills` SET `value` = " .. (tonumber(t[3])) .. " WHERE `player_id` = " .. (tonumber(t[2])) .. " and `skillid` = " .. (tonumber(t[2])) .. ";")
return true
end

but it did not work either
 
What exactly do you want to do? Give a skill to a player according to name? Aren't there talkactions for that?

You can try this
Code:
db.executeQuery("UPDATE `player_skills` SET `value` = " .. (tonumber(t[3])) .. " WHERE `name` = " .. t[1] .. " and `skillid` = " .. (tonumber(t[2])) .. ";")

And you'd write !command playerName, skillId, value ... although they'd have to be online

Did you want to do some automatic, more advanced query instead?

Ignazio
 
Last edited:
Might be problems entering spaces with talkactions, not sure. Why don't you just use "/addskill GM Name,shield,50"

Ignazio
 
Back
Top