• Need help with points on win!
    11 replies, posted
So me and my friend is currently owning a deathrun server (Mr-Gash's Deathrun) and we need help. Does anyone here know how to make a script that lets you get pointshop2 points on win? Thanks for reading :)
[Code]hook.Add(“OnRoundSet“, “GiveMePSPoints“, function(r, winner) if r == ROUND_ENDING and IsValid(winner) then winner:PS2_AddStandardPoints(mypointsiwant) end end) [/code] Change mypointsiwant to the number of points you want. This is untested and written on my handy. So there could be some syntax errors (but I don't think so).
[QUOTE=markusmarkusz;51208720][Code]hook.Add(“OnRoundSet“, “GiveMePSPoints“, function(r, winner) if r == ROUND_ENDING and IsValid(winner) then winner:PS2_AddStandardPoints(mypointsiwant) end end) [/code] Change mypointsiwant to the number of points you want. This is untested and written on my handy. So there could be some syntax errors (but I don't think so).[/QUOTE] I have two questions where do i put it and does this give the points to the winning team?
[QUOTE=stonehatch;51208740]I have two questions where do i put it and does this give the points to the winning team?[/QUOTE] Yes it gives the points to the winning team.
[QUOTE=Jelman;51208743]Yes it gives the points to the winning team.[/QUOTE] But where do i put it? [editline]16th October 2016[/editline] I put it in the Lua/Autorun but it didnt work after i slayed the death [editline]16th October 2016[/editline] Now this is the error i get after killing somone in the console [CODE][ERROR] lua/includes/util.lua:181: attempt to index local 'object' (a number val ue) 1. IsValid - lua/includes/util.lua:181 2. fn - lua/autorun/win_reward.lua:2 3. Call - addons/ulib/lua/ulib/shared/hook.lua:110 4. SetRound - gamemodes/deathrun/gamemode/sv_round.lua:142 5. unknown - gamemodes/deathrun/gamemode/sv_round.lua:205 6. RoundThink - gamemodes/deathrun/gamemode/sv_round.lua:234 7. unknown - gamemodes/deathrun/gamemode/init.lua:611[/CODE]
[Code]hook.Add(“OnRoundSet“, “GiveMePSPoints“, function(r, winner) if r == ROUND_ENDING and winner != 123 then for k,v in pairs(player.GetAll()) do if v:Alive() and v:Team() == winner then v:PS2_AddStandardPoints(mypointsiwant) end end end end)[/code] This could work. It seems like that winner isn't a player. It seems like that winner is 123 or the winner team. :P
[QUOTE=markusmarkusz;51208864][Code]hook.Add(“OnRoundSet“, “GiveMePSPoints“, function(r, winner) if r == ROUND_ENDING and winner != 123 then for k,v in pairs(player.GetAll()) do if v:Alive() and v:Team() == winner then v:PS2_AddStandardPoints(mypointsiwant) end end end end)[/code] This could work. It seems like that winner isn't a player. It seems like that winner is 123 or the winner team. :P[/QUOTE] hey, im the second owner on the server stonehatch went to sleep now so he send me to this thread so i can take care of this. so i put the scrip in garrysmod/lua/autorun/win_reward.lua and it doesnt work i put in the amount of points to be award to 25 and nothing happen. no errors at all i restarted the server after i changed everything this might help u gm:NotifyAll( winner == 123 and "Time is up!" or team.GetName(winner).."s have won!" ) thats from the gamemode file for the broadcast of the winning team.
still need help!
You get only points if you are alive and in the winner team. I tested this and everything works fine.
[QUOTE=markusmarkusz;51211574]You get only points if you are alive and in the winner team. I tested this and everything works fine.[/QUOTE] nope, doesnt work if u want to i can add you on skype and sharescreen or you can join the server to see for you self
Teated it and itbworked, you placed it incorrectly
what directory do i need to put it in? garrysmod\lua\autorun ^thats where it is rn^
Sorry, you need to Log In to post a reply to this thread.