Help please - 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: Help please (
/showthread.php?tid=259072)
Help please -
bartje01 - 02.06.2011
Hey all. I made a timer that updates a few things but when I use the update for my textdraw it doesnt show my score but someone elses score.
How to fix?
pawn Код:
public threetimer(playerid)
{
new text[10];
format(text, sizeof(text), "%d",PlayerInfo[playerid][pScore]);
TextDrawSetString(Textdraw1, text);
SetPlayerMoney(playerid,PlayerInfo[playerid][pCash]);
SetPlayerScore(playerid,PlayerInfo[playerid][pScore]);
return 1;
}
Re: Help please -
SchurmanCQC - 02.06.2011
You need some kind of for loop.
Re: Help please -
Famalamalam - 02.06.2011
You only have one textdraw for many players? Shouldn't:
pawn Код:
TextDrawSetString(Textdraw1, text);
be something like
pawn Код:
TextDrawSetString(Textdraw1[playerid], text);
Re: Help please -
futuretrucker - 02.06.2011
You can try this. I don't know if it will work tho.
pawn Код:
public threetimer(playerid)
{
for(new i; i<MAX_PLAYERS; i++)
{
new text[10];
format(text, sizeof(text), "%d",PlayerInfo[i][pScore]);
TextDrawSetString(Textdraw1, text);
SetPlayerMoney(playerid,PlayerInfo[i][pCash]);
SetPlayerScore(playerid,PlayerInfo[i][pScore]);
}
return 1;
}
Re: Help please -
bartje01 - 02.06.2011
Quote:
Originally Posted by futuretrucker
You can try this. I don't know if it will work tho.
pawn Код:
public threetimer(playerid) { for(new i; i<MAX_PLAYERS; i++) { new text[10]; format(text, sizeof(text), "%d",PlayerInfo[i][pScore]); TextDrawSetString(Textdraw1, text); SetPlayerMoney(playerid,PlayerInfo[i][pCash]); SetPlayerScore(playerid,PlayerInfo[i][pScore]); } return 1; }
|
With this code my textdraw keeps staying on 0
Re: Help please -
futuretrucker - 02.06.2011
Hm I am not sure then.
Re: Help please -
park4bmx - 02.06.2011
pawn Код:
public threetimer()
{
for(new playerid; playerid<MAX_PLAYERS; playerid++) //if it's a time u would need this so it works for all ur players not only I'd 0
{
new text[10];
format(text, sizeof(text), "%d",PlayerInfo[playerid][pScore]);
TextDrawSetString(Textdraw1[playerid],text); // the important part
SetPlayerMoney(playerid,PlayerInfo[playerid][pCash]);
SetPlayerScore(playerid,PlayerInfo[playerid][pScore]);
}
return 1;
}
Also remember
Textdraw1[playerid] this is like that so the textdraw string is for a player each if u see what I mean
And make sure to change the
new Textdraw1 to
new Textdraw1[MAX_PLAYERS]
Hope that's what u need
Re: Help please -
bartje01 - 02.06.2011
And then what do I have to do with this line?
Код:
Textdraw1 = TextDrawCreate(121.000000,435.000000,"1");
C:\Users\Bart\Desktop\SampScripting\gamemodes\Sunl ight.pwn(76) : error 033: array must be indexed (variable "Textdraw1")
Re: Help please -
bartje01 - 03.06.2011
How to fix?
Re: Help please -
park4bmx - 03.06.2011
pawn Код:
Textdraw1[playerid] = TextDrawCreate(121.000000,435.000000,"1");
Make sure is under OnPlayerConnect
not
OnGameModeInt or
OnFilterscriptInt because u will get errors