Most wanted
#4

First you will need to create your textdraws then declarate your vars.
Код:
new pWanted[MAX_PLAYERS];
new Text3D:NameTag;[MAX_PLAYERS];
Under OnPlayerConnect
Код:
pWanted[playerid] = 0;
Under OnPlayerDeath

Код:
pWanted[killerid] += 1;
if(pWanted[killerid] == 5)
{
    SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid)+1);
}
Код:
GetMostWantedPlayer() // Function by SuperVIper
{
    new highPlayerWantedLevel, player = INVALID_PLAYER_ID, wl;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            wl = GetPlayerWantedLevel(i);
            if(wl > highPlayerWantedLevel)
            {
                highPlayerWantedLevel = wl, player = i;
            }
        }
    }
    return player;
}
Under OnGameModeInit
Код:
SetTimer("checkmostwantedplayer", 1000, true);
Код:
forward checkmostwantedplayer(playerid);
public checkmostwantedplayer()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            new score[128], name[MAX_PLAYER_NAME];
            GetPlayerName(i, name, sizeof(name));
            format(score, sizeof(score), "MostWanted: %s(%d)",name, GetPlayerWantedLevel(i));
            NameTag[playerid] = Create3DTextLabel(string, 0xFFFFFFFF, 0, 0, 0, 40, 0, 1 );
            Attach3DTextLabelToPlayer(NameTag[playerid], playerid, 0.0, 0.0, 0.2); // With Label
        }
    }
    return 1;
}
I'm from school so you will need to test
Reply


Messages In This Thread
Most wanted - by MahdiGames - 16.01.2014, 07:34
Re: Most wanted - by MatriXgaMer - 16.01.2014, 07:46
Re: Most wanted - by DaniceMcHarley - 16.01.2014, 07:57
Re: Most wanted - by RenSoprano - 16.01.2014, 08:02
Re: Most wanted - by MahdiGames - 16.01.2014, 08:04
Re: Most wanted - by SilentSoul - 16.01.2014, 08:05
Re: Most wanted - by MahdiGames - 16.01.2014, 08:13
Re: Most wanted - by SilentSoul - 16.01.2014, 08:20
Re: Most wanted - by MahdiGames - 16.01.2014, 12:01

Forum Jump:


Users browsing this thread: 1 Guest(s)