Welcome, Guest. Please login or register.
Did you miss your activation email?
September 20, 2024, 03:44:43 AM
Home Help Login Register
News: Trouble in Terrorist Town? Site here, forum here.

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Help With Coding!
Pages: [1] 2
Author Topic: Help With Coding!  (Read 7575 times)
Doodlejump
Poster

Posts: 13


« on: February 02, 2011, 07:24:43 PM »

Im trying to get the TTT to give a player 200 health if they are on my vip list (garrysmod/settings/users.txt)

The group is named vip and after some work i have come up with this code ... But im not use to fretta coding ...
Please may someone go over my code or even make a new one? this was in my init.lua


local VIP = {}
function VIP( pl )
    if pl:IsUserGroup("vip") then
  pl:SetHealth(200)
  pl:Give( "weapon_ttt_health_station" )
end
end

hook.Add("PlayerLoadout", "VIP", VIP)


Like I said I am not use to fretta At ALL and wish to have a VIP mod up :D ... I would be HUGELY impressed by it if anyone can help me :D

Thank you ,
    Jordan!


Please contact me if you dont want to register :D

moenanimations@gmail.com
Manmax75
Poster

Posts: 254


Programming Guy


« Reply #1 on: February 02, 2011, 07:40:49 PM »

The whole concept of this is bad, but anyway.


function IsVIP(ply)
    if ply:IsUserGroup("vip") then
         ply:SetHealth(200)
         ply:Give( "weapon_ttt_health_station" )
    end
end

hook.Add("PlayerLoadout", "VIP", IsVIP)



Now just use ULX or some admin mod and make a usergroup called "vip"
« Last Edit: February 02, 2011, 07:42:05 PM by Manmax75 »

Ride Forward and Thrust Your Pelvis In The Dark Void. The One Induced By Pleasure Yet Cast By The Bigger Picture.
Doodlejump
Poster

Posts: 13


« Reply #2 on: February 02, 2011, 08:14:30 PM »

The whole concept of this is bad, but anyway.


function IsVIP(ply)
    if ply:IsUserGroup("vip") then
          ply:SetHealth(200)
          ply:Give( "weapon_ttt_health_station" )
    end
end

hook.Add("PlayerLoadout", "VIP", IsVIP)



Now just use ULX or some admin mod and make a usergroup called "vip"


Thanks But it seems that it dosnt work!
I need it so that when a Player spawns ... it sees if there VIP and if they are then sets there hp to 200 and gives them the weapon!
Ive tried what youve said and it dosnt seem to work -.-

Thank you for trying,
if you want ... with the extra information ... would you be able to make your code better?
phoenixf129
Poster

Posts: 476


I Rise from the Ashes.


« Reply #3 on: February 02, 2011, 08:18:19 PM »

try hooking PlayerSpawn instead?

Software Upgrade Paradox - If you improve a piece of software enough times, you eventually ruin it.
Doodlejump
Poster

Posts: 13


« Reply #4 on: February 02, 2011, 08:20:32 PM »

try hooking PlayerSpawn instead?


Ive seen that function on the fretta wiki... But like ive explained .. I know nothing of Fretta and dont know how to code it ... Phoenix would you be able to help me out and edit the code to fit with playerspawn?
Raneman
Poster

Posts: 219

Shitposter


« Reply #5 on: February 02, 2011, 08:22:04 PM »

I'm not usually one to flame, but...
Doodlejump
Poster

Posts: 13


« Reply #6 on: February 02, 2011, 08:23:48 PM »

Raneman ... Ive been coding for 2 years and have created many gamemodes but ive NEVER used fretta... ive never thought of doing it ... but i see where your coming from
phoenixf129
Poster

Posts: 476


I Rise from the Ashes.


« Reply #7 on: February 02, 2011, 08:45:41 PM »


function IsVIP(ply)
    if ply:IsUserGroup("vip") then
          ply:SetHealth(200)
          ply:Give( "weapon_ttt_health_station" )
    end
end
hook.Add("PlayerSpawn", "VIP", IsVIP)


Perhaps?..

Software Upgrade Paradox - If you improve a piece of software enough times, you eventually ruin it.
Doodlejump
Poster

Posts: 13


« Reply #8 on: February 02, 2011, 08:46:16 PM »

I will try it thanks!
Doodlejump
Poster

Posts: 13


« Reply #9 on: February 02, 2011, 09:10:55 PM »


