AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Assinging string to array (https://forums.alliedmods.net/showthread.php?t=22925)

Des12 01-06-2006 22:48

Assinging string to array
 
Hello, here is some of my code:

Code:
//in global new g_customTeam[33] = 0 //in plugin init register_concmd("gangwars_maketeam","makeTeam",0," <team name>") //later on public makeTeam(id) {         new message[192]     read_args(message,191)     remove_quotes(message)     //set_msg_arg_string ( message, g_customTeam[id] )     //set_msg_arg_string ( g_customTeam[id], message )     g_customTeam[id] += message         //code continues

I am having problems with "g_customTeam[id] = message". Sitatuion:

A player times in gangwars_maketeam Dest's Team
I tried to make it store the user's team as Dest's Team, but...

-with "g_customTeam[id] = message" it just comes out blank.
-with "set_msg_arg_string ( message, g_customTeam[id] )" it comes out as arguemnt mismatch
-with "g_customTeam[id] += message" it says message must be indexed.

I really do not know what to do, tried search and it came out with g_customTeam[id] += message, but I do not know where to go now.

Xanimos 01-06-2006 22:52

if its a string you need new g_customTeam[33][192]
and then in your functinon
add(g_customTeam[id] , 191 , message)

Des12 01-06-2006 23:09

Interesting. Well I did that, and it gave me an error on the g_customTeam[33][191] = 0

So I took off "= 0", and that removed that error. But now I have

g_team[id] = g_customTeam[id]

And I am not quite sure how to edit this to fit...

cybermind 01-07-2006 04:26

Sounds like you need to more fully understand strings in Pawn. Go to section 3 here.

ArchAngel_Antey 01-10-2006 17:14

Quote:

Originally Posted by Des12
Interesting. Well I did that, and it gave me an error on the g_customTeam[33][191] = 0

So I took off "= 0", and that removed that error. But now I have

g_team[id] = g_customTeam[id]

And I am not quite sure how to edit this to fit...

Aga.. Try to g_team[id] = g_customTeam if I understand you...
In Pawn string is array of char. If you want to create array of strings you need to type:
Code:

new MyArrayOfStrings[num][str]
, where num - max elements in array, and str - max symbols in string(As sqare array)


All times are GMT -4. The time now is 16:07.

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