-ffs-AbodyRulez Posted August 16, 2013 Posted August 16, 2013 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 --
bandi94 Posted August 16, 2013 Posted August 16, 2013 bk it's server sided = all player willhave the same "hunters" variable. To make this you sould use table or accountData
-ffs-AbodyRulez Posted August 16, 2013 Author Posted August 16, 2013 And how am i supposed to do that :3
bandi94 Posted August 16, 2013 Posted August 16, 2013 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 --
Moderators IIYAMA Posted August 16, 2013 Moderators Posted August 16, 2013 The user data should be the table key and not his nick. Nicks can be changed you know.
bandi94 Posted August 17, 2013 Posted August 17, 2013 it's just an exampel for the simplest way , it should be changed to account data to save them on exit.
denny199 Posted August 17, 2013 Posted August 17, 2013 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
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