Raised This Month: $ Target: $400
 0% 

Assinging string to array


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Des12
Senior Member
Join Date: Jan 2005
Old 01-06-2006 , 22:48   Assinging string to array
Reply With Quote #1

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.
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 01-06-2006 , 22:52  
Reply With Quote #2

if its a string you need new g_customTeam[33][192]
and then in your functinon
add(g_customTeam[id] , 191 , message)
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Des12
Senior Member
Join Date: Jan 2005
Old 01-06-2006 , 23:09  
Reply With Quote #3

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...
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
cybermind
Senior Member
Join Date: Oct 2004
Old 01-07-2006 , 04:26  
Reply With Quote #4

Sounds like you need to more fully understand strings in Pawn. Go to section 3 here.
cybermind is offline
ArchAngel_Antey
Junior Member
Join Date: Dec 2005
Old 01-10-2006 , 17:14  
Reply With Quote #5

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)
ArchAngel_Antey is offline
Reply


Thread Tools
Display Modes

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 16:07.


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