AlliedModders

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

LynX 03-24-2005 16:15

Check model?!?!
 
Okay this is mine script:

Code:
// Don't pay attention to these includes - I have more stuff that requires this modules #include <amxmodx> #include <core> #include <engine> #include <fun> public plugin_init() {     register_plugin("CheckModel_GiveFunction","dunno","LynX")     register_clcmd("check","check_function")     return PLUGIN_CONTINUE } new model[33][33] public check_function(id) {     if ((get_user_info(id,"model","gign",32) = 1)     {     client_print(id, print_center, "Using Gign")     return PLUGIN_HANDLED     }     if ((get_user_info(id,"models","arctic",32) = 1)     {     client_print(id, print_center, "Using Arctic")     return PLUGIN_HANDLED     } client_print(id, print_center, "Not using two predefined models") return PLUGIN_HANDLED } public plugin_precache() { precache_model("models/player/arctic/arctic.mdl") precache_model("models/player/gign/gign.mdl") return PLUGIN_HANDLED }

I need that if its model 1 ( in this case gign.mdl ) is current player model - player gets function number one.
But, if its model 2 ( in this case arctic.mdl ) current player model - player gets function number two.
BUT, if it isn't neither gign or arctic as players model - script does different function.
But, I cannot affor myself to user natives like cs_get_user_model coz that would not work.
Any help?
So, can you fix this code and add/remove things needed to get this stuff working?

Jinto 03-24-2005 23:03

Get the model and see if it contains a certain string.

Code:
// Don't pay attention to these includes - I have more stuff that requires this modules #include <amxmodx> #include <core> #include <engine> #include <fun> public plugin_init() {     register_plugin("CheckModel_GiveFunction","dunno","LynX")     register_clcmd("check","check_function")     return PLUGIN_CONTINUE; } public check_function(id) {     new model[32];     entity_get_string( id, EV_SZ_model, model, 32 );         if( containi( model, "gign" ) != -1 ) {         client_print( id, print_center, "Using Gign" );     } else if( containi( model, "arctic" ) != -1 ) {         client_print( id, print_center, "Using Arctic" );     } else {         client_print( id, print_center, "Not using two predefined models" );     }         return PLUGIN_HANDLED; } public plugin_precache() {     precache_model("models/player/arctic/arctic.mdl");     precache_model("models/player/gign/gign.mdl");     return PLUGIN_HANDLED; }

LynX 03-25-2005 02:03

Thnx! Gonna try that ASAP!

LynX 03-25-2005 03:14

Doesn't work... Always gives "Not using two predefined models" message...

knekter 03-25-2005 12:14

or
 
Why don't you try the cstrike module, cs_get_user_model.....?

LynX 03-25-2005 13:13

I tried that be4 one month - also didn't worked... But can you post a code snippet made by you, so if I was mistaken in it?

XxAvalanchexX 03-26-2005 01:40

EV_SZ_model will most likely be player.mdl for players. Use cs_get_user_model.

LynX 03-26-2005 03:32

Hmm, but I don't wanna use cs_get_user_model ( I'm aware of it ) - because I need the snippet which will work on almost all HL modifications. I doub't that the Specialists will have CS module on... But, if its the only way, let be it...

XxAvalanchexX 03-26-2005 04:04

Apparently cs_get_user_model just returns the model keyvalue. I can't seem to find where the source code for get_user_model is. For models that support model changing through the customize menu, you can use get_user_info(id,"model",text[],maxLength)

LynX 03-26-2005 06:11

Yes, I tried that - but the model can't be changed in few mods I'm making plugins for ( Jumbot xPanded , ESF... ).


All times are GMT -4. The time now is 09:53.

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