Raised This Month: $404 Target: $400
 101% 

Modifying plugins select models zombie plague


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mihai94
Junior Member
Join Date: Feb 2018
Old 02-07-2018 , 04:09   Modifying plugins select models zombie plague
Reply With Quote #1

Hello I have on the server this menu menu models appears a menu where I can choose which skin I want only that I want to change in the following way.
1. when you choose the skin you want from there to be permanent he only takes 1 round the next round gives you skin with default and if you can permanently change it, only if you want that player to select another skin only then to modify it and slices to be permanent.
2. have access to this menu only players who hold vip [gold members] in the menu to be set from the flag and be the ADMIN_LEVEL_H [flags t]

plugins:

#include <amxmodx>
#include <zombie_plague_special>
#include <fakemeta>
#include <fun>
#include <zmvip>
#include <colorchat>

new g_ent_playermodel[33];
new g_ent_weaponmodel[33];
new g_currentweapon[33];
new g_pcvar_active;

new MenuKeys = (1 << 0) + (1 << 1) + (1 << 2) + (1 << 3) + (1 << 4) + (1 << 5) + (1 << 6) + (1 << 7) + (1 << + (1 << 9)
new BuyMenuBodyText[256]

public plugin_init()
{
register_plugin("[ZP] Select Models", "1.2", "Anggara_nothing")
g_pcvar_active = register_cvar("zp_sem_enable", "1")
register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
SetupSelectMenu()
register_clcmd("say /models", "ClCmdSelectModel")
register_menucmd(register_menuid("\rSelecteaz a-ti Modelul Dorit:"), MenuKeys, "SelectIt")
}

public plugin_precache()
{
// Change your models here.
engfunc(EngFunc_PrecacheModel, "models/player/VIPBarbatJoker/VIPBarbatJoker.mdl")
engfunc(EngFunc_PrecacheModel, "models/player/VIPBarbatSmithAgent/VIPBarbatSmithAgent.mdl")
engfunc(EngFunc_PrecacheModel, "models/player/VIPFemeleBarbara/VIPFemeleBarbara.mdl")
engfunc(EngFunc_PrecacheModel, "models/player/VIPFemeleInger/VIPFemeleInger.mdl")
engfunc(EngFunc_PrecacheModel, "models/player/VIPBarbatDoctorFox/VIPBarbatDoctorFox.mdl")
engfunc(EngFunc_PrecacheModel, "models/player/VIPBarbatVendetta/VIPBarbatVendetta.mdl")
engfunc(EngFunc_PrecacheModel, "models/player/VIPFemeleSonya/VIPFemeleSonya.mdl")
engfunc(EngFunc_PrecacheModel, "models/player/VIPFemeleJennifer/VIPFemeleJennifer.mdl")
}

// Current Weapon info
public message_cur_weapon(msg_id, msg_dest, msg_entity)
{
// Player not alive or not an active weapon
if (!is_user_alive(msg_entity) || get_msg_arg_int(1) != 1)
return;

// Get weapon id
static weapon
weapon = get_msg_arg_int(2)

// Store weapon id for reference
g_currentweapon[msg_entity] = weapon

// Replace weapon models with custom ones
fm_set_weaponmodel_ent(msg_entity)
}

// User Infected forward
public zp_user_infected_post(id, infector)
{
// remove the glow.
set_user_rendering(id, kRenderFxNone, 0,0,0,kRenderNormal, 255)

// Remove Custom Model Entities
fm_remove_model_ents(id)
}

public ClCmdSelectModel(id)
{
if(zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_survivor(id))
{
ColorChat(0, GREY, "^4[ZP Models] ^3Aceste Skinuri Sunt Doar Pentru Oameni.")

set_hudmessage(200, 155, 0, -1.0, 0.50, 0, 6.0, 8.0, 0.3, 0.5, 3)
show_hudmessage(id, "Aceste Skinuri Sunt Doar Pentru Oameni.")
return PLUGIN_HANDLED;
}
else if(!get_pcvar_num(g_pcvar_active))
{
set_hudmessage(200, 155, 0, -1.0, 0.50, 0, 6.0, 8.0, 0.3, 0.5, 3)
show_hudmessage(id, "Aceasta Abiliate A Fost Dezactivata.")
return PLUGIN_HANDLED;
}
else if(!is_user_alive(id))
{
ColorChat(0, GREY, "^4[ZP Models] ^3Trebuie Sa Fii In Viata Pentru A Putea Utiliza Acest Meniu.")

set_hudmessage(200, 155, 0, -1.0, 0.50, 0, 6.0, 8.0, 0.3, 0.5, 3)
show_hudmessage(id, "Trebuie Sa Fii In Viata Pentru A Putea Utiliza Acest Meniu.")
return PLUGIN_HANDLED;
}
else
{
SetupSelectMenu()
show_menu(id, MenuKeys, BuyMenuBodyText)
}
return PLUGIN_CONTINUE;
}

public SelectIt(id, key)
{
switch (key)
{
case 0:
{
fm_remove_model_ents(id)
if (!pev_valid(g_ent_playermodel[id]))
{
g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
if (!pev_valid(g_ent_playermodel[id])) return ;

set_user_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 1)
set_pev(g_ent_playermodel[id], pev_classname, "player_model")
set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW)
set_pev(g_ent_playermodel[id], pev_aiment, id)
set_pev(g_ent_playermodel[id], pev_owner, id)
// and change this.
engfunc(EngFunc_SetModel, g_ent_playermodel[id], "models/player/VIPBarbatJoker/VIPBarbatJoker.mdl")
fm_set_weaponmodel_ent(id)
}
}
case 1:
{
fm_remove_model_ents(id)
if (!pev_valid(g_ent_playermodel[id]))
{
g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
if (!pev_valid(g_ent_playermodel[id])) return ;

set_user_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 1)
set_pev(g_ent_playermodel[id], pev_classname, "player_model")
set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW)
set_pev(g_ent_playermodel[id], pev_aiment, id)
set_pev(g_ent_playermodel[id], pev_owner, id)
// and change this.
engfunc(EngFunc_SetModel, g_ent_playermodel[id], "models/player/VIPBarbatSmithAgent/VIPBarbatSmithAgent.mdl")
fm_set_weaponmodel_ent(id)
}
}
case 2:
{
fm_remove_model_ents(id)
if (!pev_valid(g_ent_playermodel[id]))
{
g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
if (!pev_valid(g_ent_playermodel[id])) return ;

set_user_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 1)
set_pev(g_ent_playermodel[id], pev_classname, "player_model")
set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW)
set_pev(g_ent_playermodel[id], pev_aiment, id)
set_pev(g_ent_playermodel[id], pev_owner, id)
// and change this.
engfunc(EngFunc_SetModel, g_ent_playermodel[id], "models/player/VIPFemeleBarbara/VIPFemeleBarbara.mdl")
fm_set_weaponmodel_ent(id)
}
}
case 3:
{
fm_remove_model_ents(id)
if (!pev_valid(g_ent_playermodel[id]))
{
g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
if (!pev_valid(g_ent_playermodel[id])) return ;

set_user_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 1)
set_pev(g_ent_playermodel[id], pev_classname, "player_model")
set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW)
set_pev(g_ent_playermodel[id], pev_aiment, id)
set_pev(g_ent_playermodel[id], pev_owner, id)
// and change this.
engfunc(EngFunc_SetModel, g_ent_playermodel[id], "models/player/VIPFemeleInger/VIPFemeleInger.mdl")
fm_set_weaponmodel_ent(id)
}
}
case 4:
{
fm_remove_model_ents(id)
if (!pev_valid(g_ent_playermodel[id]))
{
g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
if (!pev_valid(g_ent_playermodel[id])) return ;

set_user_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 1)
set_pev(g_ent_playermodel[id], pev_classname, "player_model")
set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW)
set_pev(g_ent_playermodel[id], pev_aiment, id)
set_pev(g_ent_playermodel[id], pev_owner, id)
// and change this.
engfunc(EngFunc_SetModel, g_ent_playermodel[id], "models/player/VIPBarbatDoctorFox/VIPBarbatDoctorFox.mdl")
fm_set_weaponmodel_ent(id)
}
}
case 5:
{
fm_remove_model_ents(id)
if (!pev_valid(g_ent_playermodel[id]))
{
g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
if (!pev_valid(g_ent_playermodel[id])) return ;

set_user_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 1)
set_pev(g_ent_playermodel[id], pev_classname, "player_model")
set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW)
set_pev(g_ent_playermodel[id], pev_aiment, id)
set_pev(g_ent_playermodel[id], pev_owner, id)
// and change this.
engfunc(EngFunc_SetModel, g_ent_playermodel[id], "models/player/VIPBarbatVendetta/VIPBarbatVendetta.mdl")
fm_set_weaponmodel_ent(id)
}
}
case 6:
{
fm_remove_model_ents(id)
if (!pev_valid(g_ent_playermodel[id]))
{
g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
if (!pev_valid(g_ent_playermodel[id])) return ;

set_user_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 1)
set_pev(g_ent_playermodel[id], pev_classname, "player_model")
set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW)
set_pev(g_ent_playermodel[id], pev_aiment, id)
set_pev(g_ent_playermodel[id], pev_owner, id)
// and change this.
engfunc(EngFunc_SetModel, g_ent_playermodel[id], "models/player/VIPFemeleSonya/VIPFemeleSonya.mdl")
fm_set_weaponmodel_ent(id)
}
}
case 7:
{
fm_remove_model_ents(id)
if (!pev_valid(g_ent_playermodel[id]))
{
g_ent_playermodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
if (!pev_valid(g_ent_playermodel[id])) return ;

set_user_rendering(id, kRenderFxNone, 255, 255, 255, kRenderTransTexture, 1)
set_pev(g_ent_playermodel[id], pev_classname, "player_model")
set_pev(g_ent_playermodel[id], pev_movetype, MOVETYPE_FOLLOW)
set_pev(g_ent_playermodel[id], pev_aiment, id)
set_pev(g_ent_playermodel[id], pev_owner, id)
// and change this.
engfunc(EngFunc_SetModel, g_ent_playermodel[id], "models/player/VIPFemeleJennifer/VIPFemeleJennifer.mdl")
fm_set_weaponmodel_ent(id)
}
}
case 9: return ;
}

