AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED]get_pcvar_string compile error? (https://forums.alliedmods.net/showthread.php?t=135697)

Excalibur.007 08-18-2010 18:58

[SOLVED]get_pcvar_string compile error?
 
PHP Code:


// plugin_init()
cvar_bodyguard_weapon register_cvar("zp_bodyguard_weapon""deagle")
// end

// zp_round_started(gamemode, iRandomPlayer)
new sz_WeaponName[7]
get_pcvar_string(cvar_bodyguard_weaponsz_WeaponNamecharsmax(sz_WeaponName))

give_item(iRandomPlayer"weapon_%s"sz_WeaponName

I get an error.

Code:

Error: Number of arguments does not match definition
This line is giving me the compile error.
give_item(iRandomPlayer, "weapon_%s", sz_WeaponName)

ConnorMcLeod 08-18-2010 19:05

Re: get_pcvar_string compile error?
 
give_item needs a constant string as 2nd argument, you need to format it before.

Tip :

PHP Code:

new sz_WeaponName[20] = "weapon_"
get_pcvar_string(cvar_bodyguard_weaponsz_WeaponName[7], charsmax(sz_WeaponName)-7)

give_item(iRandomPlayersz_WeaponName


Excalibur.007 08-19-2010 09:15

Re: get_pcvar_string compile error?
 
Ohh. A new thing! Thanks. Works for me now. Title changed to [SOLVED]


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

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