Jump to content

onPlayerPickUpRacePickup individual players, how ???


Recommended Posts

The script works well, but i tried this with a help of few players, hunters variable keeps counting and adding for all the players, how can i make it individual ?

-- Script made by -ffs-AbodyRulez specially for ffs simulation servers -- 
  
local hunters = 0 
  
function HunterCounts(pickupID, pickupType, vehicleModel) 
        if pickupType == "vehiclechange" and vehicleModel == 425 then  
            hunters = hunters + 1 
            if hunters == 1 then 
                outputChatBox(getPlayerName(source).."#FFFFFFreached Hunter#FF0000 "..hunters.." #FFFFFFtime",_,255,255,255,true) 
            elseif hunters > 1 then 
                outputChatBox(getPlayerName(source).."#FFFFFFreached Hunter#FF0000 "..hunters.." #FFFFFFtimes",_,255,255,255,true) 
            end 
        end  
end 
addEventHandler("onPlayerPickUpRacePickup", root, HunterCounts) 
  
-- Script made by -ffs-AbodyRulez specially for ffs simulation servers -- 
  

Link to comment
  
local hunters = {} 
  
function HunterCounts(pickupID, pickupType, vehicleModel) 
        if pickupType == "vehiclechange" and vehicleModel == 425 then 
            hunters[getPlayerName(source)] = ( hunters[getPlayerName(source)] or 0 )+1 
            if hunters[getPlayerName(source)] == 1 then 
                outputChatBox(getPlayerName(source).."#FFFFFFreached Hunter#FF0000 ".hunters[getPlayerName(source)].." #FFFFFFtime",_,255,255,255,true) 
            elseif hunters > 1 then 
                outputChatBox(getPlayerName(source).."#FFFFFFreached Hunter#FF0000 "..hunters[getPlayerName(source)].." #FFFFFFtimes",_,255,255,255,true) 
            end 
        end  
end 
addEventHandler("onPlayerPickUpRacePickup", root, HunterCounts) 
  
-- Script made by -ffs-AbodyRulez specially for ffs simulation servers -- 
  
  

Link to comment

Thats still an bad idea for putting it on the nickname, like when he will change the name the datakey will be lost like IIYAMA said, you can better set it on the player element, since the player element will last forever when he's connected, and when he's disconnected he will be removed from the table.

And it's simpler than the getPlayerName function :P

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