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", msg2, sizeof(msg2));
format(msg, sizeof(msg), "%s RWR %s\n", name, name2);
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 i = 0; i <= 50; i++ )
{
if(rawrs[playerid] != 0 ) {
format(string, sizeof(string), "%s", rawrs[playerid]);
SendClientMessage(playerid, COLOR, string);
}
}
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;i < 50; i++ )
{
if(rawrs[playerid][i] != 0 ) {
format(string, sizeof(string), "%s", rawrs[playerid][i]);
SendClientMessage(playerid, COLOR, string);
}
}
Would that work?
AW: Saving multiple strings -
Mencent - 21.07.2015
Yes, it would work.
Also you can try that.
- Mencnet