EvoGT Posted March 22, 2013 Share Posted March 22, 2013 Hey. exports.scoreboard:scoreboardAddColumn("Hunters") function checkForHunter(number,sort,model) thePlayer = source if sort == "vehiclechange" then if model == 425 then I need a script when player takes hunter , with "vehiclechange" . And then on scoreboard column "Hunters" +1 Link to comment
Moderators IIYAMA Posted March 22, 2013 Moderators Share Posted March 22, 2013 (edited) Well there is something called: https://wiki.multitheftauto.com/wiki/On ... odelChange server local hunters = 0 addEventHandler("onElementModelChange", root, function (old,newmodel) if newmodel == 425 then hunters = hunters +1 outputChatBox("There are: " .. hunters .. " active!") end end) NOTE: Source The source of this event is the element that changed its model Edited March 22, 2013 by Guest Link to comment
EvoGT Posted March 22, 2013 Author Share Posted March 22, 2013 But how to do that when take hunter it show on scoreboard Like : i am going with infernus and take hunter . From "Hunters 0" ~~~~> "Hunters 1" Link to comment
Moderators IIYAMA Posted March 22, 2013 Moderators Share Posted March 22, 2013 server call(getResourceFromName("scoreboard"), "addScoreboardColumn", "hunters") Well as far I know(not sure) the scoreboard requires an element, like a player, team, car... https://wiki.multitheftauto.com/wiki/Element you have to use ElementData: (client or server) setElementData ( element, "hunters", hunters ) Link to comment
EvoGT Posted March 23, 2013 Author Share Posted March 23, 2013 Client localPlayer = getLocalPlayer() function addColumns() exports.scoreboard:scoreboardAddColumn("Hunters") end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), addColumns) addEventHandler('onClientPlayerJoin', root, function() setElementData(source,"Hunters",0) end ) Server gRoot = getRootElement() LastWinners={"","","","",""} function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local playerhunters = getElementData(source,"Hunters") setAccountData ( playeraccount, "hunters", playerhunters ) end end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local playerhunters = getAccountData ( playeraccount, "hunters" ) setElementData(source,"Hunters",playerhunters or 0) end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin) function checkForHunter(number,sort,model) thePlayer = source if sort == "vehiclechange" then if model == 425 then if getElementData(thePlayer,"playerGotHunter") == false then setElementData(thePlayer,"playerGotHunter",true) outputChatBox ( getPlayerName(source).."Gots Hunter!", getRootElement(), 255, 255, 255, true ) setElementData(thePlayer,"Hunters",tonumber(getElementData(thePlayer,"Hunters"))+1) end end end end When i take hunter, it dont add to hunters 1 and dont even outputChatBox Link to comment
Moderators IIYAMA Posted March 23, 2013 Moderators Share Posted March 23, 2013 This isn't your script. 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