Im coding for a Prop Hunt server and the server owner want it so that when a hunter kills a prop, they get 10 points and when a prop wins, they get 10 points. I’ve seen threads for this but for TTT and TTT doesn’t quite have the same shape as Prop Hunt. Please help.
I’d suggest taking apart some of the TTT code anyways and seeing what you can pull from it.
Deconstructing old code is how I learned to do shit, should work for you too if you have the patience.
Appearently ‘coding’ has new meaning now. It stands for putting files into proper folders.
What kind of coding are you doing if you can’t even write a single, 4 lines long function?
dude honestly its a simple question obviously you dont knwo the answer to it >.> so really bbro back off
I am rating this funny because a person with one post says it.
What I meant was - this guy is coding for some guy (taking cash or not) - but in fact he is waiting for a finished code instead of using own brain to make it.
“Pay or go away”
Find the OnPlayerDeath function in the lua files or make your own and hook it, check what team is dieing, if attacker is hunter and ply is prop add points, find the function that controls the end (Decides if props or hunters win) if props win for each player in team prop give 10 points
Some things to help you on your quest through narnia:
I’m not asking you to finish the code but, I’ve got something and could use a little guidance/help/pointers if anyone has any.
local amount = 10; hook.Add( "PlayerDeath", "KillPoints" ), function( victim, weapon, killer ) if( IsValid( killer ) and IsValid( victim ) ) then if( killer:IsPlayer() and victim:IsPlayer() ) then if ( killer:Team() == ROLE_HUNTER and victim:Team() == ROLE_PROP ) then killer:PS_GivePoints( 10 ); killer:PS_Notify("You've been given "10" points for killing that prop, Nice shot!"); elseif ( killer:Team() == ROLE_PROP and ROUND == --HELP HERE PLEASE-- then killer:PS_GivePoints( 10 ); killer:PS_Notify("You've been given "10" points for winning, Nice Spot!"); end; end; end; end )
Well considering the fact that he had messaged me and I had helped him out, I figured a little common sense would have gone a long way.
What the fuck are you even doing. Your notifications require …'s because of your quotes ending and starting again, and your hook.Add is wrong, because of you having the closing column after “KillPoints”, while it shouldnt even be there.
I don’t know prop hunt, I don’t know how to hook 2 hooks to a single function,
but fuck it, here you go
local amount = 10; local hasWon = false hook.Add( "PlayerDeath", "FeedMeMore", function( victim, weapon, killer ) if( IsValid( killer ) and IsValid( victim ) ) then if( killer:IsPlayer() and victim:IsPlayer() ) then if ( killer:Team() == ROLE_HUNTER and victim:Team() == ROLE_PROP ) then killer:PS_GivePoints( 10 ); killer:PS_Notify("You've been given '10' points for killing that prop, Nice shot!"); end; end; end; end ) hook.Add("RoundEnd", "InComesTheAeroplane", function() for k,v in pairs (team.GetPlayers(ROLE_PROP)) do if(v:Alive) then v:PS_GivePoints( 10 ); v:PS_Notify("You've been given '10' points for winning, Nice Spot!"); hasWon = true end end if(hasWon) then for k,v in pairs (team.GetPlayers(ROLE_PROP)) do if(not v:Alive) then v:PS_Notify("You fucking disgrace, your team won, but you died."); v:PS_GivePoints( 5 ); end end end end) -- Coded in the official MS Notepad <3 -- Re-coded partly in notepad++ makes a good combination, especially when a tab space does a 100 space leap -- 01001000 01101111 01110111 00100000 01110100 01101111 00100000 01101100 01110101 01100001 00100000 00110001 00110000 00110001 -- 01001001 00100111 01101101 00100000 01100001 01101110 00100000 01101001 01100100 01101001 01101111 01110100
It’s very important you leave that last part or else it won’t run, it’s the encrypted file code for prop hunt to work
Note: There is a chance that an unlucky mother fucker will be skipped. + Fixed this
Wait what the hell, i was to tired to actually read what I was doing, why the fuck are you giving points to the props when they kill a hunter, what the fuck, let me fix this shit again
EDIT Number 93428740:
Okay, i think I fixed whatever the fuck this was, I don’t know,
Honestly, only helping you so I can practice code, this is simple, really, if it wasn’t 1AM here,
I don’t know how you fucked up so badly, you don’t seem to be having a good reputation either so far,
Another thing, you don’t need all these checks, it’s nice, but if they are in the team ROLE_HUNTER, I can bet my life, that they are valid and are a player.
Also, Lua is like english, I mean, how did you not realize that you were trying to give a fucking prop points for killing someone
Seriously, there is now way you wrote that above code, because if you did, that means you sat there, and wrote
if killer:Team == ROLE_PROP then
COME ON! HOW CAN’T YOU REALIZE WHAT’S GOING ON
Last thing, Learn to make your code neat, seriously, omg, I swear, it’s almost as bad as the people who take a photo of their code through their phone, it’s annoying, (I know I can’t say much since my spaces are so big, but it’s my Notepad++ fault, it doesn’t look like that for me, but on this forum it has a shit (Notepad++'s fault))