Playerinfo Does'nt +1 - 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: Playerinfo Does'nt +1 (
/showthread.php?tid=433244)
Playerinfo Does'nt +1 -
AmsterdamCopsAndRobbers - 26.04.2013
hello thi is my code
pawn Код:
forward RobBank(playerid);
public RobBank(playerid)
{
new rand = random(130000)+0;
new string[64];
GivePlayerMoney(playerid,rand);
format(string,sizeof string,"Your robbed $%d from the Bank",rand);
SendClientMessage(playerid, -1, string);
PlayerInfo[playerid][pRobberies] +1; // error line
SendClientMessage(playerid, COLOR_GREEN, "You Rob the bank and now have 3 wanted level!");
TogglePlayerControllable(playerid,1);
return 1;
}
But i get an warn
C:\Users\Mustafa\Desktop\GTA Server AMCNR\gamemodes\AMCNR.pwn(101
: warning 215: expression has no effect
Re: Playerinfo Does'nt +1 -
AmsterdamCopsAndRobbers - 26.04.2013
Yes, But its actualy has a effect its +1 at him Data
Re: Playerinfo Does'nt +1 -
MP2 - 26.04.2013
First of all, what on earth is the point in adding 0 to a value?
Thirdly:
pawn Код:
forward RobBank(playerid);
public RobBank(playerid)
{
new rand = random(130000);
new string[64];
GivePlayerMoney(playerid, rand);
format(string, sizeof string, "Your robbed $%d from the bank!", rand);
SendClientMessage(playerid, -1, string);
PlayerInfo[playerid][pRobberies] ++;
SendClientMessage(playerid, COLOR_GREEN, "You robbed the bank and now have a wanted level of 3!");
TogglePlayerControllable(playerid, true);
return 1;
}
Fourthly, put spaces after commas so it's easier to read your code (just like when writing sentences!).
Re: Playerinfo Does'nt +1 -
Lordzy - 26.04.2013
This works:
pawn Код:
forward RobBank(playerid);
public RobBank(playerid)
{
new rand = random(130000)+0;
new string[64];
GivePlayerMoney(playerid,rand);
format(string,sizeof string,"Your robbed $%d from the Bank",rand);
SendClientMessage(playerid, -1, string);
PlayerInfo[playerid][pRobberies] += 1; // error line
SendClientMessage(playerid, COLOR_GREEN, "You Rob the bank and now have 3 wanted level!");
TogglePlayerControllable(playerid,1);
return 1;
}
The mistake is in doing '+', which doesn't works. It's '+=' which means current value + 1. You can also use '++' for doing +1 only and '--' for -1.
#Late post..
Re: Playerinfo Does'nt +1 -
AmsterdamCopsAndRobbers - 26.04.2013
Thanks Lordz +REP