TextDrawSetString problem (if helped +rep) - 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: TextDrawSetString problem (if helped +rep) (
/showthread.php?tid=311879)
TextDrawSetString problem (if helped +rep) -
aqu - 18.01.2012
Hey,so I after player dies,I want,that his irs textdraw will update.
Код:
stock UpdateIRS()
{
new string[256];
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IRSupdate[i] == 1)
{
format(string,sizeof(string),"%d IRS",IRS[i]);
TextDrawSetString(IRStextdraw,string);
TextDrawShowForPlayer(i,IRStextdraw);
IRSupdate[i]=0;
}
}
}
But,after player dies,all players textdraws changes to the last player's irs textdraw.Help.
Re: TextDrawSetString problem (if helped +rep) -
Infamous - 18.01.2012
Set the textdraw per player rather than leaving it global.
pawn Код:
stock UpdateIRS()
{
new string[256];
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IRSupdate[i] == 1)
{
format(string,sizeof(string),"%d IRS",IRS[i]);
TextDrawSetString(IRStextdraw[i],string);
TextDrawShowForPlayer(i,IRStextdraw[i]);
IRSupdate[i]=0;
}
}
}
Re: TextDrawSetString problem (if helped +rep) -
aqu - 18.01.2012
Код:
C:\Users\Tadas\Desktop\Gang Wars\gamemodes\SSSGW.pwn(2506) : error 028: invalid subscript (not an array or too many subscripts): "IRStextdraw"
C:\Users\Tadas\Desktop\Gang Wars\gamemodes\SSSGW.pwn(2506) : warning 215: expression has no effect
C:\Users\Tadas\Desktop\Gang Wars\gamemodes\SSSGW.pwn(2506) : error 001: expected token: ";", but found "]"
C:\Users\Tadas\Desktop\Gang Wars\gamemodes\SSSGW.pwn(2506) : error 029: invalid expression, assumed zero
C:\Users\Tadas\Desktop\Gang Wars\gamemodes\SSSGW.pwn(2506) : fatal error 107: too many error messages on one line
full code:
Код:
new Text:IRStextdraw;
// on game mode int
IRStextdraw = TextDrawCreate(500.000000, 12.000000, "127 IRS");
TextDrawBackgroundColor(IRStextdraw, 255);
TextDrawFont(IRStextdraw, 1);
TextDrawLetterSize(IRStextdraw, 0.280000, 1.000000);
TextDrawColor(IRStextdraw, -1767449089);
TextDrawSetOutline(IRStextdraw, 1);
TextDrawSetProportional(IRStextdraw, 1);
//
stock UpdateIRS()
{
new string[256];
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IRSupdate[i] == 1)
{
format(string,sizeof(string),"%d IRS",IRS[i]);
TextDrawSetString(IRStextdraw[i],string);
TextDrawShowForPlayer(i,IRStextdraw[i]);
IRSupdate[i]=0;
}
}
}
Re: TextDrawSetString problem (if helped +rep) -
aqu - 18.01.2012
up..
Re: TextDrawSetString problem (if helped +rep) -
TheBetaFox - 18.01.2012
Код:
new Text:IRStextdraw[MAX_PLAYERS]; // change this
// move this to OnPlayerConnect, change it, too
IRStextdraw[playerid] = TextDrawCreate(500.000000, 12.000000, "127 IRS");
TextDrawBackgroundColor(IRStextdraw[playerid], 255);
TextDrawFont(IRStextdraw[playerid], 1);
TextDrawLetterSize(IRStextdraw[playerid], 0.280000, 1.000000);
TextDrawColor(IRStextdraw[playerid], -1767449089);
TextDrawSetOutline(IRStextdraw[playerid], 1);
TextDrawSetProportional(IRStextdraw[playerid], 1);
//
stock UpdateIRS()
{
new string[256];
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IRSupdate[i] == 1)
{
format(string,sizeof(string),"%d IRS",IRS[i]);
TextDrawSetString(IRStextdraw[i],string);
TextDrawShowForPlayer(i,IRStextdraw[i]);
IRSupdate[i]=0;
}
}
}