Tekken Posted January 19, 2015 Share Posted January 19, 2015 This script should save VIP status onPlayerQuit but it didn't work. function kitvip ( thePlayer ) local accName = getAccountName ( getPlayerAccount (thePlayer) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then local VIPi = getElementData(thePlayer, "vip") or 0 if VIPi == 0 then setElementData(thePlayer, "Map", 1) outputChatBox("VIP: Iteme VIP selectate!", thePlayer, 0, 255, 0, false) outputServerLog("VipCmd: VIP-ul"..getPlayerName(thePlayer).."si-a setat itemele !") else outputChatBox("VIP: Poti folosi aceasta comanda o singura data pe viata !", thePlayer, 255, 0, 0, false) end end end addCommandHandler("vip",kitvip, false) function rmvvip() setElementData(source, "vip", 0) end addEventHandler("onPlayerWasted", getRootElement(), rmvvip) function rmvVIP(thePlayer) local playerAccount = getPlayerAccount(thePlayer) if (playerAccount) then local VIPb = getElementData(thePlayer, "vip") or 0 setAccountData( playerAccount, "vip", VIPs ) end end addEventHandler("onPlayerQuit", getRootElement(), rmvVIP) function amvVIP(thePlayer) local playerAccount = getPlayerAccount(thePlayer) if (playerAccount) then local VIPb = getAccountData(playerAccount, "vip") setElementData( thePlayer, "vip", VIPs ) end end addEventHandler("onPlayerLogin", getRootElement(), amvVIP) Link to comment
Moderators DNL291 Posted January 19, 2015 Moderators Share Posted January 19, 2015 Use source instead of thePlayer. function kitvip ( thePlayer ) local accName = getAccountName ( getPlayerAccount (thePlayer) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then local VIPi = getElementData(thePlayer, "vip") or 0 if VIPi == 0 then setElementData(thePlayer, "Map", 1) outputChatBox("VIP: Iteme VIP selectate!", thePlayer, 0, 255, 0, false) outputServerLog("VipCmd: VIP-ul"..getPlayerName(thePlayer).."si-a setat itemele !") else outputChatBox("VIP: Poti folosi aceasta comanda o singura data pe viata !", thePlayer, 255, 0, 0, false) end end end addCommandHandler("vip",kitvip, false) function rmvvip() setElementData(source, "vip", 0) end addEventHandler("onPlayerWasted", getRootElement(), rmvvip) function rmvVIP() local playerAccount = getPlayerAccount(source) if (playerAccount) and not isGuestAccount(playerAccount) then local VIPb = getElementData(source, "vip") or 0 setAccountData( playerAccount, "vip", tostring(VIPb) ) end end addEventHandler("onPlayerQuit", getRootElement(), rmvVIP) function amvVIP(_, acc) local VIPb = getAccountData(acc, "vip") setElementData( source, "vip", VIPb ) end addEventHandler("onPlayerLogin", getRootElement(), amvVIP) Link to comment
Tekken Posted January 19, 2015 Author Share Posted January 19, 2015 Use source instead of thePlayer. function kitvip ( thePlayer ) local accName = getAccountName ( getPlayerAccount (thePlayer) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then local VIPi = getElementData(thePlayer, "vip") or 0 if VIPi == 0 then setElementData(thePlayer, "Map", 1) outputChatBox("VIP: Iteme VIP selectate!", thePlayer, 0, 255, 0, false) outputServerLog("VipCmd: VIP-ul"..getPlayerName(thePlayer).."si-a setat itemele !") else outputChatBox("VIP: Poti folosi aceasta comanda o singura data pe viata !", thePlayer, 255, 0, 0, false) end end end addCommandHandler("vip",kitvip, false) function rmvvip() setElementData(source, "vip", 0) end addEventHandler("onPlayerWasted", getRootElement(), rmvvip) function rmvVIP() local playerAccount = getPlayerAccount(source) if (playerAccount) and not isGuestAccount(playerAccount) then local VIPb = getElementData(source, "vip") or 0 setAccountData( playerAccount, "vip", tostring(VIPb) ) end end addEventHandler("onPlayerQuit", getRootElement(), rmvVIP) function amvVIP(_, acc) local VIPb = getAccountData(acc, "vip") setElementData( source, "vip", VIPb ) end addEventHandler("onPlayerLogin", getRootElement(), amvVIP) Thanks Link to comment
Moderators DNL291 Posted January 19, 2015 Moderators Share Posted January 19, 2015 You're welcome. Link to comment
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