• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] It isnt Working

Status
Not open for further replies.

ALILP

Emulation Addict
Code:
function Player:GetVIP(player)
local ViP = AuthDBQuery("SELECT `vip` FROM `account` WHERE `id`='"..player:GetAccountId().."'")
ViP = ViP:GetUInt32(0)
end
function salam(event, player, message, lang, Type)
if (message:lower() == "salam")then
if(player:GetVIP() == 7)then
player:SendBroadCastMessage("salam")
end
end
end
RegisterPlayerEvent(18, salam)
Click to see colorful version.
 

Tommy

Founder
"It isn't working" DOES NOT HELP AT ALL. Refer yourself to giving more information.

If you haven't read Eluna documentation on defining new methods I would suggest you do: https://github.com/ElunaLuaEngine/Eluna/blob/master/docs/IMPL_DETAILS.md

I do believe the "player" param is pointless because you would want to use "self". Refer to Eluna documentation above. Why do you initialize "ViP" as ElunaQuery and then re-initialize it again as a uint32? You aren't returning anything, so the function returns nothing; therefore, you cannot compare it to anything since it doesn't return anything. Also, clean your code up a bit. Why would "ViP" be an appropriate variable name? Calling a variable is case sensitive. e.g. You have ViP as your variable and you call the variable as VIP by mistake it would throw an error because "i" is lowercase.

The method you created is redundant because a method already exist that returns the player's security level: :GetGMRank(). I would suggest using the already existing AccountLevels for vip since there would be no need for a new column for the account table..

However, I'll update your existing code, but keep what I said in mind.

Code:
function Player:GetVIP()
    local query = AuthDBQuery("SELECT vip FROM account WHERE id='"..player:GetAccountId().."'")
    local result = 0
    if (query ~= nil) then
        result = query:GetUInt32(0)
    end

    return result;
end

local function salam(event, player, message, lang, Type)
    if (message:lower() == "salam")then
        if (player:GetVIP() == 7)then
            player:SendBroadCastMessage("salam")
        end
    end
end

RegisterPlayerEvent(18, salam)

I cannot test so bare with me on the code above..

P.S. Why don't you use slp's VIP system that's already released? http://emudevs.com/showthread.php/3212
 
Status
Not open for further replies.
Top