21.08.2012, 04:42
Hi guys
I saw a script and I want to put in my gm
Script is a top5
What happens is that I do not use
GetPlayerTeam & GetPlayerScore in my gm
this is the variable use
and I can not accommodate the script
as serious?
I saw a script and I want to put in my gm
Script is a top5
pawn Код:
new PLAYER_VAR[3][MAX_PLAYERS];
stock ShowTopKillsForAll() {
SetTeamTopKills(-1);//todos
SetTeamTopKills(1); //team 1
SetTeamTopKills(2); //team 2
TextDrawShowForAll(Textdraw0);
TextDrawShowForAll(Textdraw1);
TextDrawShowForAll(Textdraw2);
TextDrawShowForAll(Textdraw7);
TextDrawShowForAll(Textdraw8);
TextDrawShowForAll(Textdraw9);
TextDrawShowForAll(Textdraw12);
return 1;
}
stock SetTeamTopKills(teamid) {
new const TOP = teamid == -1?(5):(3); //5 para global y 3 para los teams
new
pos,
str[64],
string[256];
for(new i=0, j = GetMaxPlayers(); i < j; i++) {
if(IsPlayerConnected(i)) {
if(GetPlayerTeam(i) == teamid || teamid == -1) {
PLAYER_VAR[0][pos] = i;
PLAYER_VAR[1][pos++] = GetPlayerScore(i); //cambiar GetPlayerScore por tu variable de kills (PlayerInfo[i][Kills])
}
}
}
OrdenarLista(PLAYER_VAR[1],PLAYER_VAR[1],PLAYER_VAR[2],.size = pos,.desc = true); //Funcion que ordena el score
pos = pos > TOP ? TOP: pos;
for(new i=0,name[MAX_PLAYER_NAME]; i < pos; i++) {
GetPlayerName(PLAYER_VAR[0][PLAYER_VAR[2][i]],name,MAX_PLAYER_NAME);
format(str,sizeof(str),"%d: %s %d~n~",i+1,name,PLAYER_VAR[1][i]);
strcat(string,str);
}
switch(teamid) {
case -1: TextDrawSetString(Text:Textdraw2,string);
case 1: TextDrawSetString(Text:Textdraw9, string);
case 2: TextDrawSetString(Text:Textdraw12,string);
}
return pos;
}
GetPlayerTeam & GetPlayerScore in my gm
this is the variable use
pawn Код:
static gTeam[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
if(gTeam[killerid] == TEAM_1) 1score++;
if(gTeam[killerid] == TEAM_2 ) 2score++;
if(gTeam[killerid] == gTeam[playerid])
return 1;
}
as serious?