TextDrawSetString - 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 (
/showthread.php?tid=326895)
TextDrawSetString -
new121 - 19.03.2012
Ok so I am trying to set a string to a textdraw however it doesn't work here is the code I have can someone point out what the issue is and why the textdraw stays the same after a player dies or gets murdered by another player
under ongamemodeinit
pawn Код:
RoundTxtDrw = TextDrawCreate( 0, 435, " Allies: 0/0 Axis 0/0");
TextDrawFont(RoundTxtDrw , 1);
TextDrawLetterSize(RoundTxtDrw, 0.5, 1.5);
TextDrawColor(RoundTxtDrw, COLOR_WHITE);
TextDrawSetOutline(RoundTxtDrw , false);
TextDrawSetProportional(RoundTxtDrw , true);
TextDrawSetShadow(RoundTxtDrw , 1);
TextDrawUseBox(RoundTxtDrw, 1);
TextDrawBoxColor(RoundTxtDrw, 0x000000FF);
I show the player the textdraw under onplayerspawn
and here is where I set the string of the textdraw
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
pKills[killerid] ++;
pDeaths[playerid] ++;
if(roundinprogress == true)
{
new string[128];
SpawnInRound(playerid);
if(gTeam[playerid] == 0)
{
if(killerid == INVALID_PLAYER_ID)
{
AXISDEATHS ++;
}
if(killerid != INVALID_PLAYER_ID)
{
ALLIESKILLS ++;
}
}
if(gTeam[playerid] == 1)
{
if(killerid == INVALID_PLAYER_ID)
{
ALLIESDEATHS ++;
}
if(killerid != INVALID_PLAYER_ID)
{
AXISKILLS ++;
}
}
format(string, sizeof(string), " Allies: %i/%i Axis: %i/%i", ALLIESKILLS, ALLIESDEATHS, AXISKILLS, AXISDEATHS);
TextDrawSetString(RoundTxtDrw, string);
for(new t; t<MAX_PLAYERS; t++)
{
TextDrawShowForPlayer(t, RoundTxtDrw);
}
}
return 1;
}
Re: TextDrawSetString -
DarkScripter - 19.03.2012
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(IsPlayerConnect(playerid) || IsPlayerConnect(killerid)) // you use to don't crash's severs
{
pKills[killerid] ++;
pDeaths[playerid] ++;
if(roundinprogress == true)
{
new string[128];
SpawnInRound(playerid);
if(gTeam[playerid] == 0)
{
if(killerid == INVALID_PLAYER_ID)
{
AXISDEATHS ++;
}
if(killerid != INVALID_PLAYER_ID)
{
ALLIESKILLS ++;
}
}
if(gTeam[playerid] == 1)
{
if(killerid == INVALID_PLAYER_ID)
{
ALLIESDEATHS ++;
}
if(killerid != INVALID_PLAYER_ID)
{
AXISKILLS ++;
}
}
format(string, sizeof(string), " Allies: %i/%i Axis: %i/%i", ALLIESKILLS, ALLIESDEATHS, AXISKILLS, AXISDEATHS);
TextDrawSetString(RoundTxtDrw, string);
TextDrawShowForAll(RoundTxtDrw
}
}
return 1;
}
Re: TextDrawSetString -
-Rebel Son- - 19.03.2012
format(string, sizeof(string), " Allies: %d/%d Try that.
Re: TextDrawSetString -
new121 - 19.03.2012
It doesn't work either of those ways. maybe it has something to do with how I define my variables?
pawn Код:
new ALLIESKILLS;
new ALLIESDEATHS;
new AXISKILLS;
new AXISDEATHS;