Raised This Month: $ Target: $400
 0% 

New XP Mod tutorial


Post New Thread Reply   
 
Thread Tools Display Modes
extreem
Member
Join Date: Apr 2011
Location: Czech Republick
Old 06-14-2011 , 15:10   Re: New XP Mod tutorial
Reply With Quote #221

I can't to compile plugin.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#define MAXCLASSES 5
new const CLASSES[MAXCLASSES][] = {
    
"None",
    
"Dog",
    
"Cat",
    
"Horse",
    
"Cow"
}
new const 
LEVELS[6] = {
    
100
    
200
    
400
    
800,
    
1600,
    
3200
}
new 
PlayerXP[33],PlayerLevel[33],PlayerClass[33]
new 
XP_Kill,XP_Knife,XP_Hs,SaveXP,g_vault
public plugin_init()
{
    
register_plugin("XpMod""1.0""Fxfighter")
 
    
register_event("DeathMsg""eDeath""a"
 
    
SaveXP register_cvar("SaveXP","1")
    
XP_Kill=register_cvar("XP_per_kill""20")
    
XP_Hs=register_cvar("XP_hs_bonus","20")
    
XP_Knife=register_cvar("XP_knife_bonus","20")
    
g_vault nvault_open("animod")
 
    
register_clcmd("say /class""ChangeClass")
    
register_clcmd("say_team /class""ChangeClass")
    
register_clcmd("say /xp""ShowHud")
    
register_clcmd("say_team /xp""ShowHud")
}
public 
eDeath(  ) 
{
    new 
iVictim read_data)
    new 
headshot read_data)
    new 
clipammoweapon get_user_weapon(id,clip,ammo);
 
    
PlayerXP[attacker] += get_pcvar_num(XP_Kill)
 
    if(
headshot)
    
PlayerXP[attacker] += get_pcvar_num(XP_Hs)
 
    if(
weapon == CSW_KNIFE)
    
PlayerXP[attacker] += get_pcvar_num(XP_Knife)
 
 
    while(
PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]])
    {
      
client_print(attackerprint_chat"[Animal Mod] Congratulations! You are a level %i %s!",
      
PlayerLevel[attacker] += 1
    
}
    
ShowHud(attacker)
    
SaveData(attacker)
}
public 
ShowHud(id)
{
    
set_hudmessage(255000.750.0106.015.0)
    
show_hudmessage(id"Level: %i^nXP: %i^nClass: %s",PlayerLevel[id],PlayerXP[id],CLASSES[PlayerClass[id]])
}
public 
ChangeClass(id)
{
    new 
menu menu_create("Class Menu" "Class_Handle");
    
menu_additem(menu ,"Dog""1" 0);
    
menu_additem(menu ,"Cat""2" 0);
    
menu_additem(menu ,"Horse""3" 0);
    
menu_additem(menu ,"Cow""4" 0);
 
    
menu_setprop(menu MPROP_EXIT MEXIT_ALL);
 
    
menu_display(id menu 0);
 
    return 
PLUGIN_CONTINUE;
}
public 
Class_Handle(id menu item
{
    if(
item == MENU_EXIT
    {
 
        
menu_destroy(menu);
 
    }
 
    new 
szCommand[6] , szName[64];
    new 
access callback;
 
    
menu_item_getinfo(menu item access szCommand szName 63 callback);
 
    new 
str_to_num(szCommand)
    if(
PlayerClass[id] != i)
    {
        
PlayerClass[id] = i
        client_print
(id,print_chat,"You are now a %s",CLASSES[i])
    }
    else
    {
        
client_print(id,print_chat,"You are alredy a %s",CLASSES[i])
    }
 
    
menu_destroy(menu);
    return 
PLUGIN_CONTINUE
}
public 
client_connect(id)
{
    if(
get_pcvar_num(SaveXP) == 1)
    {
 
        
LoadData(id)
    }
}
public 
client_disconnect(id)
{
    if(
get_pcvar_num(SaveXP) == 1)
    {
 
        
SaveData(id)
    }
    
PlayerXP[id] = 0
    PlayerLevel
[id] = 0
    PlayerClass
[id] = 0
}
public 
SaveData(id)
{
    new 
AuthID[35]
    
get_user_authid(id,AuthID,34)
 
    new 
vaultkey[64],vaultdata[256]
    
format(vaultkey,63,"%s-Mod",AuthID)
    
format(vaultdata,255,"%i#%i#",PlayerXP[id],PlayerLevel[id])
    
nvault_set(g_vault,vaultkey,vaultdata)
    return 
PLUGIN_CONTINUE
}
public 
LoadData(id)
{
    new 
AuthID[35]
    
get_user_authid(id,AuthID,34)
 
    new 
vaultkey[64],vaultdata[256]
    
format(vaultkey,63,"%s-Mod",AuthID)
    
format(vaultdata,255,"%i#%i#",PlayerXP[id],PlayerLevel[id])
    
nvault_get(g_vault,vaultkey,vaultdata,255)
 
    
replace_all(vaultdata255"#"" ")
 
    new 
playerxp[32], playerlevel[32]
 
    
parse(vaultdataplayerxp31playerlevel31)
 
    
PlayerXP[id] = str_to_num(playerxp)
    
PlayerLevel[id] = str_to_num(playerlevel)
 
    return 
PLUGIN_CONTINUE

Code:
Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Error: Undefined symbol "id" on line 43
Error: Undefined symbol "attacker" on line 45
Error: Undefined symbol "attacker" on line 48
Error: Undefined symbol "attacker" on line 51
Error: Undefined symbol "attacker" on line 54
Error: Undefined symbol "attacker" on line 56
Warning: Expression has no effect on line 56
Warning: Expression has no effect on line 56
Error: Undefined symbol "attacker" on line 56
Error: Undefined symbol "attacker" on line 59
Error: Undefined symbol "attacker" on line 60

9 Errors.
Could not locate output file D:\Server\cstrike\addons\amxmodx\plugins\Untitled.amx (compile failed).
__________________
extreem is offline
Send a message via Skype™ to extreem
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 06-14-2011 , 16:59   Re: New XP Mod tutorial
Reply With Quote #222

Quote:
Originally Posted by extreem View Post
I can't to compile plugin.
read through the whole thread the issues have been pointed out more than once i promise you -.-
Erox902 is offline
Vechta
Veteran Member
Join Date: Jun 2010
Old 06-16-2011 , 09:14   Re: New XP Mod tutorial
Reply With Quote #223

under
PHP Code:
public eDeath(  ) 
add
PHP Code:
new attacker read_data(1
Vechta is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-16-2011 , 10:02   Re: New XP Mod tutorial
Reply With Quote #224

This should be your death function:
PHP Code:
public eDeath(  ) 
{
    new 
attacker read_data)
    new 
iVictim read_data)
    
    if(
attacker == iVictim || !is_user_connected(attacker) || get_user_team(attacker) == get_user_team(iVictim)) return;
    
    new 
headshot read_data)
    
    new 
weapon[7]
    
read_data4weaponcharsmaxweapon ) )
 
    
PlayerXP[attacker] += get_pcvar_num(XP_Kill)
 
    if(
headshot)
    
