Raised This Month: $32 Target: $400
 8% 

Help me with this little problem [xpsystem] ;-;


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LaranjoBreks
Junior Member
Join Date: Aug 2020
Location: Rio de Janeiro, Rio de j
Old 08-20-2020 , 17:44   Help me with this little problem [xpsystem] ;-;
Reply With Quote #1

Hello I have a problem with my cs1.6 plugin, I wanted to make a way to block the class choice after choosing it for the first time, example I already chose the class and in the same round I wanted it not to be possible to choose another class unless it is in the next round
LaranjoBreks is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 08-20-2020 , 19:04   Re: Help me with this little problem [xpsystem] ;-;
Reply With Quote #2

Declare a new boolean which is holding MAX_PLAYERS + 1 cells and sets it's value true when a class is selected, then check if the boolean exists. After all, remove the bool value in the round start event.
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
LaranjoBreks
Junior Member
Join Date: Aug 2020
Location: Rio de Janeiro, Rio de j
Old 08-20-2020 , 19:21   Re: Help me with this little problem [xpsystem] ;-;
Reply With Quote #3

Quote:
Originally Posted by Shadows Adi View Post
Declare a new boolean which is holding MAX_PLAYERS + 1 cells and sets it's value true when a class is selected, then check if the boolean exists. After all, remove the bool value in the round start event.
can you teach me how i do this in my code ?
LaranjoBreks is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 08-20-2020 , 20:54   Re: Help me with this little problem [xpsystem] ;-;
Reply With Quote #4

Where is "your code"?..
__________________

Last edited by OciXCrom; 08-20-2020 at 20:54.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
LaranjoBreks
Junior Member
Join Date: Aug 2020
Location: Rio de Janeiro, Rio de j
Old 08-20-2020 , 21:11   Re: Help me with this little problem [xpsystem] ;-;
Reply With Quote #5

Quote:
Originally Posted by OciXCrom View Post
Where is "your code"?..
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <nvault>
#include <fun>
#include <cstrike>
#define MAXCLASSES 5
new const CLASSES[MAXCLASSES][] = {
    
"Padrao",
    
"Soldado",
    
"Cabo",
    
"General",
    
"Heroi de Guerra"
}
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("XPSYSTEM""2.0""LaranjoBreks")
 
    
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","50")
    
XP_Knife=register_cvar("XP_knife_bonus","100")
    
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 
plugin_precache(){
    
    
precache_model("models/player/Asasin/Asasin.mdl")
    
precache_model("models/player/Death/Death.mdl")
    
precache_model("models/player/Dobby/Dobby.mdl")
    
precache_model("models/player/Sonic/Sonic.mdl")
}
public 
eDeath() 
{
    new 
attacker read_data)
    new 
headshot read_data)
    new 
clipammoweapon get_user_weapon(attacker,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 ,"Soldado = 120 XP""1" 0);
    
menu_additem(menu ,"Cabo = 260 XP""2" 0);
    
menu_additem(menu ,"General = 1000 XP""3" 0);
    
