SA-MP Forums Archive
Saving multiple strings - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Saving multiple strings (/showthread.php?tid=582275)



Saving multiple strings - Glenn332 - 19.07.2015

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


AW: Saving multiple strings - BigBrainAFK - 19.07.2015

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?


Re: Saving multiple strings - Glenn332 - 19.07.2015

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.


Re: Saving multiple strings - Glenn332 - 20.07.2015

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


Re: Saving multiple strings - Glenn332 - 21.07.2015

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.


AW: Re: Saving multiple strings - Mencent - 21.07.2015

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


Re: AW: Re: Saving multiple strings - Glenn332 - 21.07.2015

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?


AW: Saving multiple strings - Mencent - 21.07.2015

Yes, it would work.

Also you can try that.


- Mencnet