PlayerXP[attacker] += get_pcvar_num(XP_Hs)
 
    if(
equal(weapon"knife"))
    
PlayerXP[attacker] += get_pcvar_num(XP_Knife)
 
 
    while(
PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]])
    {
      
client_print(attackerprint_chat"[Animal Mod] Congratulations! You are a level %i %s!",
      
PlayerLevel[attacker] += 1
    
}
    
ShowHud(attacker)
    
SaveData(attacker)

__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
usaexelent
Senior Member
Join Date: Nov 2009
Location: Lithuania
Old 06-22-2011 , 06:28   Re: New XP Mod tutorial
Reply With Quote #225

Don't you need this line new attacker = read_data( 1 )
And BTW this plugin doesn't compile
usaexelent is offline
Send a message via Skype™ to usaexelent
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 06-22-2011 , 07:07   Re: New XP Mod tutorial
Reply With Quote #226

Quote:
Originally Posted by usaexelent View Post
Don't you need this line new attacker = read_data( 1 )
And BTW this plugin doesn't compile
no shit you can accually copy & paste what exolent just wrote to make it work.
Erox902 is offline
RuleBreaker
Senior Member
Join Date: May 2011
Old 06-23-2011 , 13:07   Re: New XP Mod tutorial
Reply With Quote #227

Great tut thanks for sharing ;)
But how to add that players gets e.g. more HP every lvl?
RuleBreaker is offline
RuleBreaker
Senior Member
Join Date: May 2011
Old 08-02-2011 , 06:43   Re: New XP Mod tutorial
Reply With Quote #228

After eDeath you forgot:
Code:
new attacker = read_data (1)
and you need to change
Code:
new clip, ammo, weapon = get_user_weapon(id,clip,ammo);
to
Code:
new clip, ammo, weapon = get_user_weapon(attacker,clip,ammo);
RuleBreaker is offline
Krle
Senior Member
Join Date: Jul 2011
Location: Serbia, Nis
Old 08-02-2011 , 07:05   Re: New XP Mod tutorial
Reply With Quote #229

@RuleBreaker
Try something like this
if(PlayerLevel[id] > 5)
{
set_user_health
}
And so on..

P.S I'm from KGB Forum (Krle97)

@EDIT ooh i forgot... For every class levels are same? Any way to fix it?
__________________

Sorry about my BAD English
Krle is offline
Send a message via MSN to Krle
liinuus
Senior Member
Join Date: Apr 2010
Old 08-02-2011 , 11:50   Re: New XP Mod tutorial
Reply With Quote #230

Quote:
Originally Posted by Krle View Post
@RuleBreaker
Try something like this
if(PlayerLevel[id] > 5)
{
set_user_health
}
And so on..

P.S I'm from KGB Forum (Krle97)

@EDIT ooh i forgot... For every class levels are same? Any way to fix it?
save & load the levels to an class
liinuus is offline
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 21:37.


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