Raised This Month: $32 Target: $400
 8% 

multidimensional char error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SztangaBiceps
Junior Member
Join Date: Nov 2015
Old 07-16-2018 , 13:48   multidimensional char error
Reply With Quote #1

Code:
char g_AllowedWeapon[2][32];

void SettingWeapon(const char[] sWeapon, int team)
{
	Format(g_AllowedWeapon[team-2], sizeof g_AllowedWeapon, "%s", sWeapon);
}

SettingWeapon("weapon_nova", 2);

Why this code:
Code:
PrintToChat(client, "%s, %s", g_AllowedWeapon[GetClientTeam(client)-2], sWeapon);
Give me result: w

Last edited by SztangaBiceps; 07-16-2018 at 13:49.
SztangaBiceps is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 07-16-2018 , 18:51   Re: multidimensional char error
Reply With Quote #2

sizeof g_AllowedWeapon would be 2. You probably want sizeof(g_AllowedWeapon[])
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
SztangaBiceps
Junior Member
Join Date: Nov 2015
Old 07-16-2018 , 19:16   Re: multidimensional char error
Reply With Quote #3

Ohh.. OMG! I'm so stupid!
It works, Thank You very much!
SztangaBiceps 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 03:14.


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