AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   random models without change team ? (https://forums.alliedmods.net/showthread.php?t=294972)

abdobiskra 03-12-2017 13:16

random models without change team ?
 
Hi.
I hope you are fine, geeks :twisted:
my idea :
i want change model team whithout change the team

I will explain in short detail
I hope you understand me :oops:
first code :
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>


#define PLUGIN   "Test"
#define AUTHOR   "LetiLetiLepestok"
#define VERSION   "1.0"

new g_asModels[33][32]

public 
plugin_init()
{
   
register_plugin(PLUGINVERSIONAUTHOR)
   
register_forward(FM_SetClientKeyValue"SetClientKeyValue");
   
register_clcmd("set_model""set_player_mdl")
}


public 
set_player_mdl(player)
{
   new 
sModel[32]
   
read_argv(1sModelcharsmax(sModel))
   
trim(sModel)
   
remove_quotes(sModel)
   if(
equal(sModel""))
      
g_asModels[player] = ""

   
g_asModels[player] = sModel
   
   set_user_info
(player"model"g_asModels[player])   
   return 
PLUGIN_HANDLED
}


public 
SetClientKeyValue(player, const szInfoBuffer[], const szKey[], const szValue[])
{
   if( 
equal(szKey"model") && is_user_connected(player) && !equal(g_asModels[player], ""))
      return 
FMRES_SUPERCEDE

   
return FMRES_IGNORED


this its work without change team

but im using this function to chage team without killing the player for other case :
PHP Code:

set_user_team(id,"zombie",false,false

In the end :
I want to merge both cases into one job

so ! ( i need change team without killing and get the players this team random models )

PHP Code:

#define RANDOMSKINS 3

new g_asModels[33][32]


new const 
Set_Zombies_modelsRANDOMSKINS][] =
{
    
"red",
    
"clawler",
    
"blue"



edon1337 03-12-2017 13:29

Re: random models without change team ?
 
Code:
set_user_info(player, "model", Set_Zombies_models[random(sizeof Set_Zombies_models)])

abdobiskra 03-12-2017 13:38

Re: random models without change team ?
 
Quote:

Originally Posted by edon1337 (Post 2503084)
Code:
set_user_info(player, "model", random(sizeof Set_Zombies_models))

But I think they do not change the team .. only model? ( i dont test yet)
btw i need change the team and get random model for the players
ex:
i have two team ( zombies;humans ) ==> (infection mod)
im set all players to humans when joined to server .. so when any player infected should be to zombie team when im using this function
PHP Code:

set_user_team(id,"zombies",false,false

i want also get this players (mean when infected ) random models in the same team (zombies)

edon1337 03-12-2017 13:48

Re: random models without change team ?
 
Obviously it only changes the model. A solution would be to create 2 Strings which will contain certain models from each team.

Code:
new const Human_Models[][] = { "model1", "model2" } new const Zombie_Models[][] = { "zm_model1", "zm_model2" }

Then you'd set the model by doing this

Code:
set_user_info( id, "model", get_user_team( id ) ? ( Zombies_Models[ random( sizeof Zombies_Models ) ] ) : ( Human_Models[ random( sizeof Human_Models ) ] ) )

abdobiskra 03-12-2017 14:12

Re: random models without change team ?
 
in SetClientKeyValue
We have forgotten these conditions ?
Quote:

!equal(g_asModels[player], ""))
How can it become?

edon1337 03-12-2017 14:29

Re: random models without change team ?
 
Quote:

Originally Posted by abdobiskra (Post 2503107)
in SetClientKeyValue
We have forgotten these conditions ?

How can it become?

What are you trying to do?

abdobiskra 03-12-2017 15:13

Re: random models without change team ?
 
i mean this array should be to work for return the Key and operation goes above all others
we need it i think for change model without killing ?


All times are GMT -4. The time now is 18:00.

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