Jump to content

What i did wrogn ?


Tekken

Recommended Posts

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

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
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 :D

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...