Counting up - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Counting up (
/showthread.php?tid=220994)
Counting up -
Ice-cup - 04.02.2011
Код:
I want to make a system that if you enter a good answer you get 1 point, this points stack up and form a result.
At the position where an answer is given it says:
DrivingTheoryPoints[playerid] ++;
format(string, sizeof(string), "%s points",DrivingTheoryPoints[playerid]);
SendClientMessage(playerid, COLOR_RED, string);
And at the end:
Код:
switch(DrivingTheoryPoints[playerid])
{
case 0: ttext = "0";
case 1: ttext = "20";
case 2: ttext = "40";
case 3: ttext = "60";
case 4: ttext = "80";
case 5: ttext = "100";
}
format(string, sizeof(string), "%s points",ttext);
Unfortunately this doesn't work.
Both formats give wrong outcomes (and the first format gives nothing).
Re: Counting up -
Ice-cup - 06.02.2011
Update:
Putting the switch inside a different if(...) code doesn't work either, so I still got the same problem.
Re: Counting up -
MadeMan - 06.02.2011
pawn Код:
format(string, sizeof(string), "%s points",DrivingTheoryPoints[playerid]);
Change %s to %d.
pawn Код:
format(string, sizeof(string), "%d points",DrivingTheoryPoints[playerid]);
Re: Counting up -
Ice-cup - 06.02.2011
Gives me very weird things.
If the DrivingtheoryPoints ++ has been called 3 times, it gives different variables.
sometimes 11 sometimes 4.. very odd.
Re: Counting up - rjjj - 06.02.2011
I did it
pawn Код:
DrivingTheoryPoints[playerid]++;
format(string, sizeof(string), "%i points",DrivingTheoryPoints[playerid]);
SendClientMessage(playerid, COLOR_RED, string);
//The second code
new prhase[4];
switch(DrivingTheoryPoints[playerid])
{
case 0: format(prhase,4,"0");
case 1: format(prhase,4,"20");
case 2: format(prhase,4,"40");
case 3: format(prhase,4,"60");
case 4: format(prhase,4,"80");
case 5: format(prhase,4,"100");
}
format(string, sizeof(string), "%s points",prhase);
I hope that i have helped