Raised This Month: $ Target: $400
 0% 

Load model by SteamId


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DarthMan
Veteran Member
Join Date: Aug 2011
Old 03-01-2017 , 15:14   Load model by SteamId
Reply With Quote #1

Hello. What's wrong no this script? It is supossed to change the player model in Team Fortress Classic from using vault, but I get argument(2) type mismatch for tfc_setmodel. Thanks for reading and I hope someone will help me.

Code:
public model_change(id)
{
    //Retrieve a single item from vault
    //Example: STEAM_0:0:1234 16000

    new szKey[40];
    formatex( szKey , charsmax( szKey ) , "%sMODEL" , g_szAuthID[id] );
    new iModel = nvault_get( g_Vault , szKey );

    //If our money key was found, set the users money to the value we read from vault and
    //delete the key so the player will not get the same money again.
    if ( iModel )
    {
        tfc_setmodel( id , iModel , "0" );
        nvault_remove( g_Vault , szKey );
    }
}
DarthMan is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-01-2017 , 15:50   Re: Load model by SteamId
Reply With Quote #2

You are trying to set an integer as a model.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
DarthMan
Veteran Member
Join Date: Aug 2011
Old 03-01-2017 , 15:52   Re: Load model by SteamId
Reply With Quote #3

Quote:
Originally Posted by OciXCrom View Post
You are trying to set an integer as a model.
AH yes, the model is not an integer, but a string.
DarthMan is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-01-2017 , 15:58   Re: Load model by SteamId
Reply With Quote #4

are you trying to set a player model or a weapon model? v_ or p_ ?
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
DarthMan
Veteran Member
Join Date: Aug 2011
Old 03-01-2017 , 16:06   Re: Load model by SteamId
Reply With Quote #5

Quote:
Originally Posted by Natsheh View Post
are you trying to set a player model or a weapon model? v_ or p_ ?
A player model, but all the possible tutorials that I could find on the web are with integers and values, not strings.
DarthMan is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-01-2017 , 17:26   Re: Load model by SteamId
Reply With Quote #6

PHP Code:
new iModel nvault_get(iVaultszKey)
// That's an integer.

new szModel[32]
nvault_get(iVaultszKeyszModelcharsmax(szModel))
// That's a string. 
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
DarthMan
Veteran Member
Join Date: Aug 2011
Old 03-01-2017 , 17:55   Re: Load model by SteamId
Reply With Quote #7

Quote:
Originally Posted by OciXCrom View Post
PHP Code:
new iModel nvault_get(iVaultszKey)
// That's an integer.

new szModel[32]
nvault_get(iVaultszKeyszModelcharsmax(szModel))
// That's a string. 
Ty a lot!
DarthMan is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 03-01-2017 , 18:08   Re: Load model by SteamId
Reply With Quote #8

Quote:
Originally Posted by DarthMan View Post
Ty a lot!
Code:
		new szModel[32];        //Data holder for the model amount
		
		g_Vault = nvault_open( "storemdlsteam" );
		get_user_authid( id , g_szAuthID , charsmax( g_szAuthID ) );
		
		get_user_info(id, "model", szModel, charsmax(szModel))  
		get_user_model(id,szModel,31);
		nvault_set( g_Vault , g_szAuthID , szModel );
		
		client_print(id, print_chat, "Model %s.", szModel);
The last problem, why aren't the details stored in the vault?
DarthMan is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 03-01-2017 , 18:11   Re: Load model by SteamId
Reply With Quote #9

Ah sorry, it works now, just had to remove a line from somewhere.
DarthMan 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 21:02.


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