AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   model command (https://forums.alliedmods.net/showthread.php?t=187475)

Diegorkable 06-13-2012 15:26

model command
 
Hey guys,

people in my server can type in console "model MODEL_NAME" and their model will change to the model they pick. for example typing "model zombie" would make them look like a zombie. I want to block that so I used client_command forward and checked if argv(0) equals to "model", if it is return plugin handled main.

The command is still not being blocked, anyone knows what can I do? Is it a command of the HL engine?

Liverwiz 06-13-2012 15:45

Re: model command
 
Quote:

Originally Posted by Diegorkable (Post 1728159)
Hey guys,

people in my server can type "model MODEL_NAME" and their model change to the model they pick. for example typing "model zombie" would make them look like a zombie. I want to block that so I used client_command forward and checked if argv(0) equals to "model", if it is return plugin handled main.

The command is still not being blocked, anyone knows what can I do? Is it a command of the HL engine?

if you hook the command as such...
Code:

register_clcmd("model", "functionOfBoobs")  //got boobs on the mind, everyone loves boobs
Then just set some sort of opt-out (a CVAR or something) and put it at the beginning of that hook and have it return PLUGIN_HANDLED

PHP Code:

public functionOfBoobs(id)
{
    if(
get_pcvar_num(turnModelOff_pcvar) == 0)
        return 
PLUGIN_HANDLED
    
// put the rest of the stuff here


hope that helped.
If not....show code, not sure what you want

Diegorkable 06-13-2012 16:19

Re: model command
 
register_clcmd doesnt work in that case. probably because its an HL engine command, I am not sure.
A question: Is it an info? can I use maybe client_infochanged, then read the player's model info and see if he change it? If so, how can I get the old and new one?
Old -> get_user_model()
New -> get_user_info(id, "model")?

Backstabnoob 06-13-2012 16:33

Re: model command
 
Hook FM_SetClientKeyValue and check if the key equals to "model". You can change it to whatever you want there, or just block it.

Diegorkable 06-14-2012 09:18

Re: model command
 
It doesn't block too =\, why the fuck is that.

YamiKaitou 06-14-2012 15:27

Re: model command
 
The command is handled by the client, so the server does not see it in time (or at all, not sure) to be able to block it

You will have to detect when they change their model and then change it back

Diegorkable 06-15-2012 09:21

Re: model command
 
Quote:

Originally Posted by YamiKaitou (Post 1728793)
The command is handled by the client, so the server does not see it in time (or at all, not sure) to be able to block it

You will have to detect when they change their model and then change it back

You know that when you cs_set_user_team someone, it changes his model according to the team, right?
Well, if I use that forward it blocks that model changing after I use cs_set_user_team. if its by the client manually it doesnt block.

YamiKaitou 06-15-2012 14:40

Re: model command
 
Quote:

Originally Posted by Diegorkable (Post 1729203)
You know that when you cs_set_user_team someone, it changes his model according to the team, right?

Yes I am aware, but I don't understand how this is relevant to this thread.

Quote:

Well, if I use that forward it blocks that model changing after I use cs_set_user_team.
What forward? cs_set_user_team is a function to change a players team, not a forward. A forward is something like client_infochanged

Diegorkable 06-16-2012 06:55

Re: model command
 
Quote:

Originally Posted by YamiKaitou (Post 1729355)
Yes I am aware, but I don't understand how this is relevant to this thread.


What forward? cs_set_user_team is a function to change a players team, not a forward. A forward is something like client_infochanged

Quote:

Originally Posted by Backstabnoob (Post 1728227)
Hook FM_SetClientKeyValue and check if the key equals to "model". You can change it to whatever you want there, or just block it.


I'm talking about that forward, I know what a forward is and what a function is.
When I hook FM_SetClientKeyValue and block the key 'model', it doesnt block players from changing their model in console manually, but it does block the changing model of cs_set_user_team.

Got it now?


All times are GMT -4. The time now is 06:15.

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