let me guess, should it be like this;
Code: Select all
public Event_CurWeapon(id) {
if(PlayerClass[id] == CLASS_RUN) {
new Float:Speed = 320.0+(PlayerLevel[id]*50)
set_user_maxspeed(id, Float:Speed)
}
}
Code: Select all
public Event_CurWeapon(id) {
if(PlayerClass[id] == CLASS_RUN) {
new Float:Speed = 320.0+(PlayerLevel[id]*50)
set_user_maxspeed(id, Float:Speed)
}
}
Code: Select all
new Float:pGrav = 1.00-(g_PlayerLevel[id]*0.08)
set_user_gravity(id,pGrav);Code: Select all
public plugin_init() {
//...
register_event("CurWeapon", "Event_CurWeapon", "be", "1=1"); // we need to do this becuase speed resets to default whenever the weapon is changed.
}
public Event_CurWeapon(id) {
new Float:pSpeed = 320+(g_PlayerLevel*35)
set_user_maxspeed(id,pSpeed);
}Code: Select all
new g_PlayerHP[33]
new g_PlayerAP[33]
public plugin_init() {
//...
register_event("ResetHUD", "ResetHUD", "be");
}
public ResetHUD(id) {
if(!is_user_connected(id) || !is_user_alive(id) || !is_user_bot(id)) return PLUGIN_HANDLED;
//Do whatever checks you want here
set_task(0.5,"SetStats",id);
}
public SetStats(id) {
new iHP, iAP
iHP = g_PlayerLevel[id]*25
iAP = g_PlayerLevel[id]*10
if(g_PlayerHP[id] < 100) g_PlayerHP = 100
if(g_PlayerAP[id] < 100) g_PlayerAP = 100 // Cuzz I like starting with full armor
g_PlayerHP[id] += iHP
g_PlayerAP[id] += iAP
set_user_health(id, g_PlayerHP[id]);
cs_set_user_armor(id, g_PlayerAP[id], CsArmorType:2);
}
i did now it was ResetHUDbut nothing of these codes work :O :O :O :O:O :O
That won't do anything, it doesn't matter if your hooked function is the same as the event.one good advice
==> never use the same name as you register something with
always do it like => register_event(ResetHUD, hud_reset)
the name is a bit different, but it solves many bugs like reserved names

Code: Select all
register_event("DeathMsg", "DeathMsg", "ae"Code: Select all
if(is_user_alive(attacker))
{
//givexp
}sry but
works for me tooCode: Select all
register_event("DeathMsg", "DeathMsg", "a")
but if you were smart enough
you would - the killer's xp if he kills a team mate since the kill command is killing someone from your own team

I don't think they can be shown a menu, while their veiwing a loading screen.Make the menu.
Then go like so.
public client_connect(id)
{
PlayerClass[id] = CLASS_NOTHING
GotoMenu(id)
}
so whose right about client_connect and client_putinserver?client_connect is called before that, you're thinking of client_putinserver
pssssh, use client_authorized to reset his class, then when round starts pop up the menu to give him to option to choose class. =/Yeah my mistake. I was tired.
client_putinserver is what you want.

O.oI forget is this is called with the level command that disconnects all players, or the one where it keeps all the clients. You might want to take a try with it (there are other ways of course ^^).Code: Select all
public server_changeleve(map[]) { // Code... }

I am really new to amxx scripting but here is something that I thought about based on this tutorial.
Code: Select all
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <cstrike>
#include <vault>
//let's say you did everything else in this tutorial..
public GiveXP(id, level, cid)
{
if (!cmd_access(id, level, cid, 3))
return PLUGIN_CONTINUE
new Arg1[24], Arg2[11]
read_argv(1, Arg1, 23)
read_argv(2, Arg2, 10)
new Target = cmd_target(id, Arg1, 8)
new XPAmount = str_to_num(Arg2)
new authid[32];
get_user_authid(id,authid,31);
new vaultkey[64], vaultdata[64];
format(vaultkey,63,"ANIMAL-%s-xp",authid);
get_vaultdata(vaultkey,vaultdata,63);
new OrgXP = str_to_num(vaultdata);
new TargetName[32]
get_user_name(Target,TargetName,31)
if (!Target)
{
console_print(id, "Sorry, player %s could not be found or be targetted!", TargetName)
return PLUGIN_CONTINUE
}
else
{
if (XPAmount > 0 && XPAmount <= 9999999999)
{
XPAmount = XPAmount + OrgXP
format(vaultkey,63,"ANIMAL-%s-xp",authid);
format(vaultdata,63,"%d",XPAmount);
set_vaultdata(vaultkey,vaultdata);
console_print(id, "Player %s XP was changed to %d ", TargetName, XPAmount)
}
}
return PLUGIN_CONTINUE
} 


Code: Select all
#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("Mod", "1.0", "Fxfighter")
register_event("DeathMsg", "eDeath", "a")
SaveXP = register_cvar("SaveXP","1")
XP_Kill=register_cvar("XP_per_kill", "20")
XP_Knife=register_cvar("XP_hs_bonus","20")
XP_Hs=register_cvar("XP_knife_bonus","20")
g_vault = nvault_open("VAULT")
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( 2 )
new weapon, hitplace, attacker = get_user_attacker(iVictim,weapon,hitplace)
PlayerXP[attacker] += get_pcvar_num(XP_Kill)
if(hitplace == HIT_HEAD)
PlayerXP[attacker] += get_pcvar_num(XP_Hs)
if(weapon == CSW_KNIFE)
PlayerXP[attacker] += get_pcvar_num(XP_Knife)
if(PlayerXP[attacker] >= LEVELS[PlayerLevel[attacker]])
PlayerLevel[attacker] += 1
ShowHud(attacker)
SaveData(attacker)
}
public ShowHud(id)
{
set_hudmessage(255, 0, 0, 0.01, 0.2, 0, 6.0, 12.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)
client_print(id, print_chat, "[Mod] XP Loaded!")
}
}
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
} Users browsing this forum: No registered users and 1 guest