No, that won't work, because of the following problems:
1: You are trying to get an account name from a string, not an account element.
2: Your SQL functions are all wrongly used.
addEventHandler ( "onResourceStart", resourceRoot,
function ( )
exports.scoreboard:addScoreboardColumn ( "VIP", 3 )
executeSQLCreateTable ( "VIP", "account TEXT" )
end
)
addCommandHandler ( "addVIP",
function ( player, cmd, account )
if ( getElementData ( player, "thePlayerStaffLevel" ) == 5 ) then
executeSQLInsert ( "VIP", "'".. account .."'" )
exports.DxChat:sayServerMessage ( player, "You have succefully added ".. account .." as VIP", 0, 255, 0 )
else
exports.DxChat:sayServerMessage ( player, "You don't have sufficient rights", 0, 255, 0 )
end
end
)
addCommandHandler ( "delVIP",
function ( player, cmd, account )
if ( getElementData ( player, "thePlayerStaffLevel" ) == 5 ) then
executeSQLDelete ( "VIP", "account = '".. account .."'" )
exports.DxChat:sayServerMessage ( player, "You have succefully deleted ".. account .." and he is no longer a VIP", 0, 255, 0 )
else
exports.DxChat:sayServerMessage ( player, "You don't have sufficient rights", 0, 255, 0 )
end
end
)
addEventHandler ( "onPlayerLogin", root,
function ( _, account )
local result = executeSQLSelect ( "VIP", "account", "account = '".. getAccountName ( account ) .."'" )
if ( type ( result ) == "table" and #result == 1 ) then
setElementData ( source, "VIP", "Yes" )
else
setElementData ( source, "VIP", "No" )
end
end
)