Raised This Month: $ Target: $400
 0% 

Error with my 2 plugins


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mugiwara
Junior Member
Join Date: Sep 2009
Old 10-09-2009 , 14:11   Error with my 2 plugins
Reply With Quote #1

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
mugiwara is offline
larito
Veteran Member
Join Date: Nov 2008
Location: Argentina- Mendoza
Old 10-09-2009 , 17:26   Re: Error with my 2 plugins
Reply With Quote #2

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

Last edited by larito; 10-09-2009 at 17:29.
larito is offline
Send a message via MSN to larito
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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