xPr3d4t0Rs 1 Report post Posted December 5, 2015 Guys I need help to create a script to become invisible when pressing use button (button "f") and after 10 seconds to show. I know the commands self hide() and self show but when threading the function, they don't work. Share this post Link to post Share on other sites
NinjaWa 30 Report post Posted December 5, 2015 Do you mean pressing "F" button or use function? Share this post Link to post Share on other sites
xPr3d4t0Rs 1 Report post Posted December 5, 2015 I mean pressing "F". Can you show me a function that sets invisible the player when he will press the button "F"? Share this post Link to post Share on other sites
NinjaWa 30 Report post Posted December 5, 2015 You would need to create a case that makes a player invisible hmmm let me try init( modVersion ) { thread invisible(); } onPlayerConnected() { for(; { level waittill("connected",player); player thread invisible(); } } invisible() { self endon( "disconnect" ); self endon( "death" ); for(; { while( isAlive(self) ) { if( self ButtonPressed( "BUTTON_F" ) ) { setDvar( "sv_cheats", "1" ); self hide(); setDvar( "sv_cheats", "0" ); } else if( !self ButtonPressed( "BUTTON_F" ) ) { setDvar( "sv_cheats", "1" ); self show(); setDvar( "sv_cheats", "0" ); } } } } Should work if you make it like a plugin. NOT SURE :c EDIT6 .-.: Forgot to add the nubby alive .-. GL with the script Share this post Link to post Share on other sites
xPr3d4t0Rs 1 Report post Posted December 6, 2015 Thanks xXNinjAXxWii, I will try it tomorrow! Share this post Link to post Share on other sites
IJzzo 1,072 Report post Posted December 6, 2015 You would need to create a case that makes a player invisible hmmm let me try init( modVersion ) { thread invisible(); } onPlayerConnected() { for(; { level waittill("connected",player); player thread invisible(); } } invisible() { self endon( "disconnect" ); self endon( "death" ); for(; { while( isAlive(self) ) { if( self ButtonPressed( "BUTTON_F" ) ) { setDvar( "sv_cheats", "1" ); self hide(); setDvar( "sv_cheats", "0" ); } else if( !self ButtonPressed( "BUTTON_F" ) ) { setDvar( "sv_cheats", "1" ); self show(); setDvar( "sv_cheats", "0" ); } } } } Should work if you make it like a plugin. NOT SURE :c EDIT6 .-.: Forgot to add the nubby alive .-. GL with the script Potential infinite loop detected: Killing thread That will show up I'm sure. Share this post Link to post Share on other sites
xPr3d4t0Rs 1 Report post Posted December 6, 2015 Can you show me a fixed version? Share this post Link to post Share on other sites
Lossy 1 Report post Posted December 6, 2015 pretty sure buttonpressed is not a cod4 function either and why are you enabling cheats on a client? security flaw there. Also why is there a "mod version" arguement? Share this post Link to post Share on other sites
xPr3d4t0Rs 1 Report post Posted December 6, 2015 I tried ButtonPressed("BUTTON_F") but it didn't work. Share this post Link to post Share on other sites
NinjaWa 30 Report post Posted December 6, 2015 You would need to create a case that makes a player invisible hmmm let me try init( modVersion ) { thread invisible(); } onPlayerConnected() { for(; { level waittill("connected",player); player thread invisible(); } } invisible() { self endon( "disconnect" ); self endon( "death" ); for(; { while( isAlive(self) ) { if( self ButtonPressed( "BUTTON_F" ) ) { setDvar( "sv_cheats", "1" ); self hide(); setDvar( "sv_cheats", "0" ); } else if( !self ButtonPressed( "BUTTON_F" ) ) { setDvar( "sv_cheats", "1" ); self show(); setDvar( "sv_cheats", "0" ); } } } } Should work if you make it like a plugin. NOT SURE :c EDIT6 .-.: Forgot to add the nubby alive .-. GL with the script Potential infinite loop detected: Killing thread That will show up I'm sure. I don't think so pretty sure buttonpressed is not a cod4 function either and why are you enabling cheats on a client? security flaw there. Also why is there a "mod version" arguement? Why not? Just use it as a plugin I tried ButtonPressed("BUTTON_F") but it didn't work. Not many people change their binds as I do, you could try changing that with "if ( self UseButtonPressed() )" and "if ( !self UseButtonPressed() )" Share this post Link to post Share on other sites
xPr3d4t0Rs 1 Report post Posted December 6, 2015 How can I use it as a plugin? I am new to scripting, can you show me? Share this post Link to post Share on other sites
Lossy 1 Report post Posted December 6, 2015 pretty sure buttonpressed is not a cod4 function either and why are you enabling cheats on a client? security flaw there. Also why is there a "mod version" arguement? Why not? Just use it as a plugin because deathrun is the only mod that handles plugins that way? Share this post Link to post Share on other sites
NinjaWa 30 Report post Posted December 7, 2015 How can I use it as a plugin? I am new to scripting, can you show me? One minute, are you trying to put it on deathrun mod or its your own mod? pretty sure buttonpressed is not a cod4 function either and why are you enabling cheats on a client? security flaw there. Also why is there a "mod version" arguement? Why not? Just use it as a plugin because deathrun is the only mod that handles plugins that way? Then, what's the problem...? Share this post Link to post Share on other sites
xPr3d4t0Rs 1 Report post Posted December 7, 2015 In my own mod. Share this post Link to post Share on other sites
NinjaWa 30 Report post Posted December 7, 2015 Well, then you need to thread invisible on the init and there you go It's interesting to see a guy that's creating his own mod, what is it about? Share this post Link to post Share on other sites
xPr3d4t0Rs 1 Report post Posted December 8, 2015 I call it Michael Myers mod. There is one player in one team and the rest of the players in the opposite team. The aim of the one player (he is called "Michael Myers") is to kill the rest of the players and he can use only knife. The aim of the rest of the players (they are called "victims") try to survive until time runs out. If "Michael Myers" kills them all before time ran out then he wins else "victims" win. "Michael Myers" has also invisible mode and can activate it for a specific time (and also has a cooldown). I finished it yesterday and I think its quite ok but sometimes it throws me the error "AimTarget_GetTagPos: Cannot find tag [j_helmet] on entity" because of the invisible mode (I detachall the models and then i attach body and head of the player and I think the problem is I don't link them. If you have any suggestion let me know). 1 Kenai reacted to this Share this post Link to post Share on other sites
IJzzo 1,072 Report post Posted December 8, 2015 Sounds interesting. Quite like an obscurity mod clone. Do the others have guns? Share this post Link to post Share on other sites
xPr3d4t0Rs 1 Report post Posted December 8, 2015 Nothing. I have disabled the guns of the "victims". "Michael Myers" has only knife and nothing else but he has invisible mode and he can see the enemies (from the compass/minimap). Share this post Link to post Share on other sites
Rewbin 203 Report post Posted December 8, 2015 I remember the way I used to play it was, when there was one person left on the other team, he could knife mike back Share this post Link to post Share on other sites
xPr3d4t0Rs 1 Report post Posted December 9, 2015 That's unfair! Share this post Link to post Share on other sites
NinjaWa 30 Report post Posted December 9, 2015 I call it Michael Myers mod. There is one player in one team and the rest of the players in the opposite team. The aim of the one player (he is called "Michael Myers") is to kill the rest of the players and he can use only knife. The aim of the rest of the players (they are called "victims") try to survive until time runs out. If "Michael Myers" kills them all before time ran out then he wins else "victims" win. "Michael Myers" has also invisible mode and can activate it for a specific time (and also has a cooldown). I finished it yesterday and I think its quite ok but sometimes it throws me the error "AimTarget_GetTagPos: Cannot find tag [j_helmet] on entity" because of the invisible mode (I detachall the models and then i attach body and head of the player and I think the problem is I don't link them. If you have any suggestion let me know). WOAH! Let me know when you finish it, I want to try it Make sure you add "wait" commands inside your scripts, if not, you will have a high risk of bugs And that thingy on the tag... try to change the model of the character to a custom or a default one and see if you still have the error, in my case it was because I've deleted the default characters on Deathrun mod and then I had the character set when someone dies so it was really glitchy and the mod was stopping to work on the nextround because of that. If you want, you can contact me on Skype: thefuckingninja I remember the way I used to play it was, when there was one person left on the other team, he could knife mike back That's a nice idea, Michael won't always have the opportunnity to win but to fight Share this post Link to post Share on other sites
NinjaWa 30 Report post Posted December 9, 2015 Sounds interesting. Quite like an obscurity mod clone. Do the others have guns? Or Obscurity mod clone of "Michael Mayers" mod xD Share this post Link to post Share on other sites
IJzzo 1,072 Report post Posted December 9, 2015 Well Obscurity mod is there around before I started with cod4. So it is earlier than 2010. Share this post Link to post Share on other sites
NinjaWa 30 Report post Posted December 9, 2015 What is Obscurity mod about? xD I've heard alot about it but never tested or knew what it is about Share this post Link to post Share on other sites
Mc.Joker 929 Report post Posted December 9, 2015 goto: https://www.youtube.com/channel/UCPvsI9vq4WwgaDNr_IKeC6g There u'll find some clips about it. Share this post Link to post Share on other sites