13.05.2011, 14:42
Hello..
I'm making Destruction Derby GM and i'm experiencing some problems.. I can't figure out how to get winner id under OnPlayerDeath.
Here's the script: http://pastebin.com/V7K76pkt
First bug: It gives points (PlayerInfo[i][points]) to everyone
Second bug: Winner is always with highest id (last id in score tab).
beidzies = round ended
atskaite = timer to new round
Is this a samp bug, or did i really made mistake somewhere?
GetAliveDrivingPlayers();
I'm making Destruction Derby GM and i'm experiencing some problems.. I can't figure out how to get winner id under OnPlayerDeath.
Here's the script: http://pastebin.com/V7K76pkt
First bug: It gives points (PlayerInfo[i][points]) to everyone
Second bug: Winner is always with highest id (last id in score tab).
pawn Код:
if(GetAliveDrivingPlayers()==1)
{
new name2[MAX_PLAYER_NAME];
for(new i=0;i<MAX_PLAYERS;i++)
{
if(PlayerInfo[i][dead]==0 || beidzies==0)
{
PlayerInfo[i][points]+=3;
GetPlayerName(i, name2, sizeof(name2));
}
}
atskaite=10;
format(string,sizeof(string),"Uzvarētājs: {00F7FF}%s",name2);
SendClientMessageToAll(COLOR_LGREEN,"*******Raunds beidzies*******");
SendClientMessageToAll(COLOR_LGREEN,string);
SendClientMessageToAll(COLOR_LGREEN,"Jauns raunds sāksies pēc 10 sekundēm!");
SendClientMessageToAll(COLOR_LGREEN,"*******Raunds beidzies*******");
beidzies=1;
atskaite = timer to new round
Is this a samp bug, or did i really made mistake somewhere?
GetAliveDrivingPlayers();
pawn Код:
forward GetAliveDrivingPlayers();
public GetAliveDrivingPlayers()
{
new pl,Float:hp;
for(new i=0;i<MAX_PLAYERS;i++)
{
GetPlayerHealth(i,hp);
if(IsPlayerConnected(i)&&IsPlayerNPC(i)==0&&IsPlayerInAnyVehicle(i)&&hp>0) pl++;
}
return pl;
}