Saving multiple strings
#1

So right now I am using SetPVarString but thats limited to 1024 character(If I am right) like for example

PHP код:
GetPVarString(playerid"RAWR"msg2sizeof(msg2));
format(msgsizeof(msg), "%s RWR %s\n"namename2);
strcat(msg2,msg);
SetPVarString(playerid"RAWR"msg2); 
Is there a way not speaking of PVars but something so that I can make like
new rawrs[MAX_PLAYERS];

And like add a total of numbers to it so I can later extract with

PHP код:
for( new 0<= 50i++ )
    {
       if(
rawrs[playerid] != ) {
           
format(stringsizeof(string), "%s"rawrs[playerid]);
           
SendClientMessage(playeridCOLORstring);
           }
    } 
I hope someone understand what im trying to ask :O
Reply
#2

so you want to have like rawrs[0] to rawrs[100] an everything contains something from another player.

And then you want to extract rawrs[66] for example?
Reply
#3

Yeah but I dont want to extract just 1 I want to extract all, and yeah it needs to get saved to a certain player yes.
Reply
#4

I need something like rawrs[MAX_PLAYERS][100] is this possible? anyone?
Reply
#5

Edit* Woops its not 24 hours yet :S didnt know.

Third time's the charm, Basically what I would want is when I type a CMD the params of that would get saved to a variable and everytime you use that command it gets saved again so I could later retrieve all the strings from what that guy has typed after that CMD.
Reply
#6

Hello!

Quote:
Originally Posted by Glenn332
Посмотреть сообщение
I need something like rawrs[MAX_PLAYERS][100] is this possible? anyone?
Yes, it is possible.

You have to create a global variable:
PHP код:
new AllCommands[MAX_PLAYERS][100]; 
Now, you can save 100 Commands (so the params) for each user.

Do you know how you save this?
Here is a solution:
PHP код:
//in the command
for(new i;i<100;i++)
{
    if(
strlen(AllCommands[playerid][i]) > 0)continue;
    
format(AllCommands[playerid][i],128,params);
    break;

- Mencent
Reply
#7

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Hello!


Yes, it is possible.

You have to create a global variable:
PHP код:
new AllCommands[MAX_PLAYERS][100]; 
Now, you can save 100 Commands (so the params) for each user.

Do you know how you save this?
Here is a solution:
PHP код:
//in the command
for(new i;i<100;i++)
{
    if(
strlen(AllCommands[playerid][i]) > 0)continue;
    
format(AllCommands[playerid][i],128,params);
    break;

- Mencent
Ah finally, This is great and to retrieve it to like sendclientmessage(playerid etc it (I know spam) would be the same kinda as how you would save it?

Maybe something like:

PHP код:
for( new i;50i++ ) 
    { 
       if(
rawrs[playerid][i] != ) { 
           
format(stringsizeof(string), "%s"rawrs[playerid][i]); 
           
SendClientMessage(playeridCOLORstring); 
           } 
    } 
Would that work?
Reply
#8

Yes, it would work.

Also you can try that.


- Mencnet
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)