PVar question.
#1

I'll ask it simply.
I want to know if GetPVar is a function because I want to know if i should use the same "form" always OR
I should store the GetPVar in any variable and use it.
My question is related to multi use of PVars.
Example:
pawn Код:
new MyMoney = GetPVar(playerid,"Cash");
giveplayermoney(playerid,-MyMoney);
for(new i; i < MAX_PLAYERS, i++)
{
  if(IsPlayerConnected(i) && i != playerid)
  {
  giveplayermoney(i,MyMoney);
  format(string,sizeof(string),"You got %d from %s",MyMoney,PlayerName);
  sendclientmessage(i,color_white,string);
  }
}
Or
pawn Код:
giveplayermoney(playerid,-GetPVar(playerid,"Cash"));
for(new i; i < MAX_PLAYERS, i++)
{
  if(IsPlayerConnected(i) && i != playerid)
  {
  giveplayermoney(i,GetPVar(playerid,"Cash"));
  format(string,sizeof(string),"You got %d from %s",GetPVar(playerid,"Cash"),PlayerName);
  sendclientmessage(i,color_white,string);
  }
}
Reply
#2

It's GetPVarInt and what can it be except function?
Reply
#3

Quote:
Originally Posted by PoWerZ
I'll ask it simply.
I want to know if GetPVar is a function because I want to know if i should use the same "form" always OR
I should store the GetPVar in any variable and use it.
My question is related to multi use of PVars.
Example:
pawn Код:
new MyMoney = GetPVar(playerid,"Cash");
giveplayermoney(playerid,-MyMoney);
for(new i; i < MAX_PLAYERS, i++)
{
  if(IsPlayerConnected(i) && i != playerid)
  {
  giveplayermoney(i,MyMoney);
  format(string,sizeof(string),"You got %d from %s",MyMoney,PlayerName);
  sendclientmessage(i,color_white,string);
  }
}
Or
pawn Код:
giveplayermoney(playerid,-GetPVar(playerid,"Cash"));
for(new i; i < MAX_PLAYERS, i++)
{
  if(IsPlayerConnected(i) && i != playerid)
  {
  giveplayermoney(i,GetPVar(playerid,"Cash"));
  format(string,sizeof(string),"You got %d from %s",GetPVar(playerid,"Cash"),PlayerName);
  sendclientmessage(i,color_white,string);
  }
}
Dude, that script won't even compile, it's full of non-existing functions.
Reply
#4

Quote:
Originally Posted by PoWerZ
I'll ask it simply.
I want to know if GetPVar is a function because I want to know if i should use the same "form" always OR
I should store the GetPVar in any variable and use it.
GetPVar is not a function, cause it don't exist. The correct Functions are:

GetPVarInt
GetPVarFloat
GetPVarString

THESE ARE VALID FUNCTIONS, and like any function you can use her RETURN VALUE to assign it to a variable or to use directly as parameter of another function.

Hope it helps

P.S: Sorry for my poor english.

EDIT: More info here: https://sampwiki.blast.hk/wiki/Per-player_variable_system
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)