Jump to content

[HELP] Give VIP Problem


justn

Recommended Posts

Hi I'm working on a script to give player VIP, but it doesn't work, i don't know why. here's debugscript errors.

ERROR: VIP\Server.lua:11: Bad argument @ 'setElementData' [Expected argument at argument 3 , got none]

ERROR: VIP\Server.lua:12 attempt to concatenate global 'source' (a userdata value)

Client ( Where you give the player vip ):

addEventHandler("onClientGUIClick",SureWindow, 
        function (b) 
        if b == "left" and source == SureGive then 
        local selected1 = guiGridListGetItemText(VIP_GiveMainGrid, guiGridListGetSelectedItem(VIP_GiveMainGrid), VIP_GiveVIPName) 
        local selected2 = guiGridListGetItemText(VIP_GiveMainGrid, guiGridListGetSelectedItem(VIP_GiveMainGrid), VIP_GiveVIPRank) 
        local ComboS = guiComboBoxGetItemText(SureCombo,guiComboBoxGetSelected(SureCombo)) 
        if ( selected1 ) then 
        if ComboS ~= "" then 
        local selected3 = getPlayerFromName(selected1) 
        if (selected3) then 
        exports["TopBarChat"]:sendClientMessage("#ff0000* #00ff00You have given VIP to "..selected1,255,255,255,true) 
        triggerServerEvent("giveSelected",localPlayer,selected1,selected2,selected3,ComboS) 
        end 
        end 
        end 
        end 
        end) 

Server:

addEventHandler("onPlayerJoin",getRootElement(), 
function() 
if ( getPlayerSerial(source) == "D5FF7C8E58745AE326AD72702D60ECA1" ) then 
setElementData(source, "VIP", "Premium" ) 
end 
end) 
  
addEvent("giveSelected",true) 
addEventHandler("giveSelected",getRootElement(), 
function(selected1,selected2,selected3,ComboS) 
setElementData(selected3,ComboS) 
exports["TopBarChat"]:sendClientMessage("#FF0000* #00ff00You have gotten VIP by "..source,selected3,255,255,255,true) 
end) 

Thanks.

Link to comment

What should this be : setElementData(selected3,ComboS) ?

You need to set a "key" where you can save the data to.

Like

setElementData(selected3,"test",ComboS)

--client 
addEventHandler("onClientGUIClick",SureWindow, 
        function (b) 
        if b == "left" and source == SureGive then 
        local selected1 = guiGridListGetItemText(VIP_GiveMainGrid, guiGridListGetSelectedItem(VIP_GiveMainGrid), VIP_GiveVIPName) 
        local selected2 = guiGridListGetItemText(VIP_GiveMainGrid, guiGridListGetSelectedItem(VIP_GiveMainGrid), VIP_GiveVIPRank) 
        local ComboS = guiComboBoxGetItemText(SureCombo,guiComboBoxGetSelected(SureCombo)) 
        if ( selected1 ) then 
        if ComboS ~= "" then 
        local selected3 = getPlayerFromName(selected1) 
        if (selected3) then 
        exports["TopBarChat"]:sendClientMessage("#ff0000* #00ff00You have given VIP to "..selected1,255,255,255,true) 
        triggerServerEvent("giveSelected",localPlayer,localPlayer,selected1,selected2,selected3,ComboS) 
        end 
        end 
        end 
        end 
        end) 
        --server 
        addEventHandler("onPlayerJoin",getRootElement(), 
function() 
if ( getPlayerSerial(source) == "D5FF7C8E58745AE326AD72702D60ECA1" ) then 
setElementData(source, "VIP", "Premium" ) 
end 
end) 
  
addEvent("giveSelected",true) 
addEventHandler("giveSelected",getRootElement(), 
function(lp,selected1,selected2,selected3,ComboS) 
setElementData(selected3,"test",ComboS) 
exports["TopBarChat"]:sendClientMessage("#FF0000* #00ff00You have gotten VIP by "..lp,selected3,255,255,255,true) 
end) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...