AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Send function with param 2 (https://forums.alliedmods.net/showthread.php?t=278407)

Depresie 01-31-2016 05:43

[HELP] Send function with param 2
 
Can anyone explain to me why I get argument type mismatch (Argument 2) and (Argument 3) at the last on the red code?

Code:

#define Model1 "models/model1.mdl"
#define Model2 "models/model2.mdl"

public plugin_init()
{
        register_clcmd("say test", "function1")
}

public plugin_precache()
{
        precache_model(Model1)
        precache_model(Model2)
}

public function1(id)
{
        if(is_user_case_one(id)
        {
                function2(id, Model1)
        }
        else
        {
              function2(id, Model2)
        }
}

public function2(id, model)
{
            cs_set_player_weapon_model(id, CSW_KNIFE, model)
}


klippy 01-31-2016 07:25

Re: [HELP] Send function with param 2
 
Because you are passing strings (arrays) to a function that expects a single cell. Define your function2 as:
PHP Code:

function2(idmodel[]) 

(yes, also get rid of "public" in front)

Depresie 01-31-2016 07:44

Re: [HELP] Send function with param 2
 
thanks man :D problem solved ^_^


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

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