Raised This Month: $51 Target: $400
 12% 

New XP Mod tutorial


Post New Thread Reply   
 
Thread Tools Display Modes
KillerMasa
Senior Member
Join Date: May 2012
Old 06-06-2012 , 15:59   Re: New XP Mod tutorial
Reply With Quote #281

How can make to you have already one class?
KillerMasa is offline
Logix
Junior Member
Join Date: Mar 2009
Old 06-25-2012 , 01:15   Re: New XP Mod tutorial
Reply With Quote #282

can someone make a tutorial how to get "Skills" into the classes? where to place the skills
Logix is offline
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 07-01-2012 , 15:49   Re: New XP Mod tutorial
Reply With Quote #283

Hi. Good tutorial. thanks a lot guy !
Just some questions please

here why 64 and 256 ?
And why you set that # ?
Code:
new vaultkey[64],vaultdata[256] format(vaultkey,63,"%s-Mod",AuthID) format(vaultdata,255,"%i#%i#",PlayerXP[id],PlayerLevel[id])

And just here :
Code:
new szCommand[6] , szName[64]; // Why 6 and 64 and not 32 for szName new access , callback; menu_item_getinfo(menu , item , access , szCommand , 5 , szName , 63 , callback); new i = str_to_num(szCommand)
And can you just explain this please. Thanks a lot
__________________
Pawn ? Useless

Last edited by Aooka; 07-01-2012 at 15:49.
Aooka is offline
NjOyYy
Junior Member
Join Date: Oct 2011
Old 07-19-2012 , 13:35   Re: New XP Mod tutorial
Reply With Quote #284

Can someone make mysql version of this ?
NjOyYy is offline
Aooka
Veteran Member
Join Date: Aug 2011
Location: Villeurbanne
Old 07-19-2012 , 14:35   Re: New XP Mod tutorial
Reply With Quote #285

You LOVE mysql guy x)
__________________
Pawn ? Useless
Aooka is offline
Old 07-21-2012, 04:22
tomhal46273
This message has been deleted by Arkshine. Reason: spambot
todash01
Junior Member
Join Date: May 2012
Old 09-22-2012 , 21:59   Re: New XP Mod tutorial
Reply With Quote #286

help error compilation :
xpmodtorturial.sma <57 -- 59> : error 001: expected token: ",", but found "}"

xomodtorturial.sma <62> : warning 204" symbol is assigned a value that is never used: "ivictim"

help pls
todash01 is offline
DrunkenKoZ
Greetings, mortal.
Join Date: Aug 2008
Old 11-28-2012 , 21:21   Re: New XP Mod tutorial
Reply With Quote #287

Anyone who is having a problem compiling you can try the code below. This also fixes a player receiving experience upon death.

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 attacker = read_data( 1 )
    new victim = read_data( 2 )
    new headshot = read_data( 3 )
    new clip, ammo, weapon = get_user_weapon(attacker, clip, ammo)
    
    if(attacker == victim)
    {
        return PLUGIN_HANDLED
    }

    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(attacker, print_chat, "[Animal Mod] Congratulations! You are a level %i %s!", PlayerLevel[attacker], CLASSES[PlayerClass[attacker]])
        PlayerLevel[attacker] += 1
    }
    
    ShowHud(attacker)
    SaveData(attacker)
    
    return PLUGIN_HANDLED
}

public ShowHud(id)
{
    set_hudmessage(255, 0, 0, 0.75, 0.01, 0, 6.0, 15.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 , 5 , szName , 63 , callback);
 
    new i = 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(vaultdata, 255, "#", " ")
 
    new playerxp[32], playerlevel[32]
 
    parse(vaultdata, playerxp, 31, playerlevel, 31)
 
    PlayerXP[id] = str_to_num(playerxp)
    PlayerLevel[id] = str_to_num(playerlevel)
 
    return PLUGIN_CONTINUE
}
Attached Files
File Type: sma Get Plugin or Get Source (animalxpmod.sma - 495 views - 3.9 KB)

Last edited by DrunkenKoZ; 11-28-2012 at 21:22.
DrunkenKoZ is offline
iplayz
Junior Member
Join Date: Oct 2011
Old 12-13-2012 , 07:53   Re: New XP Mod tutorial
Reply With Quote #288

Im having troubles with the different classes leveling

example when i am a 'dog' and I get 200 xp on my dog class.
then switch to the 'cat' I also have 200 xp on my cat class,

I used the full code you are using, copied it 100% correctly

What's wrong with it?
iplayz is offline
DrunkenKoZ
Greetings, mortal.
Join Date: Aug 2008
Old 12-13-2012 , 23:47   Re: New XP Mod tutorial
Reply With Quote #289

The plugin doesn't store experience based on what class you are.
DrunkenKoZ is offline
DjSm0k3r
New Member
Join Date: May 2013
Old 05-23-2013 , 13:17   Re: New XP Mod tutorial
Reply With Quote #290

error 001: expected token: ",", but found "}"
warning 204: symbol is assigned a value that is never used: "iVictim"

So WTF ?!!!!

Last edited by DjSm0k3r; 05-23-2013 at 13:18.
DjSm0k3r is offline
Old 05-25-2013, 05:26
Doendyn
This message has been deleted by YamiKaitou. Reason: spambot
Old 08-05-2013, 01:03
LordOfNothing
This message has been deleted by ConnorMcLeod. Reason: troll, or posting random confusing code, or posting for posts count
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 18:39.


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