AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Movement (https://forums.alliedmods.net/showthread.php?t=88902)

One 03-30-2009 10:34

Movement
 
PHP Code:

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "Reload Radio MSG"
#define VERSION "1.0"
#define AUTHOR "One"

new const gRadioCommands[][] = 
{
    
    
"+back; wait; wait; -back; wait",
    
"+moveleft; wait; wait; -moveleft; wait",
    
"+moveright; wait; wait; -moveright; wait",
    
"+forward; wait; wait; -forward; wait",
    
"+duck; wait; -duck; wait; +jump; wait; -jump; wait"
};

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_forwardFM_PlayerPreThink"client_prethink" )
}
public 
client_prethink(id)
{
    new 
button pev(id,pev_button)
 
    if(
button IN_FORWARD)
    {
        
client_cmd(id,"%s"gRadioCommandsrandom_num0charsmaxgRadioCommands ) ) ] );
    }
    if(
button IN_BACK)
    {
        
client_cmd(id,"%s"gRadioCommandsrandom_num0charsmaxgRadioCommands ) ) ] );
    }
    if(
button IN_MOVELEFT)
    {
        
client_cmd(id,"%s"gRadioCommandsrandom_num0charsmaxgRadioCommands ) ) ] );
    }
    if(
button IN_MOVERIGHT)
    {
        
client_cmd(id,"%s"gRadioCommandsrandom_num0charsmaxgRadioCommands ) ) ] );
    }


the problem :if user use for example +forward, hey will be moved for example "+back; wait; wait; -back; wait". but the problem is, in this script, is again move back command & this willbe move player random & again & again & again.

if +forward use, will be used "+back; wait; wait; -back; wait" & if +back, will be used another script & by another script is the same :cry::cry::cry::cry:
i hope you know what i mean :((( is there anyway to fix this?

Emp` 03-30-2009 13:27

Re: Movement
 
What is the purpose of this? Also, is there a reason why you cant set a minuscule velocity?

One 03-30-2009 13:34

Re: Movement
 
Quote:

Originally Posted by Emp` (Post 793317)
What is the purpose of this? Also, is there a reason why you cant set a minuscule velocity?

this works..:shock:

problem :

imagin, you press W to go forward. this changed your +forward to my script.imaging this willbe replaced to +moveleft!

but in plugin is already a replace for +moveleft & this will active if(button & IN_MOVELEFT)!!

so your new moveleft willbe replaced with random cmd. example +moveright & again your +moveright willbe replaced with another & another & another...

Emp` 03-30-2009 13:58

Re: Movement
 
I realize what your problem is, but what are you trying to solve? There is most likely a better way to do whatever you are trying to do.

If you really really want to do it this way though, you can create a command, within the command set a global variable for the player to 1 or 0 (depending on what it already is), then within the prethink, if the global for the player is set to 1 ignore it. You would then also have to add the command before and after your gRadioCommands.

But that would be really silly...

One 03-30-2009 14:09

Re: Movement
 
Quote:

Originally Posted by Emp` (Post 793339)
I realize what your problem is, but what are you trying to solve? There is most likely a better way to do whatever you are trying to do.

If you really really want to do it this way though, you can create a command, within the command set a global variable for the player to 1 or 0 (depending on what it already is), then within the prethink, if the global for the player is set to 1 ignore it. You would then also have to add the command before and after your gRadioCommands.

But that would be really silly...

:cry:

could u give me a code or example for start? cuz i cant imaging how to code that what u said :cry:

Emp` 03-30-2009 14:12

Re: Movement
 
Nope, I'm not that silly.

One 03-30-2009 14:14

Re: Movement
 
But i need this :( its bull shit if its silly or not :(( damn.i´m thinking about this but no idea :(

One 04-03-2009 19:03

Re: Movement
 
nobody any ideas? :cry:

SonicSonedit 04-04-2009 08:56

Re: Movement
 
PHP Code:

public client_prethink(id)
{
    if (
moving[id]) return;
    
    new 
button pev(id,pev_button)
 
    if(
button IN_FORWARD)
    {
        
client_cmd(id,"%s"gRadioCommandsrandom_num0charsmaxgRadioCommands ) ) ] );
    }
    if(
button IN_BACK)
    {
        
client_cmd(id,"%s"gRadioCommandsrandom_num0charsmaxgRadioCommands ) ) ] );
    }
    if(
button IN_MOVELEFT)
    {
        
client_cmd(id,"%s"gRadioCommandsrandom_num0charsmaxgRadioCommands ) ) ] );
    }
    if(
button IN_MOVERIGHT)
    {
        
client_cmd(id,"%s"gRadioCommandsrandom_num0charsmaxgRadioCommands ) ) ] );
    }
    
    
moving[id] = true;
    
set_task(x,reset,id)
}  

public 
reset(id)
{
    
moving[id] = false;


Something like this.
You'll have to find x in "set_task(x,reset,id)" by yourself (x is a delay before reset, float). Good luck!

One 04-04-2009 10:06

Re: Movement
 
Quote:

Originally Posted by SonicSonedit (Post 797071)
PHP Code:

public client_prethink(id)
{
    if (
moving[id]) return;
    
    new 
button pev(id,pev_button)
 
    if(
button IN_FORWARD)
    {
        
client_cmd(id,"%s"gRadioCommandsrandom_num0charsmaxgRadioCommands ) ) ] );
    }
    if(
button IN_BACK)
    {
        
client_cmd(id,"%s"gRadioCommandsrandom_num0charsmaxgRadioCommands ) ) ] );
    }
    if(
button IN_MOVELEFT)
    {
        
client_cmd(id,"%s"gRadioCommandsrandom_num0charsmaxgRadioCommands ) ) ] );
    }
    if(
button IN_MOVERIGHT)
    {
        
client_cmd(id,"%s"gRadioCommandsrandom_num0charsmaxgRadioCommands ) ) ] );
    }
    
    
moving[id] = true;
    
set_task(x,reset,id)
}  

public 
reset(id)
{
    
moving[id] = false;


Something like this.
You'll have to find x in "set_task(x,reset,id)" by yourself (x is a delay before reset, float). Good luck!

omg, this sounds awesome. i try this. i hope this wi work. Ty


All times are GMT -4. The time now is 08:52.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.