String Arrays?
#1

I am trying to figure out if I can store a string to an array. Basically when somebody joins the IRC Channel they are assigned an ID and their name is stored in that ID. This is what I have right now...

pawn Код:
// Top of Script
new MAX_USERS = 50;
new CurrentUsers = 0;
new Users[MAX_USERS]; // Line 45

// Inside Script
public ircOnUserJoin(conn, channel[], user[])
{
    new JoinMsg1[150];
    new JoinMsg2[50];
    format(JoinMsg1, sizeof(JoinMsg1), "Hey %s! Welcome to the Parallel Universe:Deathmach IRC Channel!", user);
    format(JoinMsg2, sizeof(JoinMsg2), "Your current IRC User ID is %i! Have Fun!", CurrentUsers);
    Users[CurrentUsers] = user; // Line 17120
    return 1;
}
But then I get:

Код:
C:\Documents and Settings\Mike C\Desktop\SAMP Server\ParUni\gamemodes\basics.pwn(45) : error 008: must be a constant expression; assumed zero
C:\Documents and Settings\Mike C\Desktop\SAMP Server\ParUni\gamemodes\basics.pwn(45) : error 009: invalid array size (negative, zero or out of bounds)
C:\Documents and Settings\Mike C\Desktop\SAMP Server\ParUni\gamemodes\basics.pwn(17120) : error 006: must be assigned to an array

So is there anyone who knows how I can achieve something like this? Any help is appreciated!

Thanks,
-Mike
Reply


Messages In This Thread
String Arrays? - by lavamike - 13.06.2009, 22:40
Re: String Arrays? - by miokie - 13.06.2009, 22:46

Forum Jump:


Users browsing this thread: 1 Guest(s)