ClCmdSelectModel(id)
return;
}

public SetupSelectMenu()
{
new menuLen = format(BuyMenuBodyText, 255, "\rSelecteaza-ti Modelul Dorit:^n^n")
menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w1. Barbat Joker^n")
menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w2. Barbat Agent Smith^n")
menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w3. Femeie Barbara^n")
menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w4. Femeie Inger^n")
menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w5. Barbat Doctor Fox^n")
menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w6. Barbat Vendetta^n")
menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w7. Femeie Sonya^n")
menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w8. Femeie Jennifer^n^n")

menuLen += format(BuyMenuBodyText[menuLen], 255 - menuLen, "\w0. Iesire")

return 1
}

// Remove Custom Model Entities
stock fm_remove_model_ents(id)
{
// Remove "playermodel" ent if present
if (pev_valid(g_ent_playermodel[id]))
{
engfunc(EngFunc_RemoveEntity, g_ent_playermodel[id])
g_ent_playermodel[id] = 0
}
// Remove "weaponmodel" ent if present
if (pev_valid(g_ent_weaponmodel[id]))
{
engfunc(EngFunc_RemoveEntity, g_ent_weaponmodel[id])
g_ent_weaponmodel[id] = 0
}
}

// Set Weapon Model on Entity
stock fm_set_weaponmodel_ent(id)
{
// Get player's p_ weapon model
static model[100]
pev(id, pev_weaponmodel2, model, sizeof model - 1)

// Set model on entity or make a new one if unexistant
if (!pev_valid(g_ent_weaponmodel[id]))
{
g_ent_weaponmodel[id] = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"))
if (!pev_valid(g_ent_weaponmodel[id])) return;

set_pev(g_ent_weaponmodel[id], pev_classname, "weapon_model")
set_pev(g_ent_weaponmodel[id], pev_movetype, MOVETYPE_FOLLOW)
set_pev(g_ent_weaponmodel[id], pev_aiment, id)
set_pev(g_ent_weaponmodel[id], pev_owner, id)
}

engfunc(EngFunc_SetModel, g_ent_weaponmodel[id], model)
}

