Half-Life и Adrenaline Gamer форум
http://aghl.ru/forum/

block cmd "model" or check it ?
http://aghl.ru/forum/viewtopic.php?f=12&t=2431
Страница 1 из 2

Автор:  abdobiskra [ 14 апр 2016, 18:53 ]
Заголовок сообщения:  block cmd "model" or check it ?

i used this ? nothing happened

Код:
#include <amxmodx>

public plugin_init()
{
  register_clcmd("model", "block_model");
  //register_clcmd("model red", "block_model");
  //register_clcmd("model blue", "block_model");

}
public block_model()
{
        return PLUGIN_HANDLED;
}

Автор:  Lev [ 14 апр 2016, 20:49 ]
Заголовок сообщения:  Re: block cmd "model" or check it ?

Command model isn't passed to the server. It is processed on the client and changes "setinfo model" field.
So it came to the server in the
Код:
public client_infochanged(id)
{
event. You should check if model has changed because this event is triggered for any setinfo field changes.
Like this:
Код:
public client_infochanged(id)
{
   new newname[32], oldname[32];
   get_user_name(id, oldname, charsmax(oldname));
   get_user_info(id, "name", newname, charsmax(newname));

   if (!equal(oldname, newname))
   {
      set_task(DELAY_BEFORE_VALIDATENAME, "validate_name_task", TASK_VALIDATENAME_BASE + id);
   }

   return PLUGIN_CONTINUE;
}

Автор:  abdobiskra [ 14 апр 2016, 23:41 ]
Заголовок сообщения:  Re: block cmd "model" or check it ?

i do like this !

Цитата:
Код:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

public plugin_init()
{
   register_plugin(PLUGIN, VERSION, AUTHOR)
}


public client_infochanged(id)
{

   new ent
   new newmodel[32], oldmodel[32];
   
   get_user_info(id, "model", oldmodel, charsmax(oldmodel));
   get_user_info(id, "model", newmodel, charsmax(newmodel));
   
 //  get_user_info(id, "model", model, 31);

   if (!equal(oldmodel, newmodel))
   {
       server_print("====== Done! =====")
       ent_autoReturn(ent ,id) // here my function what i need ! when change model return Ent
   }

   return PLUGIN_CONTINUE;
}

Автор:  Lev [ 14 апр 2016, 23:59 ]
Заголовок сообщения:  Re: block cmd "model" or check it ?

You can't get old model so.
The better way, cos you wish to block the change, will be to just set your model.
Код:
new models[33][33];

public client_putinserver(id)
{
   // get the model
   get_user_info(id, "model", models[id], 32);
}

public client_infochanged(id)
{
   // set the model
   set_user_info(id, "model", models[id]);
}

Автор:  abdobiskra [ 15 апр 2016, 00:33 ]
Заголовок сообщения:  Re: block cmd "model" or check it ?

1) i want called function when i check player change the models
Код:
 ent_autoReturn(ent ,id) // here my function what i need ! when change model return Ent 

2) i trayed it but this make bug in server and Lag !
Цитата:
* Can't change team to ''
* Server limits teams to 'blue;red'
* Can't change team to ''
* Server limits teams to 'blue;red'
* Can't change team to ''
* Server limits teams to 'blue;red'
* Can't change team to ''
* Server limits teams to 'blue;red'
* Can't change team to ''
* Server limits teams to 'blue;red'
* Can't change team to ''
* Server limits teams to 'blue;red'
* assigned to team blue
Reliable channel overflowed
Host_EndGame: Server disconnected

Netchan_Clear() : reliable length not 0, reliable_sequence: 34, incoming_reliable_acknowledged: 0

Автор:  Kuma77 [ 15 апр 2016, 00:43 ]
Заголовок сообщения:  Re: block cmd "model" or check it ?

emm i think you want when player change model and he has ent then return ent ( box , or sword , or whatever )
if that then just check if player is dead or not if he is dead then it will automaticlly return when he changed his model !

Автор:  abdobiskra [ 15 апр 2016, 00:50 ]
Заголовок сообщения:  Re: block cmd "model" or check it ?

Kuma77
yes !
but how i can check player is dead ?

Автор:  Kuma77 [ 15 апр 2016, 00:52 ]
Заголовок сообщения:  Re: block cmd "model" or check it ?

Цитата:
if(!is_user_alive(id))
you can also use boolean

Автор:  abdobiskra [ 15 апр 2016, 12:57 ]
Заголовок сообщения:  Re: block cmd "model" or check it ?

ths function "drop" worked in next change model

Ex:
player model == Red
player has change " model Blue " // here drop not work
in next change
player has change " model Red " <== player back in old model ! // here cmd drop work !

Код:
new new_model[33][32] 
new old_model[33][32]

public client_infochanged(id)

    if(!is_user_alive(id))
    get_user_info(id,"model",old_model[id],31)

    if(!equali(new_model[id],old_model[id]))
    {
        client_cmd(id,"drop");
        client_print(id,print_chat,"==== Check Model !==== ")
        return PLUGIN_HANDLED     
    }
   
    return PLUGIN_HANDLED
}

Автор:  Kuma77 [ 15 апр 2016, 20:53 ]
Заголовок сообщения:  Re: block cmd "model" or check it ?

what is your general idea

Страница 1 из 2 Часовой пояс: UTC + 5 часов [ Летнее время ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/