AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Error with my 2 plugins (https://forums.alliedmods.net/showthread.php?t=105892)

mugiwara 10-09-2009 14:11

Error with my 2 plugins
 
Well i just read a tutorial of how to create a plugin

i made the code and that thinks from the tutorial i learned but i thinks there are errors with the codes i made. Can someone see if there any error?

This is the Health Code

Code:

/* Plugin generated by AMXX-Studio */

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

#define PLUGIN "givehealth"
#define VERSION "1.0"
#define AUTHOR "mugiwara"


public plugin_init() {
        register_plugin(PLUGIN, VERSION, AUTHOR)
       
  register_clcmd("say /health", "medic")
 

set_user_health(id, 150)

client_print(id, print_chat,"You just purchased some medic packs, Dont Get Killd!")

}
   

new plugin_on
new price
 
public plugin_init()
 
{register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /heath", "medic")
 
 plugin_on = register_cvar("amx_givehealth_plugin", "1")
price = register_cvar("amx_givehealth_price", "4000")

}
 
public medic(id)
{
       
        new money = cs_get_user_money(id)
        if (get_pcvar_num(plugin_on) == 1)
 
}

 {
 
  set_user_health(id, 150)
 
  client_print(id, print_chat,"You just purchased some medic packs, Dont Get Killd!"")
 }
 
  else
 {
  client_print(id, print_chat,"Not enough money. Go work out, loser!")
 }
 
 {
  cs_set_user_money(id, money - get_pcvar_num(price))
 }

This is the Armor Code

Code:

/* Plugin generated by AMXX-Studio */

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

#define PLUGIN "givearmor"
#define VERSION "1.0"
#define AUTHOR "mugiwara"


public plugin_init() {
        register_plugin(PLUGIN, VERSION, AUTHOR)
       
  register_clcmd("say /armor", "armor")
 

set_user_health(id, 150)

client_print(id, print_chat,"You just purchased some armor, AntiShotGuy!!!")

}
   

new plugin_on
new price
 
public plugin_init()
 
{register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /armor", "armor")
 
 plugin_on = register_cvar("amx_givearmor_plugin", "1")
price = register_cvar("amx_givearmor_price", "4000")

}
 
public armor(id)
{
       
        new money = cs_get_user_money(id)
        if (get_pcvar_num(plugin_on) == 1)
 
}

 {
 
  set_user_armor(id, 100)
 
  client_print(id, print_chat,"You just purchased some armor, AntiShotGuy!!!"")
 }
 
  else
 {
  client_print(id, print_chat,"Not enough money. Go work out, loser!")
 }
 
 {
  cs_set_user_money(id, money - get_pcvar_num(price))
 }

if theres any error with it plzz reply

larito 10-09-2009 17:26

Re: Error with my 2 plugins
 
Try with this
Health Code:
PHP Code:

/* Plugin generated by AMXX-Studio */

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

#define PLUGIN "givehealth"
#define VERSION "1.0"
#define AUTHOR "mugiwara"

new plugin_on
new price

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /health""medic")
    
plugin_on register_cvar("amx_givehealth_plugin""1")
    
price register_cvar("amx_givehealth_price""4000")
}

public 
medic(id)
{
    new 
money cs_get_user_money(id)
    if (
get_pcvar_num(plugin_on) == 1)
    {
        
set_user_health(id150)
        
cs_set_user_money(idmoney get_pcvar_num(price))
        
client_print(idprint_chat,"You just purchased some medic packs, Dont Get Killd!")
    }
    else
    {
        
client_print(idprint_chat,"Not enough money. Go work out, loser!")
    }



Armor code:
PHP Code:

/* Plugin generated by AMXX-Studio */

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

#define PLUGIN "givearmor"
#define VERSION "1.0"
#define AUTHOR "mugiwara"

new plugin_on
new price

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /armor""armor")
 
    
plugin_on register_cvar("amx_givearmor_plugin""1")
    
price register_cvar("amx_givearmor_price""4000")
}
 
public 
armor(id)
{
    
    new 
money cs_get_user_money(id)
    if (
get_pcvar_num(plugin_on) == 1)
     {
         
set_user_armor(id100)
        
client_print(idprint_chat,"You just purchased some armor, AntiShotGuy!!!")
        
cs_set_user_money(idmoney get_pcvar_num(price))
    }
     else
    {
        
client_print(idprint_chat,"Not enough money. Go work out, loser!")
    }


Some errors:
1) You cant use two times the fuction "plugin_init".
2) You cant use id in plugin_init if you dont make a loop.
3) You have problems with keys, fix this :D


All times are GMT -4. The time now is 22:34.

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