I get this error: Database query failed: no such column: Drakath
local sql = { Query = executeSQLQuery };
sql.Query( "INSERT INTO myTable ( name, ID, city ) VALUES ( "..getAccountName(getPlayerAccount(source))..", "..ID..", "..city.." )" );
How come it recognizes a value as a column?
I thought about this at first but is this really the only way? I can swear that I once saw a script that could trigger an event just for elements created by the same resource.
How can I use onClientPlayerPickupHit event handler only for pickups created by the same resource?
I tried:
addEventHandler("onClientPlayerPickupHit", resourceRoot, handlePickups)
but it doesn't trigger at all.
You are both wrong.
function asd (t)
local x, y, z = getElementPosition(t)
createPickup(x+2, y+2, z, 0, 20)
end
addCommandHandler("mk", asd)
Server side script with a working pickup. No event handlers necessary.
I got a small problem.
function asd ()
local x, y, z = getElementPosition(localPlayer)
createPickup(x+2, y+2, z, 0, 20)
end
asd()
When I hit this pickup, nothing happens. Why?
What if table[randomIndex][2] can be either nil or true?
local isTrue = not table[randomIndex][2] --if true it will convert to false
if not isTrue then --if not false = true?
Is that how it works?
Is there a way to check if a specific index value in a table exists?
For example I have two tables:
table = {{1,2},{1}}
Script selects a random table.
How can I check if table[randomTable][2] exists?
for i, team in ipairs(getElementsByType("team")) do
local players = getPlayersInTeam (team)
local teamName = getTeamName(team)
for playerKey, playerValue in ipairs ( players ) do
local playerName = getPlayerName(playerValue)
local status = isPedDead(playerValue)
--draw here
end
end
What you call an "example" is pretty much asking for a whole script. I doubt anyone will make it for free.
If you want basic Lua scripts, look around the wiki.