AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Need help with plugin that should set a player model (https://forums.alliedmods.net/showthread.php?t=309305)

jigore 07-20-2018 17:09

Need help with plugin that should set a player model
 
I am new to PAWN, so my :crab: arms made this plugin.
The plugin had no problems with compiling, but was not working at all
P.S Plugin is made for Zombie Plague 4.3

Code:

#include <amxmodx>
#include <cstrike>
#include <hamsandwich>
#include <zmvip>

#define PLUGIN "[ZP] VIP Model"
#define VERSION "0.1"
#define AUTHOR "gore"


new VIP_MODEL[] = "models/player/Transcendent_Michaela/Transcendent_Michaela.mdl"

public plugin_init() {

        register_plugin(PLUGIN, VERSION, AUTHOR)
   
        RegisterHam(Ham_Spawn, "player", "SetModel", 1)

}

public plugin_precache() {
       
        precache_model(VIP_MODEL)

}

public SetModel(const id) {

        if(zv_get_user_flags(id) & ZV_MAIN && is_user_connected(id)) {

                cs_set_user_model(id, "Transcendent_Michaela")
                client_print(id, print_chat, "\yYou've just got VIP Player model")
                return PLUGIN_HANDLED
        }
        else
        {
        client_print(id, print_chat, "\rSorry, but you don't have VIP flags")
        }
        return PLUGIN_HANDLED
}

I need help making it work. pls.

edon1337 07-20-2018 17:36

Re: Need help with plugin that should set a player model
 
Post in Zombie Plague section instead.

Ghosted 07-21-2018 06:20

Re: Need help with plugin that should set a player model
 
Don't use is_user_connected(id), use is_user_alive(id) instead

jigore 07-21-2018 06:52

Re: Need help with plugin that should set a player model
 
well, I used different plugin I remade, so this is solved
First code for overriding model with admin model
Code:

#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>

#define PLUGIN_NAME "plugin"
#define PLUGIN_VERSION "1"
#define PLUGIN_AUTHOR "author"

#define ADMIN_BAN        (1<<3)
new const g_model_for_admin[][] = { "vip_cat" }

public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)

RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", true)
}

public plugin_precache()
{
for(new index = 0; index < sizeof g_model_for_admin; index++)
{
static patch[128]
formatex(patch, sizeof patch, "models/player/vip_cat/vip_cat.mdl", g_model_for_admin[index], g_model_for_admin[index])
precache_model(patch)
}
}

public fw_PlayerSpawn_Post(iPlayer)
{
if(is_user_alive(iPlayer) && !zp_get_user_zombie(iPlayer) && !zp_get_user_survivor(iPlayer) && (get_user_flags(iPlayer) & ADMIN_BAN))
{
zp_override_user_model(iPlayer, g_model_for_admin[random(sizeof g_model_for_admin)])
}
}

public zp_user_humanized_post(iPlayer, iSurv)
{
if(!iSurv && (get_user_flags(iPlayer) & ADMIN_BAN))
{
zp_override_user_model(iPlayer, g_model_for_admin[random(sizeof g_model_for_admin)])
}
}

This one is overriding admin model that is set in zombieplague.ini, so adm&vip would be the same models, so you need both to different models for VIP and ADMIN
Code:

#include <amxmodx>
#include <hamsandwich>
#include <zombieplague>

#define PLUGIN_NAME "[ZP] Set Model VIP"
#define PLUGIN_VERSION "0.1"
#define PLUGIN_AUTHOR "pach2580"

#define ADMIN_RESERVATION        (1<<1)
new const g_model_for_vip[][] = { "vip_cat" }

public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)

RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", true)
}

public plugin_precache()
{
for(new index = 0; index < sizeof g_model_for_vip; index++)
{
static patch[128]
formatex(patch, sizeof patch, "models/player/vip_cat/vip_cat.mdl", g_model_for_vip[index], g_model_for_vip[index])
precache_model(patch)
}
}

public fw_PlayerSpawn_Post(iPlayer)
{
if(is_user_alive(iPlayer) && !zp_get_user_zombie(iPlayer) && !zp_get_user_survivor(iPlayer) && (get_user_flags(iPlayer) & ADMIN_RESERVATION))
{
zp_override_user_model(iPlayer, g_model_for_vip[random(sizeof g_model_for_vip)])
}
}

public zp_user_humanized_post(iPlayer, iSurv)
{
if(!iSurv && (get_user_flags(iPlayer) & ADMIN_RESERVATION))
{
zp_override_user_model(iPlayer, g_model_for_vip[random(sizeof g_model_for_vip)])
}
}

Leaving codes here if some1 like me will face the same problem like I did.


All times are GMT -4. The time now is 12:49.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.