stock chat_color(const id, const input[], any:...)
{
new count = 1, players[32]

static msg[191]

vformat(msg, 190, input, 3)

replace_all(msg, 190, "!g", "^4")
replace_all(msg, 190, "!y", "^1")
replace_all(msg, 190, "!t", "^3")
replace_all(msg, 190, "!t2", "^0")

if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
write_byte(players[i])
write_string(msg)
message_end()
}
}
}
}

include zmvip:

/********************************************* *********************

Zm VIP for Zombie Plague 4.3
Author: aaarnas

********************************************* **********************

This (zm vip) plugin uses it's own extra
items simmilar like in main mod(Zombie Plague).
There are the main natives/forward witch required to
register extra items plugins on this zm vip plugin.

Also it's has own authentication system (If MODE 1 is on)
Use native zv_get_user_flags(id) to check player flags in
other plugins:

#include <zmvip>

public function()
{
if(zv_get_user_flags(id) > 0) // Checks if player has any vip privilegies.
if(zv_get_user_flags(id) & ZV_MAIN) // Checks if player has specific privilegie.
}

********************************************* **********************/
#if defined _zmvip_included
#endinput
#endif

#define _zmvip_included

#define ZV_PLUGIN_HANDLED 97

/* Flags */
#define ZV_MAIN (1<<0)
#define ZV_MULTI (1<<1)
#define ZV_UNLIMITED (1<<2)
#define ZV_DAMAGE (1<<3)

