16/03/2015, 11:40 AM (Última modificación: 17/03/2015, 09:21 AM por Evilz.)
Hola buenas quiero poner en el Zombie XP que cuando entren se le asigne automaticamente Nivel 1 nose como porque si no tiene que esperar asta la siguiente ronda. ayudarme porfavor esque me gustaria subir una version como actualizada arreglada aunque sea nuevo en alliedmodders
Porque al parecer no colocaste la variable de nivel
Código PHP:
public resetvars(id) { // This should only be called whenever a person connects! // Otherwise it erases a persons choices // Reset our human's variables g_zombieclassnext[id] = 0; g_humanclassnext[id] = 0; g_zombieclass[id] = 0; g_humanclass[id] = 0;
/*================================================================================ Info ==================================================================================
Zombie XP Mode by redomin8 MeRcyLeZZ coded a huuuuge portion of the code, and I learned from his genius and maybe made some changes (some was perfect)
Also, I'd very much like to thank G-Dog for all the help with creating ZP Bank, I used his code to learn nvault. Good job guys!
Thanks to AssKicR and xeroblood for making ExplodeString.
Enjoy it, take it apart, make a better one. Have fun!
// Uncomment to have an item added to zp's extra menu #define TRIGGER_ZP_ITEM
// Uncomment to use say commands like "xp", "levels", "class", etc #define TRIGGER_SAYMENU
// Uncomment if you have redomin8's [ZP] Bank - With Autosave installed (fixes spending spree bug) //#define ZP_BANK_AUTOSAVE
// Uncomment to allow experimental menu alignment //#define ZP_ALIGN_TEXT
//Uncomment to give levels to people //#define ZP_GAMERUINER
//Uncomment to automatically bind a letter to show our menu #define ZP_BINDMENU "j"
/*================================================================================ End Editable Section ================================================================================*/
#if defined TRIGGER_ZP_ITEM new g_TriggerItem #endif #if defined ZP_BANK_AUTOSAVE //compatibility with zp_banks spending spree mode native zp_bank_get_packs(id) native zp_bank_set_packs(id, value) #endif
// Plugin info static const PLUGIN_NAME[] = "ZP XP by redomin8" static const PLUGIN_VERSION[] = ""
// Forwards for our zombie plugins new g_fwRoundStart, g_fwDummyResult
// Internal variables enum pcvar { enable = 0, packslevelup //(current level) * packslevelup = price to level up } new pcvars[pcvar]; new userLevel[33], username[33][32], userNeededPacks[33] new g_modname[32] // for formating the mod name new g_maxplayers // max players counter
/*================================================================================ Required Code from zombie_plague (modified to suite the plugin) ================================================================================*/
const MAX_CLASSSES = 40
// Note: keep g_zclass_name and g_hclass_name the same array size! // Zombie Classes vars new g_zclass_name[MAX_CLASSSES][32] // name new g_zclass_info[MAX_CLASSSES][32] // description new g_zclass_model[MAX_CLASSSES][32] // player model new g_zclass_clawmodel[MAX_CLASSSES][32] // claw model new g_zclass_hp[MAX_CLASSSES] // health new g_zclass_spd[MAX_CLASSSES] // speed new g_zclass_lvl[40] // level new Float:g_zclass_grav[MAX_CLASSSES] // gravity new Float:g_zclass_kb[MAX_CLASSSES] // knockback new g_zclass_load[MAX_CLASSSES][40] // loading identifier new g_zclass_i // loaded zombie classes counter
// Human Classes vars new g_hclass_name[MAX_CLASSSES][32] // name new g_hclass_info[MAX_CLASSSES][32] // description new g_hclass_model[MAX_CLASSSES][32] // player model new g_hclass_weapons[MAX_CLASSSES][32] // claw model new g_hclass_hp[MAX_CLASSSES] // health new g_hclass_spd[MAX_CLASSSES] // speed new g_hclass_lvl[40] // level new Float:g_hclass_grav[MAX_CLASSSES] // gravity new g_hclass_load[MAX_CLASSSES][40] // loading identifier new g_hclass_i // loaded zombie classes counter
// For menu handlers #define ZCLASSES_STARTID g_menu_data[id][0] #define ZCLASSES_SELECTION (g_menu_data[id][0]+key) #define HCLASSES_STARTID g_menu_data[id][0] #define HCLASSES_SELECTION (g_menu_data[id][0]+key) new g_menu_data[33][8] // data for various menus const MENU_KEY_BACK = 7 const MENU_KEY_NEXT = 8 const MENU_KEY_EXIT = 9 const KEYSMENU = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
// Cvars new cvar_welcomemsg, cvar_removeweapons, cvar_removexp, cvar_removezombie;
// Vars new g_zombieclassnext[33] // zombie class for next infection new g_humanclassnext[33] // zombie class for next infection new g_zombieclass[33] // zombie class new g_humanclass[33] // zombie class new g_resetparams[33] // reset params? new bool:g_hclass_showmenu[33] new bool:g_zclass_showmenu[33]
const OFFSET_CSTEAMS = 114 const OFFSET_LINUX = 5 // offsets 5 higher in Linux builds enum { CS_TEAM_UNASSIGNED = 0, CS_TEAM_T, CS_TEAM_CT, CS_TEAM_SPECTATOR } new g_freezetime; // whether it's freeze time new bool:g_human[33]; // is zombie new bool:loadedZombies //bugfix for cvar_removezombies being enabled after it was disabled first (and no zombies loaded) /* --- FOR OUR HUD --- */ // Tasks for events enum (+= 100) { TASK_SHOWHUD }
/*================================================================================ Constants JUST for giving guns ================================================================================*/
// Max BP ammo for weapons new const MAXBPAMMO[] = { -1, 52, -1, 90, 1, 32, 32, 100, 90, 1, 120, 100, 100, 90, 90, 90, 100, 120, 30, 120, 200, 32, 90, 120, 90, 2, 35, 90, 90, -1, 100 }
// Additional Items to give after buying all weapons (e.g. grenades) new const g_additional_items[][] = { "weapon_hegrenade", "weapon_flashbang", "weapon_smokegrenade" }
/*================================================================================ The code starts here ================================================================================*/
#if defined TRIGGER_ZP_ITEM public zp_extra_item_selected(player, itemid) { if(itemid == g_TriggerItem) { //show the menu show_menu_game(player); } } #endif
#if defined ZP_BANK_AUTOSAVE public getAmmoPacks(id) { return zp_bank_get_packs(id); } public setAmmoPacks(id, value) { return zp_bank_set_packs(id, value); } #else public getAmmoPacks(id) { return zp_get_user_ammo_packs(id); } public setAmmoPacks(id, value) { return zp_set_user_ammo_packs(id, value); } #endif
public SetLevel(id) { //Multilang is not enabled here since I plan to remove this funtionality once this leaves BETA #if defined ZP_GAMERUINER if ( read_argc() > 3 ) return PLUGIN_HANDLED;
if ( target == 0 ) { //couldnt find them zp_colored_print(id, "^x04%s^x01 Could not find the requested user.", textHeader);
return PLUGIN_HANDLED;
} else {
//we found them! userLevel[id] = amount ShowHUD(id)
if(id == target) { zp_colored_print(id, "^x04%s^x01 You have set yourself to level %d!", textHeader, amount ); } else { new targetName[64]; get_user_name(target, targetName, 63);
zp_colored_print(id, "^x04%s^x01 You have set %s to level %d!", textHeader , targetName, amount ); zp_colored_print(target, "^x04%s^x01 You have been set to level %d!", textHeader , amount ); } return PLUGIN_HANDLED; } #else zp_colored_print(id, "^x04%s^x01 This functionality has been disabled.", textHeader); client_print(id, print_console, "^x04%s^x01 This functionality has been disabled.", textHeader); #endif return PLUGIN_HANDLED;
}
public getNeededPacks(id) { //return the packs needed for leveling up return pcvars[packslevelup] * userLevel[id] }
public SetPacksLevelUp(id, value) { //this allows the user to change the multiplier for ammo cost new arg[10], arg2 read_argv(1, arg, sizeof arg - 1)
//go through each player and change the amount required to level up for( new o = 1; o < 33; o++) { if ( !is_user_connected(o) ) continue; userNeededPacks[id] = getNeededPacks(id) } } else { //must be a positive number - PRINTS TO CONSOLE, LEAVE ALONE! zp_colored_print(id, "^x04%s^x01 %L", textHeader, id, "ERR_NEGATIVE"); client_print(id, print_console, "%s %L", textHeader, id, "ERR_NEGATIVE") }
public load_data(id) { if( get_pcvar_num(cvar_removexp) != 0) { // Do not load or save data g_hclass_showmenu[id] = true; g_zclass_showmenu[id] = true; return; }
new vaultkey[40], vaultReturn[256]; new vaultData[4][40], vaultResults[3][40];
// Get the Level format(vaultkey, sizeof vaultkey - 1, "%s_stats", username[id]); nvault_get(gvault, vaultkey, vaultReturn, sizeof vaultReturn - 1);
case VAULT_HCLASS: { // Look for our human class if( !equali(vaultResults[1], "-1") ) { for (new i2 = 0; i2 < g_hclass_i; i2++) { if( equali(vaultResults[1], g_hclass_load[i2]) ) { i_hclass_id = i2; break; } } }
if ( i_hclass_id == -1) { // Couldnt find them g_hclass_showmenu[id] = true; } else { // We found their zombie class g_humanclassnext[id] = i_hclass_id; g_hclass_showmenu[id] = false; } }
case VAULT_ZCLASS: { if( !equali(vaultResults[1], "-1") ) { for (new i2 = 0; i2 < g_zclass_i; i2++) { if( equali(vaultResults[1], g_zclass_load[i2]) ) { i_zclass_id = i2; break; } } }
public client_connect(id) { // Do we bind a key #if defined ZP_BINDMENU client_cmd(id,"bind %s ^"say xpmenu^"", ZP_BINDMENU); #endif } public client_putinserver(id) { g_variable_de_nivel[id] = 1 ; } // Reset vars resetvars(id)
// Make sure zombieplague doesnt load the last plugin as the default zombie zp_set_user_zombie_class(id, 0)
// Load their data load_data(id);
// Set amount of levels to level up (called after load_data) userNeededPacks[id] = getNeededPacks(id)
// Set the custom HUD display task set_task(1.0, "ShowHUD", id+TASK_SHOWHUD, _, _, "b") }
public client_disconnect(id) { // Save the data save_data(id);
// Remove tasks remove_task(id+TASK_SHOWHUD) }
public fw_PlayerSpawn_Post(id) { // Both humans and zombies spawn and call this // Zombies can respawn if deathmatch is enabled
//TODO: Check if this works if (zp_get_user_zombie(id)) return FMRES_IGNORED;
if (!is_user_alive(id)) // you could also use is_user_connected() return FMRES_IGNORED;
// Set selected human and zombie class g_humanclass[id] = g_humanclassnext[id] g_zombieclass[id] = g_zombieclassnext[id]
// Change the default human variables humanme(id)
// We know for sure they are a human, only give guns+speed+grav if they've picked a class if (( g_hclass_showmenu[id] == false ) && (get_pcvar_num(cvar_removeweapons) == 0)) { setHumanParameters(id) giveWeapons(id) //give weapons }
return FMRES_IGNORED; }
public event_round_start() { static team;
// Set our humans hp, speed, etc for( new o = 1; o < 33; o++) { // Not connected if ( !is_user_connected(o) ) continue;
// Not playing team = fm_get_user_team(o) if (team == CS_TEAM_SPECTATOR || team == CS_TEAM_UNASSIGNED) continue;
// Set our human vars //humanme(o)
// Our next vars are now current //g_humanclass[o] = g_humanclassnext[o] //g_zombieclass[o] = g_zombieclassnext[o]
// The round has started ExecuteForward(g_fwRoundStart, g_fwDummyResult, o); }
// Set our vars g_freezetime = true
// Do we show a welcome message? if( get_pcvar_num(cvar_welcomemsg) ) set_task(2.0, "welcome_msg") }
public zp_user_infected_pre(id, infector) { // Make sure he is not a human g_human[id] = false
// Strip his guns (so they dont fall on the floor) strip_weapons(id); }
public zp_user_infected_post(id, infector) { // Do we show the menu? if ((g_zclass_showmenu[id] == true) && get_pcvar_num(cvar_removezombie) ==0) show_menu_zclass(id);
}
public zp_user_humanized_pre(id) { // Set selected human class, incase he buys antidote g_humanclass[id] = g_humanclassnext[id]; g_zombieclass[id] = g_zombieclassnext[id]; }
public zp_user_humanized_post(id) { // Hes become human again, set our vars if( !zp_get_user_survivor(id) ) { humanme(id) setHumanParameters(id) if( get_pcvar_num(cvar_removeweapons) == 0) giveWeapons(id) //give weapons } else { // He has become a survivor g_human[id] = false }
public humanme(id) { // Set our human's height, jump, etc
if( g_hclass_showmenu[id] == true) { // They just entered, and no data was loaded for them // Show the menu (despite the fact that they are automatically lvl. 1) if (get_pcvar_num(cvar_removezombie) == 0) { set_task(0.1, "show_menu_hclass", id); } else { set_task(0.5, "show_menu_hclass", id); } }
// They are human g_human[id] = true; }
public giveWeapons(id) { // Strip weapons first strip_weapons(id);
// Give all weapons (everything is in g_hclass_weapons) static i, weaponid; for (i = 0; i < sizeof g_hclass_weapons; i++) { weaponid = g_hclass_weapons[g_humanclass[id]][i];
if (weaponid >= 1 && weaponid <= 14) { // Give main weapon give_primary_weapon(id, weaponid - 1);
} else if ( weaponid >= 15 && weaponid <= 20) { // Give secondary gun give_secondary_weapon(id, weaponid - 15);
} else if ( weaponid >= 21 && weaponid <=23) { // Give grenades fm_give_item(id, g_additional_items[weaponid - 21]);
} else { // We have given them all their item, or they dont have any return; } } }
public setHumanParameters(id) { set_pev(id, pev_gravity, g_hclass_grav[g_humanclass[id]]) fm_set_user_health(id, g_hclass_hp[g_humanclass[id]]) }
public resetvars(id) { // This should only be called whenever a person connects! // Otherwise it erases a persons choices // Reset our human's variables g_zombieclassnext[id] = 0; g_humanclassnext[id] = 0; g_zombieclass[id] = 0; g_humanclass[id] = 0;
/*================================================================================ Begin Functions from the internet ================================================================================*/
//http://forums.alliedmods.net/showthread.php?p=67207#post67207 stock ExplodeString( Output[][], Max, Size, Input[], Delimiter ) { new Idx, l = strlen(Input), Len; do Len += (1 + copyc( Output[Idx], Size, Input[Len], Delimiter )); while( (Len < l) && (++Idx < Max) ) return Idx; }
/*================================================================================ Begin Code from zombie_plague (modified to suit the plugin) ================================================================================*/
static menu[800], len, class, removexp; new curClassIcon[2];
len = 0 removexp = get_pcvar_num(cvar_removexp);
// Title len += formatex(menu[len], sizeof menu - 1 - len, "\y%L \r [%d-%d]^n^n", id, "MENU_ZCLASS_TITLE", ZCLASSES_STARTID+1, min(ZCLASSES_STARTID+7, g_zclass_i))
#if defined ZP_ALIGN_TEXT // Align text new spacers[400], g_zclass_spacers1, g_zclass_spacers2 new maxSpace1, maxSpace2, curSpace1[32], curSpace2[32]
// Get max width first for (class = ZCLASSES_STARTID; class < min(ZCLASSES_STARTID+7, g_zclass_i); class++) { formatex(spacers, sizeof spacers - 1, "%d. %s", class-ZCLASSES_STARTID+1, g_zclass_name[class])
static menu[800], len, class, removexp new curClassIcon[2] len = 0 removexp = get_pcvar_num(cvar_removexp);
// Title len += formatex(menu[len], sizeof menu - 1 - len, "\y%L \r[%d-%d]^n^n", id, "MENU_HCLASS_TITLE", HCLASSES_STARTID+1, min(HCLASSES_STARTID+7, g_hclass_i))
#if defined ZP_ALIGN_TEXT // Align text new spacers[400], g_hclass_spacers1, g_hclass_spacers2 new maxSpace1, maxSpace2, curSpace1[32], curSpace2[32]
// Get max width first for (class = HCLASSES_STARTID; class < min(HCLASSES_STARTID+7, g_hclass_i); class++) { formatex(spacers, sizeof spacers - 1, "%d. %s", class-HCLASSES_STARTID+1, g_hclass_name[class])
// 8. Back - 9. Next - 0. Exit len += formatex(menu[len], sizeof menu - 1 - len, "^n\r8.\w %L^n\r9.\w %L^n^n\r0.\w %L", id, "MENU_BACK", id, "MENU_NEXT", id, "MENU_EXIT")
show_menu(id, KEYSMENU, menu, -1, "Human Class Menu") }
/* ----------------------- Menu Handlers -------------------------*/
// Game Menu public menu_game(id, key) { if(get_pcvar_num(cvar_removexp) == 1) key++;
switch (key) { case 0: // Buy a level up { if(getAmmoPacks(id) >= getNeededPacks(id)) { setAmmoPacks(id, getAmmoPacks(id) - getNeededPacks(id)) userLevel[id] += 1 save_data(id)
// Inform the user they leveled up zp_colored_print(id, "^x04%s^x01 %L %d", textHeader, id ,"MENU_BUY_LEVEL", userLevel[id]) ShowHUD(id) } else { zp_colored_print(id, "^x04%s^x01 %L", textHeader, id ,"ERR_NOTENOUGHPACKS") }
// Return to the main xp menu show_menu_game(id);
}
case 1: // Human Classes { // Restrict it here if we wanted to show_menu_hclass(id) }
case 2: // Zombie Classes { if (get_pcvar_num(cvar_removezombie) == 0) { // Restrict it here if we wanted to show_menu_zclass(id) } } }
return PLUGIN_HANDLED; }
// Zombie Class Menu public menu_zclass(id, key) { // Special keys / items list exceeded if (key >= MENU_KEY_BACK || ZCLASSES_SELECTION >= g_zclass_i) { switch (key) { case MENU_KEY_BACK: // back { if (ZCLASSES_STARTID-7 >= 0) ZCLASSES_STARTID -= 7 } case MENU_KEY_NEXT: // next { if (ZCLASSES_STARTID+7 < g_zclass_i) ZCLASSES_STARTID += 7 } case MENU_KEY_EXIT: // exit { return PLUGIN_HANDLED; } }
// Show extra items menu again show_menu_zclass(id) return PLUGIN_HANDLED; }
// They selected their own class if (ZCLASSES_SELECTION == g_zombieclassnext[id]) { //Plugin continues if this is false (sets class info on connect) if( g_zclass_showmenu[id] == false) //when a client first connects, the menu shows all zombies as a choice even the one the client defaults to (index of 0) { // Alert them they already have chosen a zombie zp_colored_print(id, "^x04%s^x01 %L", textHeader, id, "ERR_ALREADYSELECTED") show_menu_zclass(id)
// They had already chosen this zombie, dont rerun the command return PLUGIN_HANDLED; } }
// Store selection for the next infection g_zombieclassnext[id] = ZCLASSES_SELECTION;
// Disable showing menu since theyve chosen g_zclass_showmenu[id] = false;
// Show selected zombie class info and stats zp_colored_print(id, "^x04%s^x01 %L: %s", textHeader, id, "ZOMBIE_SELECT_XP", g_zclass_name[g_zombieclassnext[id]]) zp_colored_print(id, "^x04%s^x01 %L: %d %L: %d %L: %d %L: %d%%", textHeader, id, "ZOMBIE_ATTRIB1_XP", g_zclass_hp[g_zombieclassnext[id]], id, "ZOMBIE_ATTRIB2_XP", g_zclass_spd[g_zombieclassnext[id]], id, "ZOMBIE_ATTRIB3_XP", floatround(g_zclass_grav[g_zombieclassnext[id]]*800), id, "ZOMBIE_ATTRIB4_XP", floatround(g_zclass_kb[g_zombieclassnext[id]]*100))
// Set the class for zombie plague zp_set_user_zombie_class(id, g_zombieclassnext[id])
return PLUGIN_HANDLED; }
// Human Class Menu public menu_hclass(id, key) { // Special keys / items list exceeded if (key >= MENU_KEY_BACK || HCLASSES_SELECTION >= g_hclass_i) { switch (key) { case MENU_KEY_BACK: // back { if (HCLASSES_STARTID-7 >= 0) HCLASSES_STARTID -= 7 } case MENU_KEY_NEXT: // next { if (HCLASSES_STARTID+7 < g_hclass_i) HCLASSES_STARTID += 7 } case MENU_KEY_EXIT: // exit { return PLUGIN_HANDLED; } }
// Show human list again show_menu_hclass(id) return PLUGIN_HANDLED; }
if (HCLASSES_SELECTION == g_humanclassnext[id]) { // When a client first connects, the menu shows all zombies as a choice even the one the client defaults to (index of 0) if( g_hclass_showmenu[id] == false) { // Alert them they alaerdy have chosen a zombie zp_colored_print(id, "^x04%s^x01 %L", textHeader, id, "ERR_ALREADYSELECTED") show_menu_hclass(id) return PLUGIN_HANDLED; //they had already chosen this zombie, dont rerun the command } }
// Store selection for the next infection g_humanclassnext[id] = HCLASSES_SELECTION;
// Disable showing menu since theyve chosen g_hclass_showmenu[id] = false;
// Show selected human class info and stats zp_colored_print(id, "^x04%s^x01 %L: %s", textHeader, id, "HUMAN_SELECT_XP", g_hclass_name[g_humanclassnext[id]]) zp_colored_print(id, "^x04%s^x01 %L: %d %L: %d %L: %d", textHeader, id, "HUMAN_ATTRIB1_XP", g_hclass_hp[g_humanclassnext[id]], id, "HUMAN_ATTRIB2_XP", g_hclass_spd[g_humanclassnext[id]], id, "HUMAN_ATTRIB3_XP", floatround(g_hclass_grav[g_humanclassnext[id]]*800), id)
return PLUGIN_HANDLED; }
public ShowHUD(taskid) { //if (get_pcvar_num(cvar_removexp) == 1 ) return;
static id;
// Our ID id = ID_SHOWHUD;
// Player died? if (!is_user_alive(id)) { // Get spectating target id = pev(id, PEV_SPEC_TARGET) //other persons ID
// Target not alive if (!is_user_alive(id)) return; }
// Format the classname static red, green, blue, g_name[sizeof g_hclass_name]; // Hopefully g_zclass_name and g_zclass_name will be left the same array size
if ( g_human[id] == false ) // zombies { red = 200 green = 250 blue = 0
formatex(g_name, sizeof g_name - 1, "%L", id, "HUD_ZOMBIE"); } else // humans { red = 0 green = 0 blue = 255
// Return id under which we registered the class return g_hclass_i-1; }
// Native: zpxp_register_zombie_class public native_register_zombie_class(const name[], const info[], const model[], const clawmodel[], hp, speed, Float:gravity, Float:knockback, level) { // Dont return -1, we wil get lots of server window print errors from the plugins if( get_pcvar_num(cvar_removezombie) == 2) return 0;
//Bugfix for loading zombies loadedZombies = true;
// Return id under which we registered the class return g_zclass_i-1; }
public native_register_extra_item(const name[], cost, team) { //TO DO
}
/*================================================================================ --The following are copied directly from zombie_plague, no reinventing wheels... [Shared Functions] =================================================================================*/
// Welcome Message Task public welcome_msg() { // Show mod info zp_colored_print(0, "^x04%s^x01 %L", textHeaderOrig, LANG_PLAYER, "NOTICE_INFO_XP") }
// Send to everyone if (!target) { static player for (player = 1; player <= g_maxplayers; player++) { // Not connected if (!is_user_connected(player)) continue;
// Replace LANG_PLAYER with player id for (i = 2; i < argscount; i++) { if (getarg(i) == LANG_PLAYER) { setarg(i, 0, player) changed[changedcount] = i changedcount++ } }
// Format message for player vformat(buffer, sizeof buffer - 1, message, 3)
// Send it message_begin(MSG_ONE, g_msgSayText, _, player) write_byte(player) write_string(buffer) message_end()
// Replace back player id's with LANG_PLAYER for (i = 0; i < changedcount; i++) setarg(changed[i], 0, LANG_PLAYER) } }
// Send to specific target else { // Replace LANG_PLAYER with player id for (i = 2; i < argscount; i++) { if (getarg(i) == LANG_PLAYER) setarg(i, 0, target) }
// Format message for player vformat(buffer, sizeof buffer - 1, message, 3)
/*================================================================================ Code JUST for giving guns ================================================================================*/
// Drop primary/secondary weapons stock drop_weapons(id, dropwhat) { // Get user weapons static weapons[32], num, i, weaponid num = 0 // reset passed weapons count (bugfix) get_user_weapons(id, weapons, num)
// Loop through them and drop primaries or secondaries for (i = 0; i < num; i++) { // Prevent re-indexing the array weaponid = weapons[i]
// Hack: store weapon bpammo on PEV_ADDITIONAL_AMMO set_pev(weapon_ent, PEV_ADDITIONAL_AMMO, fm_get_user_bpammo(id, weaponid))
// Player drops the weapon and looses his bpammo engclient_cmd(id, "drop", wname) fm_set_user_bpammo(id, weaponid, 0) } } }
// Set User BP Ammo stock fm_set_user_bpammo(id, weapon, amount) { static offset
switch(weapon) { case CSW_AWP: offset = OFFSET_AWM_AMMO; case CSW_SCOUT,CSW_AK47,CSW_G3SG1: offset = OFFSET_SCOUT_AMMO; case CSW_M249: offset = OFFSET_PARA_AMMO; case CSW_M4A1,CSW_FAMAS,CSW_AUG,CSW_SG550,CSW_GALI,CSW_SG552: offset = OFFSET_FAMAS_AMMO; case CSW_M3,CSW_XM1014: offset = OFFSET_M3_AMMO; case CSW_USP,CSW_UMP45,CSW_MAC10: offset = OFFSET_USP_AMMO; case CSW_FIVESEVEN,CSW_P90: offset = OFFSET_FIVESEVEN_AMMO; case CSW_DEAGLE: offset = OFFSET_DEAGLE_AMMO; case CSW_P228: offset = OFFSET_P228_AMMO; case CSW_GLOCK18,CSW_MP5NAVY,CSW_TMP,CSW_ELITE: offset = OFFSET_GLOCK_AMMO; case CSW_FLASHBANG: offset = OFFSET_FLASH_AMMO; case CSW_HEGRENADE: offset = OFFSET_HE_AMMO; case CSW_SMOKEGRENADE: offset = OFFSET_SMOKE_AMMO; case CSW_C4: offset = OFFSET_C4_AMMO; default: return; }
set_pdata_int(id, offset, amount, OFFSET_LINUX) }
// Get User BP Ammo stock fm_get_user_bpammo(id, weapon) { static offset
switch(weapon) { case CSW_AWP: offset = OFFSET_AWM_AMMO; case CSW_SCOUT,CSW_AK47,CSW_G3SG1: offset = OFFSET_SCOUT_AMMO; case CSW_M249: offset = OFFSET_PARA_AMMO; case CSW_M4A1,CSW_FAMAS,CSW_AUG,CSW_SG550,CSW_GALI,CSW_SG552: offset = OFFSET_FAMAS_AMMO; case CSW_M3,CSW_XM1014: offset = OFFSET_M3_AMMO; case CSW_USP,CSW_UMP45,CSW_MAC10: offset = OFFSET_USP_AMMO; case CSW_FIVESEVEN,CSW_P90: offset = OFFSET_FIVESEVEN_AMMO; case CSW_DEAGLE: offset = OFFSET_DEAGLE_AMMO; case CSW_P228: offset = OFFSET_P228_AMMO; case CSW_GLOCK18,CSW_MP5NAVY,CSW_TMP,CSW_ELITE: offset = OFFSET_GLOCK_AMMO; case CSW_FLASHBANG: offset = OFFSET_FLASH_AMMO; case CSW_HEGRENADE: offset = OFFSET_HE_AMMO; case CSW_SMOKEGRENADE: offset = OFFSET_SMOKE_AMMO; case CSW_C4: offset = OFFSET_C4_AMMO; default: return -1; }
return get_pdata_int(id, offset, OFFSET_LINUX); }
// Give an item to a player (from fakemeta_util) stock fm_give_item(id, const item[]) { static ent ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item)) if (!pev_valid(ent)) return;
static save save = pev(ent, pev_solid) dllfunc(DLLFunc_Touch, ent, id) if (pev(ent, pev_solid) != save) return;
engfunc(EngFunc_RemoveEntity, ent) }
// Strip user weapons (from fakemeta_util) stock fm_strip_user_weapons(id) { static ent ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "player_weaponstrip")) if (!pev_valid(ent)) return;
// Strip off from weapons fm_strip_user_weapons(id) fm_give_item(id, "weapon_knife") }
// Buy Primary Weapon give_primary_weapon(id, key) { // Get weapon index static weaponid weaponid = get_weaponid(g_primary_items[key])
// Give the new weapon fm_give_item(id, g_primary_items[key]) fm_set_user_bpammo(id, weaponid, MAXBPAMMO[key])
/* // Give additional items static i for (i = 0; i < sizeof g_additional_items; i++) fm_give_item(id, g_additional_items[i]) */ }
give_secondary_weapon(id, key) { // Get weapon index static weaponid weaponid = get_weaponid(g_secondary_items[key])
// Give the new weapon with full ammo fm_give_item(id, g_secondary_items[key]) fm_set_user_bpammo(id, weaponid, MAXBPAMMO[weaponid]) }
/*================================================================================ End Code just for giving guns ================================================================================*/
public client_connect(id) { // Do we bind a key #if defined ZP_BINDMENU client_cmd(id,"bind %s ^"say xpmenu^"", ZP_BINDMENU); #endif } public client_putinserver(id) { g_variable_de_nivel[id] = 1 ; } // Reset vars resetvars(id)
// Make sure zombieplague doesnt load the last plugin as the default zombie zp_set_user_zombie_class(id, 0)
// Load their data load_data(id);
// Set amount of levels to level up (called after load_data) userNeededPacks[id] = getNeededPacks(id)
// Set the custom HUD display task set_task(1.0, "ShowHUD", id+TASK_SHOWHUD, _, _, "b") }
(03/08/2018, 03:13 PM)Skylar escribió: Está bien que pidas ayudas, pero no para que crees 20 post todos los días mogolico de mierda, me tenes re podrido ya, contraté 10000 sicarios para que te busquen y te maten toda la familia, y a vos que te revienten con una bazooka.
public client_connect(id) { // Do we bind a key #if defined ZP_BINDMENU client_cmd(id,"bind %s ^"say xpmenu^"", ZP_BINDMENU); #endif } public client_putinserver(id) { g_variable_de_nivel[id] = 1 ; } // Reset vars resetvars(id)
// Make sure zombieplague doesnt load the last plugin as the default zombie zp_set_user_zombie_class(id, 0)
// Load their data load_data(id);
// Set amount of levels to level up (called after load_data) userNeededPacks[id] = getNeededPacks(id)
// Set the custom HUD display task set_task(1.0, "ShowHUD", id+TASK_SHOWHUD, _, _, "b") }
Código PHP:
g_variable_de_nivel[id] = 1 ;
Código PHP:
userLevel[id] = 1 ;
NO... lee bien el código.
Aquí esta y debe de funcionar... y da una leída a las guías del foro
/*===============================================================================?= Info ================================================================================?==
Zombie XP Mode by redomin8 MeRcyLeZZ coded a huuuuge portion of the code, and I learned from his genius and maybe made some changes (some was perfect)
Also, I'd very much like to thank G-Dog for all the help with creating ZP Bank, I used his code to learn nvault. Good job guys!
Thanks to AssKicR and xeroblood for making ExplodeString.
Enjoy it, take it apart, make a better one. Have fun!
// Uncomment to have an item added to zp's extra menu #define TRIGGER_ZP_ITEM
// Uncomment to use say commands like "xp", "levels", "class", etc #define TRIGGER_SAYMENU
// Uncomment if you have redomin8's [ZP] Bank - With Autosave installed (fixes spending spree bug) //#define ZP_BANK_AUTOSAVE
// Uncomment to allow experimental menu alignment //#define ZP_ALIGN_TEXT
//Uncomment to give levels to people //#define ZP_GAMERUINER
//Uncomment to automatically bind a letter to show our menu #define ZP_BINDMENU "j"
/*===============================================================================?= End Editable Section ================================================================================?*/
#if defined TRIGGER_ZP_ITEM new g_TriggerItem #endif #if defined ZP_BANK_AUTOSAVE //compatibility with zp_banks spending spree mode native zp_bank_get_packs(id) native zp_bank_set_packs(id, value) #endif
// Plugin info static const PLUGIN_NAME[] = "ZP XP by redomin8" static const PLUGIN_VERSION[] = ""
// Forwards for our zombie plugins new g_fwRoundStart, g_fwDummyResult
// Internal variables enum pcvar { enable = 0, packslevelup //(current level) * packslevelup = price to level up } new pcvars[pcvar]; new userLevel[33], username[33][32], userNeededPacks[33] new g_modname[32] // for formating the mod name new g_maxplayers // max players counter
/*===============================================================================?= Required Code from zombie_plague (modified to suite the plugin) ================================================================================?*/
const MAX_CLASSSES = 40
// Note: keep g_zclass_name and g_hclass_name the same array size! // Zombie Classes vars new g_zclass_name[MAX_CLASSSES][32] // name new g_zclass_info[MAX_CLASSSES][32] // description new g_zclass_model[MAX_CLASSSES][32] // player model new g_zclass_clawmodel[MAX_CLASSSES][32] // claw model new g_zclass_hp[MAX_CLASSSES] // health new g_zclass_spd[MAX_CLASSSES] // speed new g_zclass_lvl[40] // level new Float:g_zclass_grav[MAX_CLASSSES] // gravity new Float:g_zclass_kb[MAX_CLASSSES] // knockback new g_zclass_load[MAX_CLASSSES][40] // loading identifier new g_zclass_i // loaded zombie classes counter
// Human Classes vars new g_hclass_name[MAX_CLASSSES][32] // name new g_hclass_info[MAX_CLASSSES][32] // description new g_hclass_model[MAX_CLASSSES][32] // player model new g_hclass_weapons[MAX_CLASSSES][32] // claw model new g_hclass_hp[MAX_CLASSSES] // health new g_hclass_spd[MAX_CLASSSES] // speed new g_hclass_lvl[40] // level new Float:g_hclass_grav[MAX_CLASSSES] // gravity new g_hclass_load[MAX_CLASSSES][40] // loading identifier new g_hclass_i // loaded zombie classes counter
// For menu handlers #define ZCLASSES_STARTID g_menu_data[id][0] #define ZCLASSES_SELECTION (g_menu_data[id][0]+key) #define HCLASSES_STARTID g_menu_data[id][0] #define HCLASSES_SELECTION (g_menu_data[id][0]+key) new g_menu_data[33][8] // data for various menus const MENU_KEY_BACK = 7 const MENU_KEY_NEXT = 8 const MENU_KEY_EXIT = 9 const KEYSMENU = (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
// Cvars new cvar_welcomemsg, cvar_removeweapons, cvar_removexp, cvar_removezombie;
// Vars new g_zombieclassnext[33] // zombie class for next infection new g_humanclassnext[33] // zombie class for next infection new g_zombieclass[33] // zombie class new g_humanclass[33] // zombie class new g_resetparams[33] // reset params? new bool:g_hclass_showmenu[33] new bool:g_zclass_showmenu[33]
const OFFSET_CSTEAMS = 114 const OFFSET_LINUX = 5 // offsets 5 higher in Linux builds enum { CS_TEAM_UNASSIGNED = 0, CS_TEAM_T, CS_TEAM_CT, CS_TEAM_SPECTATOR } new g_freezetime; // whether it's freeze time new bool:g_human[33]; // is zombie new bool:loadedZombies //bugfix for cvar_removezombies being enabled after it was disabled first (and no zombies loaded) /* --- FOR OUR HUD --- */ // Tasks for events enum (+= 100) { TASK_SHOWHUD }
/*===============================================================================?= Constants JUST for giving guns ================================================================================?*/
// Max BP ammo for weapons new const MAXBPAMMO[] = { -1, 52, -1, 90, 1, 32, 32, 100, 90, 1, 120, 100, 100, 90, 90, 90, 100, 120, 30, 120, 200, 32, 90, 120, 90, 2, 35, 90, 90, -1, 100 }
// Additional Items to give after buying all weapons (e.g. grenades) new const g_additional_items[][] = { "weapon_hegrenade", "weapon_flashbang", "weapon_smokegrenade" }
/*===============================================================================?= The code starts here ================================================================================?*/
#if defined TRIGGER_ZP_ITEM public zp_extra_item_selected(player, itemid) { if(itemid == g_TriggerItem) { //show the menu show_menu_game(player); } } #endif
#if defined ZP_BANK_AUTOSAVE public getAmmoPacks(id) { return zp_bank_get_packs(id); } public setAmmoPacks(id, value) { return zp_bank_set_packs(id, value); } #else public getAmmoPacks(id) { return zp_get_user_ammo_packs(id); } public setAmmoPacks(id, value) { return zp_set_user_ammo_packs(id, value); } #endif
public SetLevel(id) { //Multilang is not enabled here since I plan to remove this funtionality once this leaves BETA #if defined ZP_GAMERUINER if ( read_argc() > 3 ) return PLUGIN_HANDLED;
if ( target == 0 ) { //couldnt find them zp_colored_print(id, "^x04%s^x01 Could not find the requested user.", textHeader);
return PLUGIN_HANDLED;
} else {
//we found them! userLevel[id] = amount ShowHUD(id)
if(id == target) { zp_colored_print(id, "^x04%s^x01 You have set yourself to level %d!", textHeader, amount ); } else { new targetName[64]; get_user_name(target, targetName, 63);
zp_colored_print(id, "^x04%s^x01 You have set %s to level %d!", textHeader , targetName, amount ); zp_colored_print(target, "^x04%s^x01 You have been set to level %d!", textHeader , amount ); } return PLUGIN_HANDLED; } #else zp_colored_print(id, "^x04%s^x01 This functionality has been disabled.", textHeader); client_print(id, print_console, "^x04%s^x01 This functionality has been disabled.", textHeader); #endif return PLUGIN_HANDLED;
}
public getNeededPacks(id) { //return the packs needed for leveling up return pcvars[packslevelup] * userLevel[id] }
public SetPacksLevelUp(id, value) { //this allows the user to change the multiplier for ammo cost new arg[10], arg2 read_argv(1, arg, sizeof arg - 1)
//go through each player and change the amount required to level up for( new o = 1; o < 33; o++) { if ( !is_user_connected(o) ) continue; userNeededPacks[id] = getNeededPacks(id) } } else { //must be a positive number - PRINTS TO CONSOLE, LEAVE ALONE! zp_colored_print(id, "^x04%s^x01 %L", textHeader, id, "ERR_NEGATIVE"); client_print(id, print_console, "%s %L", textHeader, id, "ERR_NEGATIVE") }
public load_data(id) { if( get_pcvar_num(cvar_removexp) != 0) { // Do not load or save data g_hclass_showmenu[id] = true; g_zclass_showmenu[id] = true; return; }
new vaultkey[40], vaultReturn[256]; new vaultData[4][40], vaultResults[3][40];
// Get the Level format(vaultkey, sizeof vaultkey - 1, "%s_stats", username[id]); nvault_get(gvault, vaultkey, vaultReturn, sizeof vaultReturn - 1);
case VAULT_HCLASS: { // Look for our human class if( !equali(vaultResults[1], "-1") ) { for (new i2 = 0; i2 < g_hclass_i; i2++) { if( equali(vaultResults[1], g_hclass_load[i2]) ) { i_hclass_id = i2; break; } } }
if ( i_hclass_id == -1) { // Couldnt find them g_hclass_showmenu[id] = true; } else { // We found their zombie class g_humanclassnext[id] = i_hclass_id; g_hclass_showmenu[id] = false; } }
case VAULT_ZCLASS: { if( !equali(vaultResults[1], "-1") ) { for (new i2 = 0; i2 < g_zclass_i; i2++) { if( equali(vaultResults[1], g_zclass_load[i2]) ) { i_zclass_id = i2; break; } } }
public client_connect(id) { // Do we bind a key #if defined ZP_BINDMENU client_cmd(id,"bind %s ^"say xpmenu^"", ZP_BINDMENU); #endif } public client_putinserver(id) { // Reset vars resetvars(id)
// Make sure zombieplague doesnt load the last plugin as the default zombie zp_set_user_zombie_class(id, 0)
// Load their data load_data(id);
// Set amount of levels to level up (called after load_data) userNeededPacks[id] = getNeededPacks(id)
// Set the custom HUD display task set_task(1.0, "ShowHUD", id+TASK_SHOWHUD, _, _, "b") }
public client_disconnect(id) { // Save the data save_data(id);
// Remove tasks remove_task(id+TASK_SHOWHUD) }
public fw_PlayerSpawn_Post(id) { // Both humans and zombies spawn and call this // Zombies can respawn if deathmatch is enabled
//TODO: Check if this works if (zp_get_user_zombie(id)) return FMRES_IGNORED;
if (!is_user_alive(id)) // you could also use is_user_connected() return FMRES_IGNORED;
// Set selected human and zombie class g_humanclass[id] = g_humanclassnext[id] g_zombieclass[id] = g_zombieclassnext[id]
// Change the default human variables humanme(id)
// We know for sure they are a human, only give guns+speed+grav if they've picked a class if (( g_hclass_showmenu[id] == false ) && (get_pcvar_num(cvar_removeweapons) == 0)) { setHumanParameters(id) giveWeapons(id) //give weapons }
return FMRES_IGNORED; }
public event_round_start() { static team;
// Set our humans hp, speed, etc for( new o = 1; o < 33; o++) { // Not connected if ( !is_user_connected(o) ) continue;
// Not playing team = fm_get_user_team(o) if (team == CS_TEAM_SPECTATOR || team == CS_TEAM_UNASSIGNED) continue;
// Set our human vars //humanme(o)
// Our next vars are now current //g_humanclass[o] = g_humanclassnext[o] //g_zombieclass[o] = g_zombieclassnext[o]
// The round has started ExecuteForward(g_fwRoundStart, g_fwDummyResult, o); }
// Set our vars g_freezetime = true
// Do we show a welcome message? if( get_pcvar_num(cvar_welcomemsg) ) set_task(2.0, "welcome_msg") }
public zp_user_infected_pre(id, infector) { // Make sure he is not a human g_human[id] = false
// Strip his guns (so they dont fall on the floor) strip_weapons(id); }
public zp_user_infected_post(id, infector) { // Do we show the menu? if ((g_zclass_showmenu[id] == true) && get_pcvar_num(cvar_removezombie) ==0) show_menu_zclass(id);
}
public zp_user_humanized_pre(id) { // Set selected human class, incase he buys antidote g_humanclass[id] = g_humanclassnext[id]; g_zombieclass[id] = g_zombieclassnext[id]; }
public zp_user_humanized_post(id) { // Hes become human again, set our vars if( !zp_get_user_survivor(id) ) { humanme(id) setHumanParameters(id) if( get_pcvar_num(cvar_removeweapons) == 0) giveWeapons(id) //give weapons } else { // He has become a survivor g_human[id] = false }
public humanme(id) { // Set our human's height, jump, etc
if( g_hclass_showmenu[id] == true) { // They just entered, and no data was loaded for them // Show the menu (despite the fact that they are automatically lvl. 1) if (get_pcvar_num(cvar_removezombie) == 0) { set_task(0.1, "show_menu_hclass", id); } else { set_task(0.5, "show_menu_hclass", id); } }
// They are human g_human[id] = true; }
public giveWeapons(id) { // Strip weapons first strip_weapons(id);
// Give all weapons (everything is in g_hclass_weapons) static i, weaponid; for (i = 0; i < sizeof g_hclass_weapons; i++) { weaponid = g_hclass_weapons[g_humanclass[id]][i];
if (weaponid >= 1 && weaponid <= 14) { // Give main weapon give_primary_weapon(id, weaponid - 1);
} else if ( weaponid >= 15 && weaponid <= 20) { // Give secondary gun give_secondary_weapon(id, weaponid - 15);
} else if ( weaponid >= 21 && weaponid <=23) { // Give grenades fm_give_item(id, g_additional_items[weaponid - 21]);
} else { // We have given them all their item, or they dont have any return; } } }
public setHumanParameters(id) { set_pev(id, pev_gravity, g_hclass_grav[g_humanclass[id]]) fm_set_user_health(id, g_hclass_hp[g_humanclass[id]]) }
public resetvars(id) { // This should only be called whenever a person connects! // Otherwise it erases a persons choices // Reset our human's variables g_zombieclassnext[id] = 0; g_humanclassnext[id] = 0; g_zombieclass[id] = 0; g_humanclass[id] = 0;
/*===============================================================================?= Begin Functions from the internet ================================================================================?*/
//http://forums.alliedmods.net/showthread.php?p=67207#post67207 stock ExplodeString( Output[][], Max, Size, Input[], Delimiter ) { new Idx, l = strlen(Input), Len; do Len += (1 + copyc( Output[Idx], Size, Input[Len], Delimiter )); while( (Len < l) && (++Idx < Max) ) return Idx; }
/*===============================================================================?= Begin Code from zombie_plague (modified to suit the plugin) ================================================================================?*/
static menu[800], len, class, removexp; new curClassIcon[2];
len = 0 removexp = get_pcvar_num(cvar_removexp);
// Title len += formatex(menu[len], sizeof menu - 1 - len, "\y%L \r [%d-%d]^n^n", id, "MENU_ZCLASS_TITLE", ZCLASSES_STARTID+1, min(ZCLASSES_STARTID+7, g_zclass_i))
#if defined ZP_ALIGN_TEXT // Align text new spacers[400], g_zclass_spacers1, g_zclass_spacers2 new maxSpace1, maxSpace2, curSpace1[32], curSpace2[32]
// Get max width first for (class = ZCLASSES_STARTID; class < min(ZCLASSES_STARTID+7, g_zclass_i); class++) { formatex(spacers, sizeof spacers - 1, "%d. %s", class-ZCLASSES_STARTID+1, g_zclass_name[class])
static menu[800], len, class, removexp new curClassIcon[2] len = 0 removexp = get_pcvar_num(cvar_removexp);
// Title len += formatex(menu[len], sizeof menu - 1 - len, "\y%L \r[%d-%d]^n^n", id, "MENU_HCLASS_TITLE", HCLASSES_STARTID+1, min(HCLASSES_STARTID+7, g_hclass_i))
#if defined ZP_ALIGN_TEXT // Align text new spacers[400], g_hclass_spacers1, g_hclass_spacers2 new maxSpace1, maxSpace2, curSpace1[32], curSpace2[32]
// Get max width first for (class = HCLASSES_STARTID; class < min(HCLASSES_STARTID+7, g_hclass_i); class++) { formatex(spacers, sizeof spacers - 1, "%d. %s", class-HCLASSES_STARTID+1, g_hclass_name[class])
// 8. Back - 9. Next - 0. Exit len += formatex(menu[len], sizeof menu - 1 - len, "^n\r8.\w %L^n\r9.\w %L^n^n\r0.\w %L", id, "MENU_BACK", id, "MENU_NEXT", id, "MENU_EXIT")
show_menu(id, KEYSMENU, menu, -1, "Human Class Menu") }
/* ----------------------- Menu Handlers -------------------------*/
// Game Menu public menu_game(id, key) { if(get_pcvar_num(cvar_removexp) == 1) key++;
switch (key) { case 0: // Buy a level up { if(getAmmoPacks(id) >= getNeededPacks(id)) { setAmmoPacks(id, getAmmoPacks(id) - getNeededPacks(id)) userLevel[id] += 1 save_data(id)
// Inform the user they leveled up zp_colored_print(id, "^x04%s^x01 %L %d", textHeader, id ,"MENU_BUY_LEVEL", userLevel[id]) ShowHUD(id) } else { zp_colored_print(id, "^x04%s^x01 %L", textHeader, id ,"ERR_NOTENOUGHPACKS") }
// Return to the main xp menu show_menu_game(id);
}
case 1: // Human Classes { // Restrict it here if we wanted to show_menu_hclass(id) }
case 2: // Zombie Classes { if (get_pcvar_num(cvar_removezombie) == 0) { // Restrict it here if we wanted to show_menu_zclass(id) } } }
return PLUGIN_HANDLED; }
// Zombie Class Menu public menu_zclass(id, key) { // Special keys / items list exceeded if (key >= MENU_KEY_BACK || ZCLASSES_SELECTION >= g_zclass_i) { switch (key) { case MENU_KEY_BACK: // back { if (ZCLASSES_STARTID-7 >= 0) ZCLASSES_STARTID -= 7 } case MENU_KEY_NEXT: // next { if (ZCLASSES_STARTID+7 < g_zclass_i) ZCLASSES_STARTID += 7 } case MENU_KEY_EXIT: // exit { return PLUGIN_HANDLED; } }
// Show extra items menu again show_menu_zclass(id) return PLUGIN_HANDLED; }
// They selected their own class if (ZCLASSES_SELECTION == g_zombieclassnext[id]) { //Plugin continues if this is false (sets class info on connect) if( g_zclass_showmenu[id] == false) //when a client first connects, the menu shows all zombies as a choice even the one the client defaults to (index of 0) { // Alert them they already have chosen a zombie zp_colored_print(id, "^x04%s^x01 %L", textHeader, id, "ERR_ALREADYSELECTED") show_menu_zclass(id)
// They had already chosen this zombie, dont rerun the command return PLUGIN_HANDLED; } }
// Store selection for the next infection g_zombieclassnext[id] = ZCLASSES_SELECTION;
// Disable showing menu since theyve chosen g_zclass_showmenu[id] = false;
// Show selected zombie class info and stats zp_colored_print(id, "^x04%s^x01 %L: %s", textHeader, id, "ZOMBIE_SELECT_XP", g_zclass_name[g_zombieclassnext[id]]) zp_colored_print(id, "^x04%s^x01 %L: %d %L: %d %L: %d %L: %d%%", textHeader, id, "ZOMBIE_ATTRIB1_XP", g_zclass_hp[g_zombieclassnext[id]], id, "ZOMBIE_ATTRIB2_XP", g_zclass_spd[g_zombieclassnext[id]], id, "ZOMBIE_ATTRIB3_XP", floatround(g_zclass_grav[g_zombieclassnext[id]]*800), id, "ZOMBIE_ATTRIB4_XP", floatround(g_zclass_kb[g_zombieclassnext[id]]*100))
// Set the class for zombie plague zp_set_user_zombie_class(id, g_zombieclassnext[id])
return PLUGIN_HANDLED; }
// Human Class Menu public menu_hclass(id, key) { // Special keys / items list exceeded if (key >= MENU_KEY_BACK || HCLASSES_SELECTION >= g_hclass_i) { switch (key) { case MENU_KEY_BACK: // back { if (HCLASSES_STARTID-7 >= 0) HCLASSES_STARTID -= 7 } case MENU_KEY_NEXT: // next { if (HCLASSES_STARTID+7 < g_hclass_i) HCLASSES_STARTID += 7 } case MENU_KEY_EXIT: // exit { return PLUGIN_HANDLED; } }
// Show human list again show_menu_hclass(id) return PLUGIN_HANDLED; }
if (HCLASSES_SELECTION == g_humanclassnext[id]) { // When a client first connects, the menu shows all zombies as a choice even the one the client defaults to (index of 0) if( g_hclass_showmenu[id] == false) { // Alert them they alaerdy have chosen a zombie zp_colored_print(id, "^x04%s^x01 %L", textHeader, id, "ERR_ALREADYSELECTED") show_menu_hclass(id) return PLUGIN_HANDLED; //they had already chosen this zombie, dont rerun the command } }
// Store selection for the next infection g_humanclassnext[id] = HCLASSES_SELECTION;
// Disable showing menu since theyve chosen g_hclass_showmenu[id] = false;
// Show selected human class info and stats zp_colored_print(id, "^x04%s^x01 %L: %s", textHeader, id, "HUMAN_SELECT_XP", g_hclass_name[g_humanclassnext[id]]) zp_colored_print(id, "^x04%s^x01 %L: %d %L: %d %L: %d", textHeader, id, "HUMAN_ATTRIB1_XP", g_hclass_hp[g_humanclassnext[id]], id, "HUMAN_ATTRIB2_XP", g_hclass_spd[g_humanclassnext[id]], id, "HUMAN_ATTRIB3_XP", floatround(g_hclass_grav[g_humanclassnext[id]]*800), id)
return PLUGIN_HANDLED; }
public ShowHUD(taskid) { //if (get_pcvar_num(cvar_removexp) == 1 ) return;
static id;
// Our ID id = ID_SHOWHUD;
// Player died? if (!is_user_alive(id)) { // Get spectating target id = pev(id, PEV_SPEC_TARGET) //other persons ID
// Target not alive if (!is_user_alive(id)) return; }
// Format the classname static red, green, blue, g_name[sizeof g_hclass_name]; // Hopefully g_zclass_name and g_zclass_name will be left the same array size
if ( g_human[id] == false ) // zombies { red = 200 green = 250 blue = 0
formatex(g_name, sizeof g_name - 1, "%L", id, "HUD_ZOMBIE"); } else // humans { red = 0 green = 0 blue = 255
// Return id under which we registered the class return g_hclass_i-1; }
// Native: zpxp_register_zombie_class public native_register_zombie_class(const name[], const info[], const model[], const clawmodel[], hp, speed, Float:gravity, Float:knockback, level) { // Dont return -1, we wil get lots of server window print errors from the plugins if( get_pcvar_num(cvar_removezombie) == 2) return 0;
//Bugfix for loading zombies loadedZombies = true;
// Return id under which we registered the class return g_zclass_i-1; }
public native_register_extra_item(const name[], cost, team) { //TO DO
}
/*===============================================================================?= --The following are copied directly from zombie_plague, no reinventing wheels... [Shared Functions] ================================================================================?=*/
// Welcome Message Task public welcome_msg() { // Show mod info zp_colored_print(0, "^x04%s^x01 %L", textHeaderOrig, LANG_PLAYER, "NOTICE_INFO_XP") }
// Send to everyone if (!target) { static player for (player = 1; player <= g_maxplayers; player++) { // Not connected if (!is_user_connected(player)) continue;
// Replace LANG_PLAYER with player id for (i = 2; i < argscount; i++) { if (getarg(i) == LANG_PLAYER) { setarg(i, 0, player) changed[changedcount] = i changedcount++ } }
// Format message for player vformat(buffer, sizeof buffer - 1, message, 3)
// Send it message_begin(MSG_ONE, g_msgSayText, _, player) write_byte(player) write_string(buffer) message_end()
// Replace back player id's with LANG_PLAYER for (i = 0; i < changedcount; i++) setarg(changed[i], 0, LANG_PLAYER) } }
// Send to specific target else { // Replace LANG_PLAYER with player id for (i = 2; i < argscount; i++) { if (getarg(i) == LANG_PLAYER) setarg(i, 0, target) }
// Format message for player vformat(buffer, sizeof buffer - 1, message, 3)
/*===============================================================================?= Code JUST for giving guns ================================================================================?*/
// Drop primary/secondary weapons stock drop_weapons(id, dropwhat) { // Get user weapons static weapons[32], num, i, weaponid num = 0 // reset passed weapons count (bugfix) get_user_weapons(id, weapons, num)
// Loop through them and drop primaries or secondaries for (i = 0; i < num; i++) { // Prevent re-indexing the array weaponid = weapons[i]
// Hack: store weapon bpammo on PEV_ADDITIONAL_AMMO set_pev(weapon_ent, PEV_ADDITIONAL_AMMO, fm_get_user_bpammo(id, weaponid))
// Player drops the weapon and looses his bpammo engclient_cmd(id, "drop", wname) fm_set_user_bpammo(id, weaponid, 0) } } }
// Set User BP Ammo stock fm_set_user_bpammo(id, weapon, amount) { static offset
switch(weapon) { case CSW_AWP: offset = OFFSET_AWM_AMMO; case CSW_SCOUT,CSW_AK47,CSW_G3SG1: offset = OFFSET_SCOUT_AMMO; case CSW_M249: offset = OFFSET_PARA_AMMO; case CSW_M4A1,CSW_FAMAS,CSW_AUG,CSW_SG550,CSW_GALI,CSW_SG552: offset = OFFSET_FAMAS_AMMO; case CSW_M3,CSW_XM1014: offset = OFFSET_M3_AMMO; case CSW_USP,CSW_UMP45,CSW_MAC10: offset = OFFSET_USP_AMMO; case CSW_FIVESEVEN,CSW_P90: offset = OFFSET_FIVESEVEN_AMMO; case CSW_DEAGLE: offset = OFFSET_DEAGLE_AMMO; case CSW_P228: offset = OFFSET_P228_AMMO; case CSW_GLOCK18,CSW_MP5NAVY,CSW_TMP,CSW_ELITE: offset = OFFSET_GLOCK_AMMO; case CSW_FLASHBANG: offset = OFFSET_FLASH_AMMO; case CSW_HEGRENADE: offset = OFFSET_HE_AMMO; case CSW_SMOKEGRENADE: offset = OFFSET_SMOKE_AMMO; case CSW_C4: offset = OFFSET_C4_AMMO; default: return; }
set_pdata_int(id, offset, amount, OFFSET_LINUX) }
// Get User BP Ammo stock fm_get_user_bpammo(id, weapon) { static offset
switch(weapon) { case CSW_AWP: offset = OFFSET_AWM_AMMO; case CSW_SCOUT,CSW_AK47,CSW_G3SG1: offset = OFFSET_SCOUT_AMMO; case CSW_M249: offset = OFFSET_PARA_AMMO; case CSW_M4A1,CSW_FAMAS,CSW_AUG,CSW_SG550,CSW_GALI,CSW_SG552: offset = OFFSET_FAMAS_AMMO; case CSW_M3,CSW_XM1014: offset = OFFSET_M3_AMMO; case CSW_USP,CSW_UMP45,CSW_MAC10: offset = OFFSET_USP_AMMO; case CSW_FIVESEVEN,CSW_P90: offset = OFFSET_FIVESEVEN_AMMO; case CSW_DEAGLE: offset = OFFSET_DEAGLE_AMMO; case CSW_P228: offset = OFFSET_P228_AMMO; case CSW_GLOCK18,CSW_MP5NAVY,CSW_TMP,CSW_ELITE: offset = OFFSET_GLOCK_AMMO; case CSW_FLASHBANG: offset = OFFSET_FLASH_AMMO; case CSW_HEGRENADE: offset = OFFSET_HE_AMMO; case CSW_SMOKEGRENADE: offset = OFFSET_SMOKE_AMMO; case CSW_C4: offset = OFFSET_C4_AMMO; default: return -1; }
return get_pdata_int(id, offset, OFFSET_LINUX); }
// Give an item to a player (from fakemeta_util) stock fm_give_item(id, const item[]) { static ent ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, item)) if (!pev_valid(ent)) return;
static save save = pev(ent, pev_solid) dllfunc(DLLFunc_Touch, ent, id) if (pev(ent, pev_solid) != save) return;
engfunc(EngFunc_RemoveEntity, ent) }
// Strip user weapons (from fakemeta_util) stock fm_strip_user_weapons(id) { static ent ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "player_weaponstrip")) if (!pev_valid(ent)) return;
// Strip off from weapons fm_strip_user_weapons(id) fm_give_item(id, "weapon_knife") }
// Buy Primary Weapon give_primary_weapon(id, key) { // Get weapon index static weaponid weaponid = get_weaponid(g_primary_items[key])
// Give the new weapon fm_give_item(id, g_primary_items[key]) fm_set_user_bpammo(id, weaponid, MAXBPAMMO[key])
/* // Give additional items static i for (i = 0; i < sizeof g_additional_items; i++) fm_give_item(id, g_additional_items[i]) */ }
give_secondary_weapon(id, key) { // Get weapon index static weaponid weaponid = get_weaponid(g_secondary_items[key])
// Give the new weapon with full ammo fm_give_item(id, g_secondary_items[key]) fm_set_user_bpammo(id, weaponid, MAXBPAMMO[weaponid]) }
/*===============================================================================?= End Code just for giving guns ================================================================================?*/
(16/03/2015, 06:43 PM)Evilz escribió: Nome pasastes ninguno para empezar tengo 17
(16/03/2015, 06:26 PM)kikizon2 escribió: Son niños hud, no vale la pena insistir, su capacidad de solvencia de problemas no esta tan desarrollada como la tuya...
Teoria destruida en #3, #2, #1.
Aparte de que sasske tiene 14 años. Y sabe mas que yo.
Cada quien lo desarrolla de manera diferente, por ejemplo el; tiene 17 y no entiende, no lee, etc.
16/03/2015, 06:45 PM (Última modificación: 16/03/2015, 06:45 PM por hud.)
(16/03/2015, 06:43 PM)Evilz escribió: Nome pasastes ninguno para empezar tengo 17
(16/03/2015, 06:26 PM)kikizon2 escribió: Son niños hud, no vale la pena insistir, su capacidad de solvencia de problemas no esta tan desarrollada como la tuya...
Teoria destruida en #3, #2, #1.
Aparte de que sasske tiene 14 años. Y sabe mas que yo.