|
Senior Member
|

06-21-2011
, 16:34
Re: Could anyone Fix This Code better
|
#5
|
Quote:
Originally Posted by fysiks
Well, first off, it doesn't compile.
You need to learn to solve these extremely simple compiler errors by yourself. It seems to me you are just being lazy.
|
1. I Got it to complie, But when Im T Or ct The shop doesnt show.
2.I think I misst somting, I meant How can i make my code better.
The code i got 2 complie:
PHP Code:
/*
////////////////-|Ct Shop|-///////////////////
Deagle shotgun m249 Night Vision GreNade Packet Revive
////////////////-T Shop-///////////////////////
Anti Deagle Ratio Shield Revive Spy
*/
#include <amxmodx> #include <amxmisc> #include <fun> #include <cstrike> #include <hamsandwich> #include <Colorchat> #include <engine> #include <fakemeta> #include <hamsandwich> #include <fakemeta_util>
//Define #define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers ) #define fm_DispatchSpawn(%1) dllfunc(DLLFunc_Spawn, %1) #define A "2reason2kill" #define V "1.0" #define P "vampire mod"
//Boolean new bool:g_bBoght[33][33] new bool:idk[33] new bool:NewClass[33];
//prefix etc
new PlayerClass[33] new PREFIX[] = "[Vampire Mod]^x01:" new g_iMaxPlayers // Class things enum { CLASS_Classic = 0,// Hp 750, Speed 400, Gravity 500, Claws, damage half CLASS_Bloodsucker,// Hp 400, Speed 500,Gravity 800, Bloody knife,damage full CLASS_Blademaster,//Hp 605, Speed 300, Gravity 300, Long sword,damage half CLASS_Bloody,//hp 505, Speed 700, Gravity 800, Claim, Claws, CLASS_nightmare,//hp 405, Speed 500,gravity 600,Claws, invible MAXCLASSES }
new const CLASSES[MAXCLASSES] [] = { "Clasic Vampire", "Bloodsucker", "Blademaster", "Bloody", "NightMare" } //Cvar's
new BloodyHp,Nightmarehp,Bloodsuckerhp, Blademasterhp,Clasichp,invisbletime,silver_lighet_cost,Shotghun_cost,nightvison_cost,grenadepacket_cost,revive_cost,anti_deagle_cost,m249_cost,spy_cost,ratio_shield_cost,Clasic_Gravity,bloodsucker_gravity,blademaster_gravity,Bloody_gravity,nightmare_gravity
//shop item
//Ct enum { silver_lighet, Shotghun, nightvison, grenade_packet, Revive, m249 }
//T enum { anti_deagle, ratio_shield, Spy }
public plugin_init() { register_plugin(P, V, A) //Cvar's /* Hp Cvar */ BloodyHp = register_cvar("vm_bloody_hp","250")// Bloody Hp Nightmarehp = register_cvar("vm_nightmare_hp","530")// NM Hp Bloodsuckerhp = register_cvar("vm_bloodsucker_hp","150")// BS hp Blademasterhp = register_cvar("vm_blademaster_hp","300")//bm Hp Clasichp = register_cvar("vm_Clasic_hp","350")//clasic hp /* Time Cvar */ invisbletime = register_cvar("vm_Invisble_time","15.0")//invisble Time /* Cost Cvar */ silver_lighet_cost = register_cvar("silver_lighet_cost","16000") Shotghun_cost = register_cvar("Shotghun_cost","16000") nightvison_cost = register_cvar("nightvison_cost","16000") grenadepacket_cost = register_cvar("grenadepacket_cost","16000") revive_cost = register_cvar("revive_cost","16000") anti_deagle_cost = register_cvar("anti_deagle_cost","16000") m249_cost = register_cvar("m249_cost","16000") spy_cost = register_cvar("vm_spy","16000") ratio_shield_cost = register_cvar("vm_ratioS_cost","16000") /* Gravity Cvar */ Clasic_Gravity = register_cvar("vm_clasic_gravity","500") bloodsucker_gravity = register_cvar("vm_bloodsucker_gravity","800") blademaster_gravity = register_cvar("vm_blademaster_gravity","300") Bloody_gravity = register_cvar("vm_bloody_gravity","800") nightmare_gravity = register_cvar("vm_nightmare_gravity","600") //Round Start & Round end
//forward and hook's RegisterHam( Ham_TakeDamage , "player" , "fwTakeDamage" ) RegisterHam(Ham_Spawn, "player", "Player_Spawn_Post", 1); g_iMaxPlayers = get_maxplayers() register_event("Damage", "on_damage", "b", "2!0", "3=0", "4!0") register_event("CurWeapon", "CheckSpeed", "be"); //commands register_clcmd("say /shop","showmenu"); register_concmd("say_team /shop","Shop"); register_concmd("say /Help","Showhelp"); register_clcmd("say /class","changeclass"); }
public showmenu(id) { if(is_user_alive(id)) { new Shop, Item[35]; switch(cs_get_user_team(id)) { case CS_TEAM_T: { Shop = menu_create("\y [\rVampire Shop\y]\y:","vampireshop"); formatex(Item, charsmax(Item), "\wAnti Deagle\y[\r %s $\y]", get_pcvar_num(anti_deagle_cost)); menu_additem(Shop,Item, "1"); formatex(Item, charsmax(Item), "\wRatio Shield!\y[\r %s $\y]", get_pcvar_num(ratio_shield_cost)); menu_additem(Shop,Item, "2"); formatex(Item, charsmax(Item), "\wChamelon\y[\r %s $\y]", get_pcvar_num(spy_cost)); menu_additem(Shop,Item, "3"); } case CS_TEAM_CT: { Shop = menu_create("\y [\rHumen Shop\y]\y:","CsShop"); formatex(Item, charsmax(Item), "\wSilver Light \y[\r %d $\y]", get_pcvar_num(silver_lighet_cost)); menu_additem(Shop,Item, "1"); format(Item,sizeof(Item)-1, "\wShotty\y[\r %d $\y]", get_pcvar_num(Shotghun_cost)); menu_additem(Shop,Item, "2"); format(Item,sizeof(Item)-1, "\wnightvision\y[\r %d $\y]", get_pcvar_num(nightvison_cost)); menu_additem(Shop,Item, "3"); format(Item,sizeof(Item)-1, "\wGreNade Packet\y[\r %d $\y]", get_pcvar_num(grenadepacket_cost)); menu_additem(Shop,Item, "4"); format(Item,sizeof(Item)-1, "\wMachinGun Guy!\y[\r %d $\y]", get_pcvar_num(m249_cost)); menu_additem(Shop,Item, "5"); } } menu_setprop(Shop, MPROP_PERPAGE, 0); menu_display(id, Shop); } }
public CsShop (id, ShopCT, item) { new data[6], iName[64] new access, callback menu_item_getinfo(ShopCT, item, access, data,5, iName, 63, callback) new name [33] get_user_name(id, name, 32) new key = str_to_num(data) new money = cs_get_user_money(id) switch(key) { case 1: { if(g_bBoght[id][silver_lighet]) { ColorChat(id, GREEN,"%s You Cant Buy This Item 2 Time's!",PREFIX) } else { new cost = get_pcvar_num(silver_lighet_cost); if(money >= cost) { cs_set_weapon_ammo(give_item(id, "weapon_deagle"),1) g_bBoght[id][silver_lighet] = true cs_set_user_bpammo(id, CSW_DEAGLE, 1) cs_set_user_money(id, money -cost) set_hudmessage(0, 255, 0, -1.0, -1.0) show_hudmessage(0, "%s Just Bought a Silver light^nVampires Watch Out!") ColorChat(id, GREEN,"%s You Just Bought a^x04 silver Light^x01!", PREFIX); } } } case 2: { if(g_bBoght[id][Shotghun]) { ColorChat(id, GREEN,"%s You Can't Buy This ^x04Item^x01 2^x04 Time's^x01!",PREFIX) } else { new cost = get_pcvar_num(Shotghun_cost); if(money >= cost) { give_item(id, "weapon_m3") cs_set_user_bpammo(id, CSW_M3, 250) cs_set_user_money(id, money -cost) g_bBoght[id][Shotghun] = true; ColorChat(id,GREEN,"%s You Just Bought a^x04 Shotty^x01!",PREFIX) } } } case 3: { if(g_bBoght[id][nightvison]) { ColorChat(id,GREEN,"%s You^x04 Already^x01 This Item!",PREFIX) } else { new cost = get_pcvar_num(nightvison_cost); if(money >= cost) { give_item(id,"item_nightvision") g_bBoght[id][nightvison] = true; cs_set_user_money(id,money -cost) } } } case 4: { if(g_bBoght[id][grenade_packet]) { ColorChat(id, GREEN,"%s You^x04 Already^x01 have This^x04 Item^x01!",PREFIX) } else { new cost = get_pcvar_num(grenadepacket_cost); if(money >= cost) { give_item(id, "weapon_flashbang") give_item(id, "weapon_hegrenade") give_item(id, "weapon_smokegrenade") g_bBoght[id][grenade_packet] = true; cs_set_user_money(id, money -cost) } } } case 5: { if(g_bBoght[id][m249]) { ColorChat(id,GREEN,"%s You Aready Bought Or have this ^x04Item^01!",PREFIX) } else { new cost = get_pcvar_num(m249_cost); if(money >= cost) { give_item(id,"weapon_m249") set_hudmessage(0, 255, 0, -1.0, -1.0) show_hudmessage(0, "%s Have a Maching Gun!^nWatch Out from him!",name) g_bBoght[id][m249] = true; ColorChat(id,GREEN,"%s You Just Bought A machin Gun!",PREFIX) cs_set_user_money(id,money -cost) } } } } }
public vampireshop (id, ShopT, item) { new data[6], iName[64] new access, callback menu_item_getinfo(ShopT, item, access, data,5, iName, 63, callback) new key = str_to_num(data) new money = cs_get_user_money(id) switch(key) { case 1: { if(g_bBoght[id][anti_deagle]) { ColorChat(id, GREEN, "%s You Only Can buy this item ^x041 time^x01!",PREFIX) } else { new cost = get_pcvar_num(anti_deagle_cost) if(money >= cost) { g_bBoght[id][anti_deagle] = true; idk[id] = true; cs_set_user_money(id, money-cost) ColorChat(id, GREEN, "%s You Just Bought^x04 Anti Deagle^x01!",PREFIX) } } } case 2: { if(g_bBoght[id][ratio_shield]) { ColorChat(id,GREEN, "%s You Can't Buy This item 2 Times!",PREFIX) } else { new cost = get_pcvar_num(ratio_shield_cost); if(money >= cost) { give_item(id,"weapon_shield"); g_bBoght[id][ratio_shield] = true; cs_set_user_money(id, money-cost) ColorChat(id, GREEN, "%s You just Bought a ^x04Riot Shield^x01!",PREFIX) } } } case 3: { if(g_bBoght[id][Spy]) { ColorChat(id, GREEN," %s You aready look like an enemy!",PREFIX) } else { new cost = get_pcvar_num(spy_cost) new money = get_pcvar_num(spy_cost); new rand = random_num(1,6) if(money >=cost) { g_bBoght[id][Spy] = true; cs_set_user_money(id,money-cost) ColorChat(id, GREEN, "%s You look like an ^x04enemy^x01!",PREFIX) switch(rand) { case 1: { cs_set_user_model(id,"sas") } case 2: { cs_set_user_model(id,"urban") } case 3: { cs_set_user_model(id,"gsg9") } case 4: { cs_set_user_model(id, "gign") } case 5: { cs_set_user_model(id, "vip") } } } } } } } public fwTakeDamage( victim , inflictor , attacker , Float:damage , damage_bits ) { if( idk[victim] && IsPlayer( attacker ) && is_user_alive( attacker ) && inflictor == attacker && ( get_user_weapon(attacker) == CSW_DEAGLE ) ) { return HAM_SUPERCEDE; } return HAM_IGNORED; } public client_connect(id) { NewClass[id] = true; g_bBoght[id][silver_lighet] = false; g_bBoght[id][Shotghun] = false; g_bBoght[id][nightvison] = false; g_bBoght[id][grenade_packet] = false; g_bBoght[id][m249] = false; g_bBoght[id][anti_deagle] = false; g_bBoght[id][ratio_shield] = false; g_bBoght[id][Spy] = false; idk[id] = false; } public client_disconnect(id) { g_bBoght[id][silver_lighet] = false; g_bBoght[id][Shotghun] = false; g_bBoght[id][nightvison] = false; g_bBoght[id][grenade_packet] = false; g_bBoght[id][m249] = false; g_bBoght[id][anti_deagle] = false; g_bBoght[id][ratio_shield] = false; g_bBoght[id][Spy] = false; idk[id] = false; }
public Player_Spawn_Post(id) { //Colorchat ColorChat(0,GREEN,"%s Type /shop To open the Shop",PREFIX) ColorChat(0,GREEN,"%s Type /help To see how To play",PREFIX) //boolean for roundstart g_bBoght[id][silver_lighet] = false; g_bBoght[id][Shotghun] = false; g_bBoght[id][nightvison] = false; g_bBoght[id][grenade_packet] = false; g_bBoght[id][m249] = false; g_bBoght[id][anti_deagle] = false; g_bBoght[id][ratio_shield] = false; g_bBoght[id][Spy] = false; idk[id] = false; NewClass[id] = true; strip_user_weapons(id) }
public changeclass(id) { if(cs_get_user_team(id) == CS_TEAM_T) { Classmenu(id) } else { if(cs_get_user_team(id) == CS_TEAM_CT) ColorChat(id,GREEN,"%s You Must be a vampire To chosse Class",PREFIX) } } public Classmenu(id) { new Classmenu,Item[64]; Classmenu = menu_create("\y[\rVampire Class\y]\y:","Classhandle"); formatex(Item, charsmax(Item), "\wClasic Vampire \y[\rHp: %d||Gravity: %d\y]",get_pcvar_num(Clasichp),get_pcvar_num(Clasic_Gravity)); menu_additem(Classmenu,Item, "1"); formatex(Item, charsmax(Item), "\wBloodSucker \y[\rHp: %d||Gravity: %d\y]",get_pcvar_num(Bloodsuckerhp),get_pcvar_num(bloodsucker_gravity)); menu_additem(Classmenu,Item, "2"); formatex(Item,charsmax(Item),"\wBladeMaster \y[\rHp: %d||Gravity: %d\y]",get_pcvar_num(Blademasterhp),get_pcvar_num(blademaster_gravity)); menu_additem(Classmenu,Item, "3"); formatex(Item,charsmax(Item),"\wBloody \y[\rHp: %d||Gravity: %d\y]",get_pcvar_num(BloodyHp),get_pcvar_num(Bloody_gravity)); menu_additem(Classmenu,Item, "4"); formatex(Item,charsmax(Item),"\wNightMare \y[\rHp: %d||Gravity: %d\y}]",get_pcvar_num(Nightmarehp),get_pcvar_num(nightmare_gravity)); menu_additem(Classmenu,Item, "5"); menu_setprop(Classmenu , MPROP_EXIT , MEXIT_ALL); menu_display(id , Classmenu , 0); } 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, "%s You are now a %s", PREFIX, CLASSES[i]);
} else { client_print( id, print_chat, "%s You are already a %s", PREFIX, CLASSES[i]); } }
public SkillsToclass(id) { if(is_user_alive(id)) { if(PlayerClass[id] == CLASS_Classic) { set_user_health(id,get_pcvar_num(Clasichp)); } } }
Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team
Warning: Loose indentation on line 494
Warning: Loose indentation on line 495
Warning: Loose indentation on line 496
Warning: Loose indentation on line 497
Warning: Loose indentation on line 498
Warning: Symbol is assigned a value that is never used: "invisbletime" on line 548
Warning: Symbol is assigned a value that is never used: "revive_cost" on line 548
Header size: 1620 bytes
Code size: 16068 bytes
Data size: 13816 bytes
Stack/heap size: 16384 bytes; max. usage is unknown, due to recursion
Total requirements: 47888 bytes
7 Warnings.
Done.
|
|