menu_additem(menu ,"Heroi de Guerra = 2400 XP""4" 0);
 
    
menu_setprop(menu MPROP_EXIT MEXIT_ALL);
 
    
menu_display(id menu 0);
}
public 
Class_Handle(id menu item
{
    if(
item == MENU_EXIT
    {
 
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED
    
}
 
    new 
szCommand[5], szName[64];
    new 
access callback;
 
    
menu_item_getinfo(menu item access szCommand szName 63 callback);
 
    new 
str_to_num(szCommand)
    switch(
i)
    {
    case 
1:{
        if(
PlayerXP[id] <= 120){
    
client_print(idprint_chat"Voce nao possui xp suficiente ou ja possui a classe")
    }
    else{
    
set_user_armor(id100)
    
set_user_health(id150)
    
cs_set_user_model(id"Dobby")
    
client_print(id,print_chat,"Voce Escolheu a classe %s",CLASSES[i])
    
PlayerClass[id] = i
    
}
    return 
PLUGIN_HANDLED
    
}
    case 
2:{
    if(
PlayerXP[id] <= 260){
    
client_print(idprint_chat"Voce nao possui xp suficiente ou ja possui a classe")
    }
    else{
    
set_user_armor(id150)
    
set_user_health(id200)
    
cs_set_user_model(id"Sonic")
    
client_print(id,print_chat"Voce Escolheu a classe %s",CLASSES[i])
    
PlayerClass[id] = i
    
}
    return 
PLUGIN_HANDLED
   
}
    case 
3:{
        if(
PlayerXP[id] <= 1000){
    
client_print(idprint_chat"Voce nao possui xp suficiente ou ja possui a classe")
    }
    else{
    
set_user_armor(id200)
    
set_user_health(id250)
    
cs_set_user_model(id"Death")
    
client_print(id,print_chat"Voce Escolheu a classe %s",CLASSES[i])
    
PlayerClass[id] = i
    
}
    return 
PLUGIN_HANDLED
    
}
    case 
4:{
        if(
PlayerXP[id] <= 2400){
    
client_print(idprint_chat"Voce nao possui xp suficiente ou ja possui a classe")
    }
    else{
    
give_item(id,"weapon_ak47")
    
give_item(id,"weapon_deagle")
    
set_user_health(id,350)
    
set_user_armor(id,250)
    
cs_set_user_bpammo(id,CSW_AK47,90)
    
cs_set_user_bpammo(id,CSW_DEAGLE,35)
    
cs_set_user_model(id"Asasin")
    
client_print(id,print_chat,"Voce Escolheu a classe %s",CLASSES[i])
    
PlayerClass[id] = i
    
}
    }
}
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED
}
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],PlayerClass[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],PlayerClass[id])
    
nvault_get(g_vault,vaultkey,vaultdata,255)
 
    
replace_all(vaultdata255"#"" ")
 
    new 
playerxp[32], playerlevel[32], playerclass[32]
 
    
parse(vaultdataplayerxp31playerlevel31playerclass31)
 
    
PlayerXP[id] = str_to_num(playerxp)
    
PlayerLevel[id] = str_to_num(playerlevel)
    
PlayerClass[id] = str_to_num(playerclass)
 
    return 
PLUGIN_CONTINUE


Last edited by LaranjoBreks; 08-21-2020 at 12:22.
LaranjoBreks is offline
Foxa
Member
Join Date: Nov 2018
Location: Croatia
Old 08-21-2020 , 09:59   Re: Help me with this little problem [xpsystem] ;-;
Reply With Quote #6

Oh for f.. sake please use the [php] or the [pawn] tag..
Foxa is offline
LaranjoBreks
Junior Member
Join Date: Aug 2020
Location: Rio de Janeiro, Rio de j
Old 08-21-2020 , 11:28   Re: Help me with this little problem [xpsystem] ;-;
Reply With Quote #7

Quote:
Originally Posted by Foxa View Post
Oh for f.. sake please use the [php] or the [pawn] tag..
?
LaranjoBreks is offline
Foxa
Member
Join Date: Nov 2018
Location: Croatia
Old 08-21-2020 , 11:57   Re: Help me with this little problem [xpsystem] ;-;
Reply With Quote #8

Use the [php] or [pawn] around your code so its readable:

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Author"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "Author" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         // Add your code here... }
Foxa is offline
LaranjoBreks
Junior Member
Join Date: Aug 2020
Location: Rio de Janeiro, Rio de j
Old 08-21-2020 , 12:19   Re: Help me with this little problem [xpsystem] ;-;
Reply With Quote #9

Quote:
Originally Posted by Foxa View Post
Use the [php] or [pawn] around your code so its readable:

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Author"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "Author" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         // Add your code here... }

oh sorry, i didn't remember that
LaranjoBreks is offline
LaranjoBreks
Junior Member
Join Date: Aug 2020
Location: Rio de Janeiro, Rio de j
Old 08-21-2020 , 12:22   Re: Help me with this little problem [xpsystem] ;-;
Reply With Quote #10

Quote:
Originally Posted by Foxa View Post
Use the [php] or [pawn] around your code so its readable:

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Author"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "Author" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         // Add your code here... }
i already edited my post
LaranjoBreks 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 03:23.


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