Member
Join Date: Jan 2008
Location: Los Angeles, California,
|
03-14-2008
, 19:01
Please fix my code
|
#1
|
PHP Code:
#include <amxmodx> #include <amxmisc> #include <nvault>
#define MAXRANKS 55
new PlayerXP[33],PlayerLevel[33],PlayerRank[33], g_status_sync new XP_Kill,XP_Knife,XP_Hs,SaveXP new g_vault
public plugin_init() { register_plugin("Call of Duty 4: Modern Warfare Xp Mod", "1.0", "SwiFtStRyDeR") register_event("DeathMsg", "eDeath", "a") register_event("StatusValue", "on_ShowStatus", "be", "1=2", "2!0"); SaveXP = register_cvar("SaveXP","1") XP_Kill=register_cvar("XP_per_kill", "10") XP_Hs=register_cvar("XP_hs_bonus","5") XP_Knife=register_cvar("XP_knife_bonus","10") g_vault = nvault_open("cod4mwxm") register_clcmd("say /xp", "ShowHud") register_clcmd("say_team /xp", "ShowHud") }
new const RANKS[] = { "Private First Class", "Private First Class", "Private First Class", "Lance Corporal", "Lance Corporal", "Lance Corporal", "Corporal", "Corporal", "Corporal", "Sergeant", "Sergeant", "Sergeant", "Staff Sergeant", "Staff Sergeant", "Staff Sergeant", "Gunnery", "Gunnery Sergeant", "Gunnery Sergeant", "Master", "Master Sergeant", "Master Sergeant", "Master Gunnery Sergeant", "Master Gunnery Sergeant", "Master Gunnery Sergeant", "2nd Lieutenant", "2nd Lieutenant", "2nd Lieutenant", "1st Lieutenant", "1st Lieutenant", "1st Lieutenant", "Captain", "Captain", "Captain", "Major", "Major", "Major", "Lieutenant Colonel", "Lieutenant Colonel", "Lieutenant Colonel", "Colonel", "Colonel", "Colonel", "Brigadier General", "Brigadier", "Brigadier", "Major General", "Major General", "Major General", "Lieutenant General", "Lieutenant General", "Lieutenant General", "General", "General", "General", "Commander" }
new const EXPERIENCE[] = { 0, 30, 120, 270, 480, 750, 1080, 1470, 1920, 2430, 3000, 3650, 4380, 5190 , 6080, 7050, 8100, 9230, 10440, 11730, 13100, 14550, 16080, 17690, 19380, 21150, 23000, 24930, 26940, 29030, 31240, 33570, 36020, 38590, 41280, 44090, 47020, 50070, 53240, 56530, 59940, 63470, 67120, 70890, 74780, 78790, 82920, 87170, 91540, 96030, 100640, 105370, 110220, 115190, 120280 }
public eDeath(id, attacker) { if(PlayerRank[attacker] == 0) return PLUGIN_CONTINUE new iVictim = read_data( 2 ) new headshot = read_data( 3 ) new clip, ammo, weapon = 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(PlayerRank[attacker] >= RANKS[PlayerRank[attacker]]) client_print(attacker, print_chat, "[CoD4 MW XP Mod] Congratulations! You are a level %i %s!", PlayerLevel[attacker],PlayerRank[attacker]]) PlayerLevel[attacker] += 1 }
{ public ShowHud(id) } { set_hudmessage(255, 0, 0, 0.75, 0.01, 0, 6.0, 15.0) show_hudmessage(id, "Level: %i^nXP: %i^nRank: %s",PlayerLevel[id],PlayerXP[id],PlayerRank[id]]) }
public on_ShowStatus(id) { new name[32], pid = read_data(2); new pidlevel = PlayerLevel[pid]; new pidrank = PlayerRank[pid]; new pidxp = PlayerXP[pid];
get_user_name(pid, name, 31); new color1 = 0, color2 = 0;
if (get_user_team(pid) == 1) color1 = 255; else color2 = 255 set_hudmessage(color1, 100, color2, -1.0, 0.35, 0, 0.01, 20.0); ShowSyncHudMsg(id, g_status_sync, "%s^nLevel: %d %s^nRank: %d %s^nXp: %d", name, PlayerLevel[pidlevel]+1, PlayerRank[pidrank]+1, PlayerXP[pidxp]+1); }
public on_HideStatus(id) { ClearSyncHud(id, g_status_sync); }
public client_connect(id) { if(get_pcvar_num(SaveXP) == 1) { LoadData(id) } }
public client_disconnect(id) { if(get_pcvar_num(SaveXP) == 1) { SaveData(id) } }
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#%i#",PlayerXP[id],PlayerLevel[id], PlayerRank[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#%i#",PlayerXP[id],PlayerLevel[id], PlayerRank[id]) nvault_get(g_vault,vaultkey,vaultdata,255) replace_all(vaultdata, 255, "#", " ") new playerxp[32], playerlevel[32], playerrank[32] parse(vaultdata, playerxp, 31, playerlevel, 31 playerrank, 31) PlayerXP[id] = str_to_num(playerxp) PlayerLevel[id] = str_to_num(playerlevel) PlayerRank[id] = str_to_num(playerrank) return PLUGIN_CONTINUE }
Your plugin successfully compiled!
Use the link below to download your plugin.
Welcome to the AMX Mod X 1.76-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team
/home/groups/amxmodx/tmp3/phpOumrej.sma(155) : error 001: expected token: ",", but found "]"
/home/groups/amxmodx/tmp3/phpOumrej.sma(155) : error 029: invalid expression, assumed zero
/home/groups/amxmodx/tmp3/phpOumrej.sma(155) : error 029: invalid expression, assumed zero
/home/groups/amxmodx/tmp3/phpOumrej.sma(155) : fatal error 107: too many error messages on one line
Compilation aborted.
4 Errors.
Done.
Will these errors affect the plugin in gameplay?
__________________
Quote:
Originally Posted by Hawk552
hi my description sucks and I go on and on and on until I start foaming at the mouth and fall backwards
|
Last edited by SwiFtStRiDeR; 03-14-2008 at 20:32.
|
|