Sande Posted November 21, 2013 Posted November 21, 2013 Im trying to make a bindKey in serverside what opening the gui in clientside. But the key is not going to binded at it says bad argument. Serverside: function openGUI(thePlayer) if getAccountData (thePlayer, "viplevel", 1 ) == true then triggerClientEvent(thePlayer, "openVpanel1", thePlayer ) else outputChatBox("[VIP] You dont have permission to open vip-panel (1)", thePlayer, 255,0,0) end end function bind() bindKey( "F7", "down", openGUI ) end addEventHandler("onResourceStart", getRootElement(), bind ) Clientside function openPanel ( ) local state = guiGetVisible ( vipGUI [ "window" ] ) guiSetVisible ( vipGUI [ "window" ], not state ) showCursor ( not state ) end addEvent( "openVpanel1", true ) addEventHandler( "openVpanel1", getLocalPlayer(), openPanel )
Tete omar Posted November 21, 2013 Posted November 21, 2013 (edited) server-side function openGUI ( thePlayer ) if ( getAccountData ( thePlayer, "viplevel" ) == "1" ) then triggerClientEvent ( thePlayer, "openVpanel1", thePlayer ) else outputChatBox ( "[VIP] You dont have permission to open vip-panel (1)", thePlayer, 255, 0, 0 ) end end function bind ( ) bindKey ( source, "F7", "down", openGUI ) end addEventHandler ( "onPlayerJoin", root, bind ) Edited November 21, 2013 by Guest
Sande Posted November 21, 2013 Author Posted November 21, 2013 Can you help me with this: function givePermission (thePlayer, command, target ) local playeraccount = getPlayerAccount ( target ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local viplevel = 1 setAccountData(playeraccount, "viplevel", viplevel ) outputChatBox("[VIP-Management] VIP annettu pelaajalle "..getPlayerName(target).." onnistuneesti.", thePlayer, 0,255,0) else outputChatBox("[VIP-Management] Error.", thePlayer, 255,0,0) end end addCommandHandler("viplevel-1", givePermission ) I cant set someplayer account data idk why. it goes to else message.
Sande Posted November 21, 2013 Author Posted November 21, 2013 Now the problem is, it doens´t get if i have like level 1 vip its still says you dont have it.
Tete omar Posted November 21, 2013 Posted November 21, 2013 Try this: function givePermission ( thePlayer, command, target ) if ( target ) and ( getPlayerFromName ( target ) ) then target = getPlayerFromName ( target ) end local playeraccount = getPlayerAccount ( target ) if ( not isGuestAccount ( playeraccount ) ) then local viplevel = "1" setAccountData ( playeraccount, "viplevel", viplevel ) outputChatBox("[VIP-Management] VIP annettu pelaajalle " .. getPlayerName ( target ) .. " onnistuneesti.", thePlayer, 0, 255, 0) else outputChatBox ( "[VIP-Management] Error.", thePlayer, 255, 0, 0 ) end end addCommandHandler ( "viplevel-1", givePermission ) edit: Glad to hear that. (P.S. you can take the above code anytime you want)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now