/* Teams */
#define ZV_TEAM_ZOMBIE (1<<0)
#define ZV_TEAM_HUMAN (1<<1)
#define ZV_TEAM_NEMESIS (1<<2)
#define ZV_TEAM_SURVIVOR (1<<3)


/* Natives */

/* Registers extra items on this plugin for VIPs (Only if MODE 2 is active)
*
* @param name Extra item name.
* @param discription Extra item discription (simmilar like zombie class discription).
* @param cost How much ammo packs will cost this item for player.
* @param team Teams allowed to buy this item. (0 for all teams)
* @return Extra item id.
*/
native zv_register_extra_item(const name[], const discription[], cost, team)

/* Gets user flags (Only if MODE 1 is active)
*
* @param id Player index.
* @return Player flags.
*/
native zv_get_user_flags(id)
native zv_is_user_gold(id)

native get_nr_vips()
native get_total_vips()


/* Forwards */

/* Called then player selects extra item in his VIP meniu. (Only if MODE 2 is active)
*
* You can stop player of buing item returning ZV_PLUGIN_HANDLED.
* Player will be refunded automaticaly
*
* @param id Player index.
* @param itemid Extra item id, witch player bought.
*/
forward zv_extra_item_selected(id, itemid)

thank you.
Mihai94 is offline
Mihai94
Junior Member
Join Date: Feb 2018
Old 02-08-2018 , 03:33   Re: Modifying plugins select models zombie plague
Reply With Quote #2

up?
Mihai94 is offline
Mihai94
Junior Member
Join Date: Feb 2018
Old 02-09-2018 , 03:34   Re: Modifying plugins select models zombie plague
Reply With Quote #3

up?
Mihai94 is offline
Mihai94
Junior Member
Join Date: Feb 2018
Old 02-18-2018 , 12:45   Re: Modifying plugins select models zombie plague
Reply With Quote #4

up.
Mihai94 is offline
Relaxing
Veteran Member
Join Date: Jun 2016
Location: Catlands
Old 02-25-2018 , 14:38   Re: Modifying plugins select models zombie plague
Reply With Quote #5

Rarely people browse into these sub-forums. I recommend trying to post here.
https://forums.alliedmods.net/forumdisplay.php?f=11
__________________
Have A Relaxing Day | Wiki
aim_relaxing
Relaxing is offline
heliumdream
Senior Member
Join Date: Aug 2006
Old 03-01-2018 , 09:23   Re: Modifying plugins select models zombie plague
Reply With Quote #6

This has been tackled before, here's a link to the CS User Model Menuz:
https://forums.alliedmods.net/showth...t=8631&page=11

I even made a version myself that supports superheroes mod, and did some other small optimizations.

Neat that you've made this for zombie mod! But as others suggested, put it in the right sub-forum.

---

oh, in fact, you did have a scripting issue tucked in there.
more or less the same way my code checks for superhero levels, you could check for the players access flags and stop folks who don't have admin privileges from picking select skins.

my code has already added handling for checking privileges.
i have separated the menu commands into two version, one for admins and one for public users.
amx_skin_menu_admin
amx_skin_menu

in this case, where we register the console commands, ADMIN_BAN and -1 are the privilege flags that get added to their definition and later checked inside their respective function calls.

Code:
   register_clcmd("amx_skin_menu_admin","consoleCommand",ADMIN_BAN,"- brings up menu for custom user models");
    register_clcmd("amx_skin_menu","consoleCommandUser",-1,"- brings up menu for custom user models");

---

  // hook amx_csummz to check permissions
  public consoleCommand(id,level,cid) {

    if(!cmd_access(id,level,cid,1)) {
      return PLUGIN_HANDLED;
    }

    return menu1Display(id);
  }

  public consoleCommandUser(id,level,cid) {

    if(!cmd_access(id,level,cid,1)) {
      return PLUGIN_HANDLED;
    }
    //in menu6Actiob no need to detect commands to set a target, setting target here
    new idstr[33];
    num_to_str(id,idstr,32);
    target[id] = idstr;

    return menu6Display(id);
  }
__________________


Thank you for playing.

Last edited by heliumdream; 03-01-2018 at 09:45.
heliumdream is offline
Reply


Thread Tools
Display Modes

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 06:06.


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