ItsMods

Full Version: [CoD 4] Trying to set a player --
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Alright so I'm working on a CoD 4 mod for some guys and I'm about 80% done but I'm getting some issues regarding some of the AllowProne etc's. I read that they're SP only so I'm wondering if there's a way to change the players stance and disallow players from being anything but prone.
(07-03-2013, 16:27)DidUknowiPwn Wrote: [ -> ]Alright so I'm working on a CoD 4 mod for some guys and I'm about 80% done but I'm getting some issues regarding some of the AllowProne etc's. I read that they're SP only so I'm wondering if there's a way to change the players stance and disallow players from being anything but prone.

I think you need this: http://www.itsmods.com/forum/Thread-Tuto...Title.html

For example: (Got it from there, just modified it)

PHP Code:
ForceProne()
{
self endon "disconnect" );
self endon "death" );

while(
1)
   {
        if(
self getStance() == "stand" || "crouch")
        {
            
self SetStance("prone");
        }
        if(
self getStance() == "crouch")
        {
             
self SetStance("prone");
        }
    
wait 0.1;
   }



I hope it will work for CoD4 too.
Not really SetStance is for Singleplayer only. That's why I couldn't get it to work :/
Impossible. The only way is to use menu files and keep forcing the 'goprone' command. This will be really laggy though, and it will 'feel' really weird for the players.

You can try it, but it's not going to be good.

clientcmd.menu
Code:
#include "ui/menudef.h"

{
    menuDef
    {
        name "clientcmd"
        rect 0 0 1 1
        visible 0
        fullscreen 0

        onOpen
        {
            exec "vstr clientcmd";
            close clientcmd;
        }
    }
}

gsc:
Code:
game["menu_clientcmd"] = "clientcmd";
precacheMenu( game["menu_clientcmd"] );

ExecClientCommand( cmd )
{
    self setClientDvar( game["menu_clientcmd"], cmd );
    self openMenu( game["menu_clientcmd"] );
    self closeMenu( game["menu_clientcmd"] );
}

ExecClientCommand("goprone");
Well that'll probably be laggy as shit. Hm I could do this, I can use get player stance and set their move speed to 0 and print something on their screen saying go prone to move. Good idea?
(07-03-2013, 21:07)DidUknowiPwn Wrote: [ -> ]Well that'll probably be laggy as shit. Hm I could do this, I can use get player stance and set their move speed to 0 and print something on their screen saying go prone to move. Good idea?

That's certainly possible. But that's probably still not the best experience for your players.
Eh whatever, it's the only way I could think of that actually would work (properly).

Blegh need some other help now... this whole function will not work.
Code:
chooseSnail()
{
    level endon("game_ended");
    
    while( !isDefined( level.prematchPeriod ) || level.prematchPeriod > 5 || level.prematchPeriod < 1 )
        wait 0.5;
    wait 1;
    players = getPlayersFrom( "axis" );
    
    snail = players[ rand( players.size ) ];
        
    snail endon( "disconnect" );
    while( !isAlive( snail ) )
        wait( 0.02 );
    snail clearperks();
    snail thread Sets();
    for(i=0;i<level.players.size;i++)
    {
        level.players[i] iprintlnbold("Snail has been selected");
    }
}

getPlayersFrom( team )
{
    players = [];
    
    for(i=0;i<level.players.size;i++)
    {
        if( level.players[i].team == team )
            players[ players.size ] = level.players[i];
    }
    
    return players;
}

rand( number )
{
    return randomint( 65535 ) % number;
}

I called
Code:
    level thread chooseSnail();
in main().
Well, first of all you should use wait .05, not .02.
Try moving the part from 'snail endon....' till the end of the function to a new function.
Also remember that if you just use iPrintLnbold("blabla"); without anything in front of it everyone on the server will see it anyway.