Hi help with this script - 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: Hi help with this script (
/showthread.php?tid=370747)
Hi help with this script -
adrianxd - 21.08.2012
Hi guys
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;
}
What happens is that I do not use
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;
}
and I can not accommodate the script
as serious?
Re: Hi help with this script -
MP2 - 21.08.2012
Replace
GetPlayerTeam(i)
with
gTeam[i]
pretty simple.
You should also check if killerid != INVALID_PLAYER_ID in OnPlayerDeath otherwise it will cease to work for suicide.
P.S. nice translator.
Respuesta: Hi help with this script -
adrianxd - 21.08.2012
ty bro
P.S: sry my english is very very bad