AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   model stuff again >< (https://forums.alliedmods.net/showthread.php?t=25535)

wonsae 03-15-2006 19:18

model stuff again ><
 
Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "Clothesmod" #define VERSION "1.0" #define AUTHOR "Author" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_srvcmd("item_clothes","item_clothes")     } public plugin_precache() {     precache_model("models/player/collector-civilian/collector-civilian.mdl") } public client_connect(id) {     client_cmd(id,"model collector-civilian") } public client_infochanged(id)     {     new oldmodel[32]     new newmodel[32]         get_user_info(id, "model", newmodel, 31)         if(!equali(newmodel, oldmodel))         {         engclient_cmd(id, "model", oldmodel)         client_print(id,print_chat,"[Clothesmod] You may not change clothes that way.")     }         return PLUGIN_HANDLED }   public item_clothes()     {     new arg[32], arg2[32], id, model     read_argv(1,arg,31)     read_argv(2,arg2,31)        id = str_to_num(arg)     model = str_to_num(arg2)             set_user_info(id,"model",arg2)     client_cmd(id,"model %s",model)     new name[64]     new message[300]     format(message,299,"%s has changed his clothes.",name)     client_print(id,print_chat,"[Clothesmod] You have changed your clothes.")     return PLUGIN_HANDLED }

this is my code and when i use the item it can change the model but also i can use console to change model with i don't want so how do i restrict them from changing from console?

Rixorster 03-16-2006 01:52

Code:
register_clcmd("item_clothes","item_clothes")

wonsae 03-21-2006 19:43

that just made it worse any help?

organizedKaoS 03-21-2006 20:30

Code:
register_clcmd("item_clothes","item_handle") public item_handle(id) {      return PLUGIN_HANDLED }

mysticssjgoku4 03-21-2006 21:37

Try This.

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "Clothesmod" #define VERSION "1.0" #define AUTHOR "Author" new has_clothes[33] // Does the player have the clothes item on? new new_clothes[33][32] // New Model specified new cur_clothes[33][32] // Clothes Model Stored Here By Items new old_clothes[33][32] // Old model they had new default_model[32] = "collector-civilian" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_srvcmd("item_clothes","item_clothes")   } public plugin_precache() {     precache_model("models/player/collector-civilian/collector-civilian.mdl") } public client_connect(id) {     client_cmd(id,"model %s",default_model) } public client_infochanged(id) {       get_user_info(id,"model",new_clothes[id],31)         if(has_clothes[id] <= 0)     {         client_cmd(id, "model", default_model)         client_print(id,print_chat,"[Clothesmod] You may not change clothes that way.")         return PLUGIN_HANDLED     }     if(!equali(new_clothes[id],cur_clothes[id]))     {         set_user_info(id,"model",cur_clothes[id])         client_print(id,print_chat,"[Clothesmod] You may not change clothes that way.")         return PLUGIN_HANDLED             }         return PLUGIN_HANDLED } public item_clothes()   {     new arg[32], arg2[32], id, model         read_argv(1,arg,31)     read_argv(2,arg2,31)           id = str_to_num(arg)     model = str_to_num(arg2)         if(has_clothes[id] <= 0)     {         get_user_info(id,"model",old_clothes[id],31)             set_user_info(id,"model",arg2)                 format(cur_clothes[id],31,arg2)                 client_cmd(id,"model %s",model)             client_print(id,print_chat,"[Clothesmod] You have changed your clothes.")             new name[32]         get_user_name(id,name,31)         client_print(0,print_chat,"[ClothesMod] %s, has changed his clothes",name)                 has_clothes[id] = 1                 return PLUGIN_HANDLED     }     else     {         client_print(id,print_chat,"[ClothesMod] You've put back on your original uniform.")         engclient_cmd(id, "model", default_model)         has_clothes[id] = 0     }         return PLUGIN_HANDLED }

organizedKaoS 03-21-2006 22:47

i dont think
Code:
client_cmd(id, "model %s", default_model)
is a proper client cmd action. At least, if you try it in game nothing happens :? :?

mysticssjgoku4 03-21-2006 23:02

should work :?

try this:

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "Clothesmod" #define VERSION "1.0" #define AUTHOR "Author" new has_clothes[33] // Does the player have the clothes item on? new new_clothes[33][32] // New Model specified new cur_clothes[33][32] // Clothes Model Stored Here By Items new old_clothes[33][32] // Old model they had new default_model[32] = "collector-civilian" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_srvcmd("item_clothes","item_clothes")   } public plugin_precache() {     precache_model("models/player/collector-civilian/collector-civilian.mdl") } public client_connect(id) {     client_cmd(id,"model %s",default_model) } public client_infochanged(id) {       get_user_info(id,"model",new_clothes[id],31)         if(has_clothes[id] <= 0)     {         set_user_info(id,"model",default_model)         client_print(id,print_chat,"[Clothesmod] You may not change clothes that way.")         return PLUGIN_HANDLED     }     if(!equali(new_clothes[id],cur_clothes[id]))     {         set_user_info(id,"model",cur_clothes[id])         client_print(id,print_chat,"[Clothesmod] You may not change clothes that way.")         return PLUGIN_HANDLED             }         return PLUGIN_HANDLED } public item_clothes()   {     new arg[32], arg2[32], id, model         read_argv(1,arg,31)     read_argv(2,arg2,31)           id = str_to_num(arg)     model = str_to_num(arg2)         if(has_clothes[id] <= 0)     {         get_user_info(id,"model",old_clothes[id],31)             set_user_info(id,"model",arg2)                 format(cur_clothes[id],31,arg2)             client_print(id,print_chat,"[Clothesmod] You have changed your clothes.")             new name[32]         get_user_name(id,name,31)         client_print(0,print_chat,"[ClothesMod] %s, has changed his clothes",name)                 has_clothes[id] = 1                 return PLUGIN_HANDLED     }     else     {         client_print(id,print_chat,"[ClothesMod] You've put back on your original uniform.")         set_user_info(id,"model",default_model)         has_clothes[id] = 0     }         return PLUGIN_HANDLED }

organizedKaoS 03-22-2006 00:52

Quote:

Originally Posted by organizedKaoS
i dont think
Code:
client_cmd(id, "model %s", default_model)
is a proper client cmd action. At least, if you try it in game nothing happens :? :?

I revert to previous statement. A client cannot type in console "model gign" and have it do anything, it simply is not a valid hl command, as far as I know. Just use
Quote:

Originally Posted by organizedKaoS
Code:
register_clcmd("item_clothes", "item_handle") public item_handle(id) {      return PLUGIN_HANDLED }

Like I suggested earlier.

wonsae 03-22-2006 08:58

Quote:

Originally Posted by organizedKaoS
Quote:

Originally Posted by organizedKaoS
i dont think
Code:
client_cmd(id, "model %s", default_model)
is a proper client cmd action. At least, if you try it in game nothing happens :? :?

I revert to previous statement. A client cannot type in console "model gign" and have it do anything, it simply is not a valid hl command, as far as I know. Just use
Quote:

Originally Posted by organizedKaoS
Code:
register_clcmd("item_clothes", "item_handle") public item_handle(id) {      return PLUGIN_HANDLED }

Like I suggested earlier.

this is for the specialists and model whatever is a command in it

organizedKaoS 03-22-2006 10:04

I see now, you should've said it was for the specialist, instead of having me give advice on a mod I dont play :oops: :oops: :oops: :oops: Oh well, I tried to help :lol: :lol: :lol:


All times are GMT -4. The time now is 16:43.

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