AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Correct the code pls (https://forums.alliedmods.net/showthread.php?t=107432)

DoviuX 10-26-2009 14:10

Correct the code pls
 
When compile:

Code:

//AMXXPC compile.exe
// by the AMX Mod X Dev Team


//// Unstoppable.sma
// D:\Dovydo\Counter - strike Failai\Addonai\L4DPlague\L4DPlague\addons\amxmodx\
scripting\Unstoppable.sma(98) : warning 213: tag mismatch
// D:\Dovydo\Counter - strike Failai\Addonai\L4DPlague\L4DPlague\addons\amxmodx\
scripting\Unstoppable.sma(99) : warning 213: tag mismatch
// D:\Dovydo\Counter - strike Failai\Addonai\L4DPlague\L4DPlague\addons\amxmodx\
scripting\Unstoppable.sma(105) : error 035: argument type mismatch (argument 2)
// D:\Dovydo\Counter - strike Failai\Addonai\L4DPlague\L4DPlague\addons\amxmodx\
scripting\Unstoppable.sma(106) : error 035: argument type mismatch (argument 2)
// D:\Dovydo\Counter - strike Failai\Addonai\L4DPlague\L4DPlague\addons\amxmodx\
scripting\Unstoppable.sma(112) : warning 209: function "Unstoppable" should retu
rn a value
//
// 2 Errors.
// Could not locate output file D:\Dovydo\Counter - strike Failai\Addonai\L4DPla
gue\L4DPlague\addons\amxmodx\scripting\compiled\Unstoppable.amx (compile failed)
.
//
// Compilation Time: 0,22 sec
// ----------------------------------------

Press enter to exit ...

Full Code:
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <amxmisc> 
#include <fun>
#include <cstrike>

#define PLUGIN "Unstoppable"
#define VERSION "1.0"
#define AUTHOR "DoviuX"

/*================================================================================
 [Customization]
=================================================================================*/
new const gIsUnstoppable[][] = { 
    
"sound/Unstoppable1.wav",
    
"sound/Unstoppable2.wav",
    
"sound/Unstoppable3.wav"
}

new const 
gNoMoney[] = "sound/NoMoney.wav"

new const Model[] = { "model/player/Unstoppable/Unstoppable.mdl" }
/*================================================================================
 [New Variables]
=================================================================================*/
//Unstoppable stuff...
new price
new health
new speed
new gravity
new armor

/*================================================================================
 [Init and Precache]
=================================================================================*/

public plugin_init()
{
      
register_pluginPLUGINVERSIONAUTHOR );


      
register_clcmd("say /unstoppable""Unstoppable")
      
register_clcmd("say_team /unstoppable""Unstoppable")

    
price register_cvar("un_unstoppable""16000")

    
health register_cvar("un_health""1000");
    
speed register_cvar("un_speed""295");
    
gravity register_cvar("un_gravity""0.6");
    
armor register_cvar("un_armor""300");
}

public 
plugin_cfg()
{
    
// Get configs dir
    
new cfgdir[32]
    
get_configsdir(cfgdircharsmax(cfgdir))

    
// Execute config file (Unstoppable.cfg)
    
server_cmd("exec %s/Unstoppable.cfg"cfgdir)
}

/*================================================================================
 [Plugin Start]
=================================================================================*/

public plugin_precache()
{    
        for(new 
0sizeof gIsUnstoppablei++)
            
precache_genericgIsUnstoppable] )

    
precache_sound(gNoMoney)

        
precache_modelModel);
}

public 
Unstoppable(id)
{
    new 
Cost get_pcvar_num(price);
    new 
Money cs_get_user_money(id);
            
    if (
Money Cost)
    {
                
set_hudmessage225225225, -1.00.2926.012.0 );
                
show_hudmessage0"You don't have enough money!" );
        
client_cmd0"spk %s"gNoMoney);
        return 
PLUGIN_HANDLED;
    } 
    else 
    {
            new 
name[32];
            
get_user_name(id,name,31);
                
set_hudmessage225225225, -1.00.2926.012.0 );
                
show_hudmessage0"%s is now unstoppable!"name);
            
cs_set_user_modelid"Model")
            
set_user_healthidget_pcvar_numhealth ) )
            
set_user_maxspeedidget_pcvar_numspeed ) )
            
set_user_gravityidget_pcvar_numgravity ) )
            
set_user_armoridget_pcvar_numarmor ) )
        
