• TTT Force model change
    14 replies, posted
My TTT keeps forcing players to change from the pointshop model to the default model and I dont want that. I have already tried commenting out line 271 and that broke the gamemode and didnt work so if anyone has anything else that works let me know please it would be much appreciated. I am getting no errors or anything in console so there is none of that.
I'm not familiar with TTT coding anymore but PlayerSetModel is the hook you want to look at. I would not advise removing/commenting out parts of TTT since they will just get overridden when updates are released.
Create a timer in the Pointshop item file that changes the model 2 second after the round starts. This will surely override any other model changes.
[QUOTE=code_gs;45400744]Create a timer in the Pointshop item file that changes the model 2 second after the round starts. This will surely override any other model changes.[/QUOTE] How would I do that?
[code] timer.Simple(2, function() /* some stuff to catching the player*/ ply:SetModel(/*player model from point shop*/); end); [/code]
Also how would I make it so you cant have a model from the donator tab and the player model tab equipped at the same time in the pointshop? [editline]15th July 2014[/editline] [QUOTE=G4MB!T;45400851][code] timer.Simple(2, function() /* some stuff to catching the player*/ ply:SetModel(/*player model from point shop*/); end); [/code][/QUOTE] Didnt work I got errors [code][ERROR] addons/pointshop-master/lua/items/donatoronly/sly.lua:13: attempt to index global 'ply' (a nil value) 1. unknown - addons/pointshop-master/lua/items/donatoronly/sly.lua:13 Timer Failed! [Simple][@addons/pointshop-master/lua/items/donatoronly/sly.lua (line 13)][/code]
You need a list of the models and their associative ranks, then before you set their model, check if the model is in the list and if they have the appropriate rank.
[QUOTE=G4MB!T;45400925]You need a list of the models and their associative ranks, then before you set their model, check if the model is in the list and if they have the appropriate rank.[/QUOTE] I've already got the donator part down its just that they are able to use a model in the donator tab and one from the player model tab.
Like I said, check before you set the model.
-snip-
[QUOTE=G4MB!T;45400948]Like I said, check before you set the model.[/QUOTE] Not sure how to do that.
Here is some pseudo code: [code] local mdls = { {"models/player.mdl", 2} // This could be "IsVIP" or a number rank depending on how you want to do the check }; function changeModel(ply, mdl) // this could be a hook like spawning or something timer.Simple(2, function() local canChange = true; for k,v in pairs(mdls) do if (v[1]:lower() == mdl:lower() && !ply:GetRank() > v[2]/*check ranking*/) then canChange = false; break; end end if (!canChange) then // we cant change, so dont change return; end ply:SetModel(mdl); end); end [/code] [editline]15th July 2014[/editline] [code] // code by Gambit [/code]
[QUOTE=G4MB!T;45401001]Here is some pseudo code: [code] local mdls = { {"models/player.mdl", 2} // This could be "IsVIP" or a number rank depending on how you want to do the check }; function changeModel(ply, mdl) // this could be a hook like spawning or something timer.Simple(2, function() local canChange = true; for k,v in pairs(mdls) do if (v[1]:lower() == mdl:lower() && !ply:GetRank() > v[2]/*check ranking*/) then canChange = false; break; end end if (!canChange) then // we cant change, so dont change return; end ply:SetModel(mdl); end); end [/code] [editline]15th July 2014[/editline] [code] // code by Gambit [/code][/QUOTE] That confused me haha. Does that make it so if you have a model equipped from the donator tab you cant equip one from the normal tab?
Try this; this should support it changing with the round. [code]-- Run serverside hook.Add( "TTTBeginRound", "ModelFix", function() for _, ply in pairs( player.GetAll() ) do if ply:PS_HasItem( "ITEM:Name here" ) then timer.Simple( 2, function() ply:SetModel( "model path here" ) end ) end end end )[/code] [editline]July 15, 2014[/editline] [QUOTE=G4MB!T;45401001]Code[/QUOTE] You don't have to check for rank, Pointshop has a built item checking function (PS_HasItem).
[QUOTE=code_gs;45401044]Try this; this should support it changing with the round. [code]-- Run serverside hook.Add( "TTTBeginRound", "ModelFix", function() for _, ply in pairs( player.GetAll() ) do if ply:PS_HasItem( "ITEM:Name here" ) then timer.Simple( 2, function() ply:SetModel( "model path here" ) end ) end end end )[/code] [editline]July 15, 2014[/editline] You don't have to check for rank, Pointshop has a built item checking function (PS_HasItem).[/QUOTE] Oh sorry. I'm unfamiliar with PS.
Sorry, you need to Log In to post a reply to this thread.