Problems with getting correct id/name
#1

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).
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;
beidzies = round ended
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;
}
Reply


Messages In This Thread
Problems with getting correct id/name - by SaW_[VrTx] - 13.05.2011, 14:42
AW: Problems with getting correct id/name - by Nero_3D - 13.05.2011, 15:03
Re: Problems with getting correct id/name - by SaW_[VrTx] - 13.05.2011, 15:38
Re: Problems with getting correct id/name - by SaW_[VrTx] - 14.05.2011, 17:34
AW: Problems with getting correct id/name - by Nero_3D - 14.05.2011, 22:57
Re: AW: Problems with getting correct id/name - by SaW_[VrTx] - 15.05.2011, 14:38

Forum Jump:


Users browsing this thread: 1 Guest(s)