AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Load model by SteamId (https://forums.alliedmods.net/showthread.php?t=294548)

DarthMan 03-01-2017 15:14

Load model by SteamId
 
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 );
    }
}


OciXCrom 03-01-2017 15:50

Re: Load model by SteamId
 
You are trying to set an integer as a model.

DarthMan 03-01-2017 15:52

Re: Load model by SteamId
 
Quote:

Originally Posted by OciXCrom (Post 2499859)
You are trying to set an integer as a model.

AH yes, the model is not an integer, but a string.

Natsheh 03-01-2017 15:58

Re: Load model by SteamId
 
are you trying to set a player model or a weapon model? v_ or p_ ?

DarthMan 03-01-2017 16:06

Re: Load model by SteamId
 
Quote:

Originally Posted by Natsheh (Post 2499861)
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.

OciXCrom 03-01-2017 17:26

Re: Load model by SteamId
 
PHP Code:

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

new szModel[32]
nvault_get(iVaultszKeyszModelcharsmax(szModel))
// That's a string. 


DarthMan 03-01-2017 17:55

Re: Load model by SteamId
 
Quote:

Originally Posted by OciXCrom (Post 2499881)
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 03-01-2017 18:08

Re: Load model by SteamId
 
Quote:

Originally Posted by DarthMan (Post 2499888)
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 03-01-2017 18:11

Re: Load model by SteamId
 
Ah sorry, it works now, just had to remove a line from somewhere.


All times are GMT -4. The time now is 21:02.

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