AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   A error with compile (https://forums.alliedmods.net/showthread.php?t=89441)

TitANious 04-06-2009 11:12

A error with compile
 
Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Error: Argument type mismatch (argument 4) on line 17

1 Error.
Could not locate output file C:\Users\Jacob\Desktop\multijump.amx (compile failed).

PHP Code:

#include <amxmodx>
#include <fakemeta>
 
#define FLAG_ADMIN ADMIN_LEVEL_A
 
new g_iJumpCount[33], bool:g_bJumped[33];
new 
g_pMaxJumpsg_pAdminOnly;
 
public 
plugin_init()
{
        
register_plugin("hns_MultiJump""0.1""TitANious (port to FM by hleV)");
        
g_pMaxJumps register_cvar("mj_maxjumps""1"); // 1 normal jump + amount in CVAR
        
g_pAdminOnly register_cvar("mj_adminonly""0");
        
register_forward(FM_PlayerPreThink"fwPreThink");
        
register_forward(FM_PlayerPostThink"fwPostThink");
        
set_task(0.1"plugin_init()"00"ab"1) <--------------- This is line 17
}
 
public 
client_disconnect(iCl)
{
        
g_iJumpCount[iCl] = 0;
        
g_bJumped[iCl] = false;
}
 
public 
fwPreThink(iCl)
{
        if (!
is_user_alive(iCl) || (get_pcvar_num(g_pAdminOnly) && !(get_user_flags(iCl) & FLAG_ADMIN)))
                return;
 
        static 
iButtoniOldButtoniFlags;
        
iButton pev(iClpev_button);
        
iOldButton pev(iClpev_oldbuttons);
        
iFlags pev(iClpev_flags);
 
        if ((
iButton IN_JUMP) && !(iFlags FL_ONGROUND) && !(iOldButton IN_JUMP))
                if (
g_iJumpCount[iCl] < get_pcvar_num(g_pMaxJumps))
                {
                        
g_iJumpCount[iCl]++;
                        
g_bJumped[iCl] = true;
                        return;
                }
 
        if ((
iButton IN_JUMP) && (iFlags FL_ONGROUND))
                
g_iJumpCount[iCl] = 0;
}
 
public 
fwPostThink(iCl)
{
        if (!
is_user_alive(iCl) || (get_pcvar_num(g_pAdminOnly) && !(get_user_flags(iCl) & FLAG_ADMIN)))
                return;
 
        if (
g_bJumped[iCl])
        {
                static 
Float:fVel[3];
                
pev(iClpev_velocityfVel);
                
fVel[2] = random_float(265.0285.0); // IMO it should be lesser
                
set_pev(iClpev_velocityfVel);
                
g_bJumped[iCl] = false;
        }



YamiKaitou 04-06-2009 11:21

Re: A error with compile
 
First of all, it should be plugin_init, not plugin_init().
Second, why are you recalling plugin_init within plugin_init?
Third, read this: http://amxmodx.org/funcwiki.php?sear...task&go=search

Bugsy 04-06-2009 11:23

Re: A error with compile
 
Why are you trying to call plugin_init from plugin_init. Explain what you are trying to do, I'm sure there is a more proper way accomplish your task.

You should not have plugin_init() and you are telling the task to both loop and repeat 1 time. I'm assuming you just want it to occur once, so nothing is needed.

PHP Code:

set_task0.1"plugin_init" 


TitANious 04-06-2009 11:27

Re: A error with compile
 
I know, i want to do that you only can multijump once a round

Bugsy 04-06-2009 11:31

Re: A error with compile
 
Well then you already have that defined as the cvar default.

The below does that check for you.

PHP Code:

if (g_iJumpCount[iCl] < get_pcvar_num(g_pMaxJumps)) 

Do some searching to find out how to detect a new round and then use that to reset your g_iJumpCount[] variable.

TitANious 04-06-2009 11:33

Re: A error with compile
 
Where should it be in the script?

Hunter-Digital 04-06-2009 11:35

Re: A error with compile
 
nowhere... remove that task... it doesn't make any sense... that means you will register the plugin, the cvars and the forwards each 0.1 seconds... I don't know WHAT will happen but it won't be good :)

bottom line: remove that line, it's useless :}

Bugsy 04-06-2009 11:35

Re: A error with compile
 
Look at this thread:

http://forums.alliedmods.net/showthread.php?t=42159

You need to do g_iJumpCount[id] = 0 at new round or round start

TitANious 04-06-2009 11:59

Re: A error with compile
 
Well it should only be one time each round

TitANious 04-06-2009 12:28

Re: A error with compile
 
PHP Code:

        g_iJumpCountid ) = 0; <----- Line 21
        g_bJumped
id ) = false; <----- Line 22 

Code:

Error: Invalid function call, not a valid address on line 21
Error: Undefined symbol "id" on line 21
Warning: Expression has no effect on line 21
Error: Invalid function call, not a valid address on line 22
Error: Undefined symbol "id" on line 22
Warning: Expression has no effect on line 22
Error: Invalid function or declaration on line 46



All times are GMT -4. The time now is 02:23.

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