Looping Pvars
#4

Quote:
Originally Posted by biltong
You don't need to make any variables with PVars, so where you use
Code:
Car[i]
is wrong. A simple loop would look like:
pawn Code:
for(new i; i < MAX_PLAYERS; i++)
{
    new string[64];
    format(string, sizeof(string), "Your variable: %i", GetPVarInt(i, "YourVariable");
    SendClientMessage(i, 0xFFFFFFFF, string);
}
I think you didnt understand what i wanted to do. The loop is not about max_players, but its about Car[Number]
--------------------------------------
Quote:
Originally Posted by Babul
using the SetPVar like this wont work, just format your PVariable string (its name) like u would for accessing a file:
Code:
	format(pvarstring,sizeof(pvarstring),"Car%d",carID);
then you can use that formatted name instead of the "Car[i]" to get being processed in any way:
Code:
	SetPVarInt(playerid,pvarstring,123)
	format(line,sizeof(line),"%s %d\r\n",pvarstring,GetPVarInt(TargetID,pvarstring));
thanks i bet this will work. I was thinking so much time, and it was so simple Thanks again.

EDIT: And yes it worked
Reply


Messages In This Thread
Looping Pvars - by Dark_Kostas - 05.04.2010, 09:00
Re: Looping Pvars - by Babul - 05.04.2010, 12:05
Re: Looping Pvars - by biltong - 05.04.2010, 12:11
Re: Looping Pvars - by Dark_Kostas - 05.04.2010, 15:46
Re: Looping Pvars - by Babul - 06.04.2010, 07:18

Forum Jump:


Users browsing this thread: 1 Guest(s)