function IsVIP(ply)
    if ply:IsUserGroup("vip") then
          ply:SetHealth(200)
          ply:Give( "weapon_ttt_health_station" )
    end
end
hook.Add("PlayerSpawn", "VIP", IsVIP)


Perhaps?..


Unfortunately ... this doesn't work ... It spawns the player with 100hp still ... this is starting to be a pain -.- Any other ideas to get this working?
phoenixf129
Poster

Posts: 476


I Rise from the Ashes.


« Reply #10 on: February 02, 2011, 09:13:29 PM »

TTT resets players health on round start. SO, you want to:


function roundstartbenefits()
for k, v in ipairs(player.GetAll()) do
if not v:IsSpec() then
if v:IsUserGroup("VIP") then
                               v:Give( "weapon_ttt_health_station" )
v:SetHealth(200) -- Sets to 200 health
v:SetMaxHealth(200) -- Sets their max health to 200 too, useful for health machine
end
end
end
end
hook.Add("TTTBeginRound","newroundbenefits",roundstartbenefits)
hook.Add("PlayerSpawn","newroundbenefits",roundstartbenefits)

Software Upgrade Paradox - If you improve a piece of software enough times, you eventually ruin it.
Doodlejump
Poster

Posts: 13


« Reply #11 on: February 02, 2011, 09:14:36 PM »

Hmm will now try this ! will get back as soon as !

Thanks for helping!
Doodlejump
Poster

Posts: 13


« Reply #12 on: February 02, 2011, 09:20:09 PM »

TTT resets players health on round start. SO, you want to:


function roundstartbenefits()
for k, v in ipairs(player.GetAll()) do
if not v:IsSpec() then
if v:IsUserGroup("VIP") then
                                v:Give( "weapon_ttt_health_station" )
v:SetHealth(200) -- Sets to 200 health
v:SetMaxHealth(200) -- Sets their max health to 200 too, useful for health machine
end
end
end
end
hook.Add("TTTBeginRound","newroundbenefits",roundstartbenefits)
hook.Add("PlayerSpawn","newroundbenefits",roundstartbenefits)



Sorry too say but this isnt working either im gonna restart the server again and try once more!
phoenixf129
Poster

Posts: 476


I Rise from the Ashes.


« Reply #13 on: February 02, 2011, 09:22:40 PM »

Sorry too say but this isnt working either im gonna restart the server again and try once more!


put the file in: lua/autorun/server/filename.lua

rcon lua_openscript autorun/server/filename.lua

Maybe this should help... Because, that code i supplied to you, WORKS completely fine for me.

Software Upgrade Paradox - If you improve a piece of software enough times, you eventually ruin it.
phoenixf129
Poster

Posts: 476


I Rise from the Ashes.


« Reply #14 on: February 02, 2011, 09:26:48 PM »

Hold on, whats your ULX usergroup for VIP called? Is it VIP or vip ? Could be CASE sensitive, unless its giving them the health station, but not the health, in which, it means the code is ran, but the health is not.

IF theres no hp kit, and you are sure you are putting it in the right place, its going to be the usergroup check thats the issue.

Software Upgrade Paradox - If you improve a piece of software enough times, you eventually ruin it.
Doodlejump
Poster

Posts: 13


« Reply #15 on: February 02, 2011, 09:32:57 PM »

Uhm What ULX download are you using? If so can you give a link please? I might have a different version (or outdated)
phoenixf129
Poster

Posts: 476


I Rise from the Ashes.


« Reply #16 on: February 02, 2011, 09:34:34 PM »

I'm not using ULX, i use a custom admin mod... My own.

Software Upgrade Paradox - If you improve a piece of software enough times, you eventually ruin it.
Doodlejump
Poster

Posts: 13


« Reply #17 on: February 02, 2011, 09:37:03 PM »

So how are you getting it to work then ? running it through garrrysmod/settings/users?
phoenixf129
Poster

Posts: 476


I Rise from the Ashes.


« Reply #18 on: February 02, 2011, 09:41:21 PM »

no... my custom admin mod has groups of its own, IsUserGroup works with my admin mod...

Anyways, i have to go, so i can't help you till tomorrow. Cya!

Software Upgrade Paradox - If you improve a piece of software enough times, you eventually ruin it.
Doodlejump
Poster

Posts: 13


« Reply #19 on: February 02, 2011, 09:42:28 PM »

Okay same here thanks and leave your steam id?? would be easyer to contact!
Pages: [1] 2
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Help With Coding! « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.009 seconds with 18 queries.