client_cmdid"spk %s"gIsUnstoppable[random_num(0sizeof gIsUnstoppable 1)])
        
strip_user_weapons(id)
        
give_itemid"weapon_m4a1")
        
give_itemid"weapon_deagle")
        
cs_set_user_bpammoid"weapon_m4a1"200 )
        
cs_set_user_bpammoid"weapon_deagle"200 )

        
Money -= Cost;
    
        
cs_set_user_money(idMoney);    
    }



unnyquee 10-26-2009 14:23

Re: Correct the code pls
 
Post the lines where you get these errors!
I don't want to count the lines by myself.

lazarev 10-26-2009 14:26

Re: Correct the code pls
 
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>

#define PLUGIN "Unstoppable"
#define VERSION "1.0"
#define AUTHOR "DoviuX"

/*================================================================================
 [Customization]
=================================================================================*/
new const gIsUnstoppable[][] = { 
    
"sound/Unstoppable1.wav",
    
"sound/Unstoppable2.wav",
    
"sound/Unstoppable3.wav"
}

new const 
gNoMoney[] = "sound/NoMoney.wav"

/*================================================================================
 [New Variables]
=================================================================================*/
//Unstoppable stuff...
new price
new health
new armor

/*================================================================================
 [Init and Precache]
=================================================================================*/

public plugin_init()
{
    
register_pluginPLUGINVERSIONAUTHOR );
    
register_clcmd"say /unst""CmdUnstoppable" )
    
register_clcmd"say_team /unst""CmdUnstoppable" )

    
price register_cvar"un_unstoppable""16000" )
    
health register_cvar"un_health""1000" )
    
armor register_cvar"un_armor""300" )
}

public 
plugin_cfg()
{
    
// Get configs dir
    
new cfgdir32 ]
    
get_configsdircfgdircharsmaxcfgdir ) )

    
// Execute config file (Unstoppable.cfg)
    
server_cmd"exec %s/Unstoppable.cfg"cfgdir )
}

/*================================================================================
 [Plugin Start]
=================================================================================*/

public plugin_precache()
{    
        for( new 
0sizeof gIsUnstoppablei++ )
        
precache_genericgIsUnstoppable] )
        
precache_soundgNoMoney )
}

public 
CmdUnstoppable(id)
{
    new 
Cost get_pcvar_numprice )
    new 
Money cs_get_user_moneyid )
            
    if (
Money Cost)
    {
        
set_hudmessage225225225, -1.00.2926.012.0 );
        
show_hudmessage0"You don't have enough money!" )
        
client_cmd0"spk %s"gNoMoney)
        return 
PLUGIN_HANDLED;
    } 
    else 
    {
        new 
name32 ]
        new 
Float:speed get_user_maxspeedid ) + 75.0
        
get_user_nameid,name,31 )
        
set_hudmessage225225225, -1.00.2926.012.0 )
        
show_hudmessage0"%s is now unstoppable!"name )
        
cs_set_user_modelid"Unstoppable" )
        
set_user_healthidget_pcvar_numhealth ) )
        
set_user_maxspeedidspeed )
        
set_user_gravityid0.6 )
        
set_user_armoridget_pcvar_numarmor ) )
        
client_cmdid"spk %s"gIsUnstoppablerandom_num(0sizeof gIsUnstoppable ) ] )
        
strip_user_weaponsid )
        
give_itemid"weapon_knife" )
        
give_itemid"weapon_m4a1")
        
give_itemid"weapon_deagle")
        
cs_set_user_bpammoidCSW_M4A1200 )
        
cs_set_user_bpammoidCSW_DEAGLE200 )

        
Money -= Cost;
    
        
cs_set_user_money(idMoney);    
    }
    return 
PLUGIN_HANDLED



DoviuX 10-26-2009 14:26

Re: Correct the code pls
 
PHP Code:

            set_user_maxspeedidget_pcvar_numspeed ) ) 

PHP Code:

            set_user_gravityidget_pcvar_numgravity ) ) 

PHP Code:

        cs_set_user_bpammoid"weapon_m4a1"200 

PHP Code:

        cs_set_user_bpammoid"weapon_deagle"200 

PHP Code:

                 


DoviuX 10-26-2009 14:29

Re: Correct the code pls
 
lazarev

Vorks thx ^^

lazarev 10-26-2009 14:30

Re: Correct the code pls
 
updated code, test the plugin pls and report bugs :P


All times are GMT -4. The time now is 17:43.

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