Raised This Month: $ Target: $400
 0% 

Setting models to a player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
EpicKiller
Senior Member
Join Date: Jun 2014
Location: Constanta, Romania
Old 03-12-2015 , 12:31   Setting models to a player
Reply With Quote #1

So I've got this:
Spoiler

Apparently, the models won't get set. Where am I mistaking?
__________________
~ Swiftly and with style ~
EpicKiller is offline
Send a message via Yahoo to EpicKiller Send a message via Skype™ to EpicKiller
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-12-2015 , 12:35   Re: Setting models to a player
Reply With Quote #2

Firstly, on a global declared variable static is silly. This is the purpose of a global variable, it won't ever be destroyed during run-time.

AFAIK, the path for player models should be:
Code:
models/player/some_model_name/some_model_name.mdl
Yours is not like that. When I worked on some models setting plugins I had problems using different paths structure.

Also, your gPlayerModel is never filled with a value.

Please debug your code, this mean to put some debug messages in the key parts of your code and output variable values in order to know where it fails. You can add them inside if conditions to know if they pass or not, inside loops, when you want to see if your variables are correctly filled or where it is needed. If you did that before, you would see that gPlayerModel is empty and the code from if condition won't be executed.
__________________

Last edited by HamletEagle; 03-12-2015 at 12:39.
HamletEagle is offline
Old 03-12-2015, 12:36
HamletEagle
This message has been deleted by HamletEagle.
EpicKiller
Senior Member
Join Date: Jun 2014
Location: Constanta, Romania
Old 03-12-2015 , 12:49   Re: Setting models to a player
Reply With Quote #3

I see. I've seen some plugins working with models (weapon models, but I figured it's the same) and the path was stored in a static. Also, I followed a tutorial on setting models, so I don't really get what did I do so that variable stays empty. I'll edit the path as you mentioned and I'll review the code hoping that I'll find the issue.
__________________
~ Swiftly and with style ~

Last edited by EpicKiller; 03-12-2015 at 12:51.
EpicKiller is offline
Send a message via Yahoo to EpicKiller Send a message via Skype™ to EpicKiller
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-12-2015 , 13:08   Re: Setting models to a player
Reply With Quote #4

You can remove that new gPlayerModel[33][32]; , make only one constant where you put all models, and when the player select one store his choice in a variable like PlayerChoice. After that, to know what model he has use: constant_name[PlayerChoice], this will point you to the right model.
__________________
HamletEagle is offline
EpicKiller
Senior Member
Join Date: Jun 2014
Location: Constanta, Romania
Old 03-13-2015 , 06:23   Re: Setting models to a player
Reply With Quote #5

Like so?
Spoiler
__________________
~ Swiftly and with style ~
EpicKiller is offline
Send a message via Yahoo to EpicKiller Send a message via Skype™ to EpicKiller
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-13-2015 , 12:04   Re: Setting models to a player
Reply With Quote #6

No. If you still want to stick to your way(with more constants and not with just one) save his current model(when you assign it) inside gPlayerModel, this is what you are missing. You can use copy native for that purpose.
__________________
HamletEagle is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:39.


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