It's Mods

Full Version: Toggle invisible admin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
I try to make a code for using a key to enable/disable the invisibility for a player with admin GUID check.
But it is not working and I can't make it work, tried it, but alltime failed.

Can somebody check my code?

(Used the PHP Code function to paste it there, because it is colorful.)

PHP Code:
// Invisibility

rejt()
{
    
self endon("disconnect");
    
self endon("death");
    
    
self notifyOnPlayerCommand"toggle""+mlook" );
    for(;;)
    {
        
self waittill"toggle" );
        
        if(
self.GUID == "0000000000000000" || self.GUID == "0000000000000000")
        {
            
            
self hide();
            
self iPrintlnBold("^4You are Invisible.");
        
            
self waittill"toggle" );

            
self show();
            
self iPrintlnBold("^4You are Visible.");            
                
        }
        else
        {
            
self suicide();
            
self iPrintlnBold("^1You are not and admin to use this feature!");
        }
    }

'It doesn't work' is not enough. Does anything happen? Are you calling the function? Have you tried with another trigger like +melee.
Maybe do something like this:

C Code
  1. rejt()
  2. {
  3. self endon("disconnect");
  4. self endon("death");
  5. self.invi = 0;
  6.  
  7. self notifyOnPlayerCommand( "toggle", "+mlook" );
  8. for(;<img src="http://www.itsmods.com/forum/images/smilies/wink.gif" style="vertical-align: middle;" border="0" alt="Wink" title="Wink" />
  9. {
  10. self waittill( "toggle" );
  11.  
  12. if(self.GUID == "0000000000000000" || self.GUID == "0000000000000000")
  13. {
  14. if(self.invi == 0)
  15. {
  16. self hide();
  17. self iPrintlnBold("^4You are Invisible.");
  18. }
  19. else if(self.invi == 1)
  20. {
  21. self show();
  22. self iPrintlnBold("^4You are Visible.");
  23. }
  24. }
  25. else
  26. {
  27. self suicide();
  28. self iPrintlnBold("^1You are not and admin to use this feature!");
  29. }
  30. }
  31. }


PS: correct the GUID numbers and forget the for(;Wink.

Thanks Barata...
I have binded "+mlook" to Home key, and game is starting, it isn't write any eror, just when I press the Home key, nothing happens.

I want to use the "+mlook", because it isn't used as default.

Thanks Barata, I will try the code, wait a bit.
You can't "create" new action keys.
(05-27-2012 15:56)Rendflex Wrote: [ -> ]You can't "create" new action keys.

+mlook is already in the game :fp:
(05-27-2012 15:56)Rendflex Wrote: [ -> ]You can't "create" new action keys.

I don't want to "create" new action key, just wanted to assign to a function.

I'm tried Barata's updated code without this as he wrote:
Code:
for(;<img src="images/smilies/wink.gif" style="vertical-align: middle;" border="0" alt="Wink" title="Wink" />
But it isn't working.

And I'm know "+mlook" is the mouse look command.
Do the iprintlnbolds show up?
(05-27-2012 16:06)Pozzuh Wrote: [ -> ]
(05-27-2012 15:56)Rendflex Wrote: [ -> ]You can't "create" new action keys.

+mlook is already in the game :fp:

Oh really?
(05-27-2012 16:13)Pozzuh Wrote: [ -> ]Do the iprintlnbolds show up?

No they are not show up.

(05-27-2012 16:15)Rendflex Wrote: [ -> ]
(05-27-2012 16:06)Pozzuh Wrote: [ -> ]
(05-27-2012 15:56)Rendflex Wrote: [ -> ]You can't "create" new action keys.

+mlook is already in the game :fp:

Oh really?

It is the Mouse look option (Options/Look/Toggle Mouse look)
Pages: 1 2 3
Reference URL's