public OnPlayerDeath(playerid, killerid, reason) { SendDeathMessage(killerid,reason,playerid); SetPlayerScore(killerid,GetPlayerScore(killerid)+1); if(GetPlayerTeam(killerid) == 1) { RussiaScore++; //Sets team1score new newtext[41]; RussiaScore = GetPlayerScore(playerid); USAScore = GetPlayerScore(playerid); format(newtext, sizeof(newtext), "USA's Score: %d", RussiaScore); TextDrawSetString(Text:Textdraw0, newtext); } if(GetPlayerTeam(killerid) == 2) { USAScore++; //Sets team2score new newtext[41]; USAScore = GetPlayerScore(playerid); RussiaScore = GetPlayerScore(playerid); format(newtext, sizeof(newtext), "Russia's Score: %d", USAScore); TextDrawSetString(Text:Textdraw1, newtext); } if(RussiaScore == 5 || USAScore == 5) { SendRconCommand("gmx"); //Restarts Server } return 1; }
make a function that refreshes everyone textdraws, because you need to show/hide textdraws for them to update, so just make like a ShowHideTD or something, then call it at the end of OnPlayerDeath
|
stock ShowHideTD(Text:td)
{
TextDrawHideForAll(td);
TextDrawShowForAll(td);
}
public OnPlayerDeath(playerid, killerid, reason) { SendDeathMessage(killerid,reason,playerid); SetPlayerScore(killerid,GetPlayerScore(killerid)+1); ShowHideTD(Textdraw0); ShowHideTD(Textdraw1); if(GetPlayerTeam(killerid) == 1) { RussiaScore++; //Sets team1score new newtext[41]; RussiaScore = GetPlayerScore(playerid); USAScore = GetPlayerScore(playerid); format(newtext, sizeof(newtext), "USA's Score: %d", RussiaScore); TextDrawSetString(Text:Textdraw0, newtext); } if(GetPlayerTeam(killerid) == 2) { USAScore++; //Sets team2score new newtext[41]; USAScore = GetPlayerScore(playerid); RussiaScore = GetPlayerScore(playerid); format(newtext, sizeof(newtext), "Russia's Score: %d", USAScore); TextDrawSetString(Text:Textdraw1, newtext); } if(RussiaScore == 50 || USAScore == 50) { SendRconCommand("gmx"); //Restarts Server } return 1; } stock ShowHideTD(Text:td) { TextDrawHideForAll(Textdraw0); TextDrawHideForAll(Textdraw1); TextDrawShowForAll(Textdraw0); TextDrawShowForAll(Textdraw1); }
C:\Documents and Settings\Chris\Desktop\SAMP Server\gamemodes\WorldWar.pwn(339) : warning 203: symbol is never used: "td" C:\Documents and Settings\Chris\Desktop\SAMP Server\gamemodes\WorldWar.pwn(417) : warning 217: loose indentation Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 2 Warnings.
public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid,reason,playerid);
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
if(GetPlayerTeam(killerid) == 1)
{
RussiaScore++; //Sets team1score
new newtext[41];
RussiaScore = GetPlayerScore(playerid);
USAScore = GetPlayerScore(playerid);
format(newtext, sizeof(newtext), "USA's Score: %d", RussiaScore);
TextDrawSetString(Text:Textdraw0, newtext);
}
if(GetPlayerTeam(killerid) == 2)
{
USAScore++; //Sets team2score
new newtext[41];
USAScore = GetPlayerScore(playerid);
RussiaScore = GetPlayerScore(playerid);
format(newtext, sizeof(newtext), "Russia's Score: %d", USAScore);
TextDrawSetString(Text:Textdraw1, newtext);
}
if(RussiaScore == 5 || USAScore == 5)
{
SendRconCommand("gmx"); //Restarts Server
}
ShowHideTD(Textdraw0);
ShowHideTD(Textdraw1);
return 1;
}
stock ShowHideTD(Text:td)
{
TextDrawHideForAll(td);
TextDrawShowForAll(td);
}
sigh
pawn Код:
|