Random Player
#7

You can use my include.
Example:
pawn Code:
#include <IRC>
#include <a_samp>

new RandomList:PlayersRandomList;

public OnPlayerConnect(playerid)
{
    AddItemsToRandomList(PlayersRandomList, playerid);
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    RemoveItemsFromRandomList(PlayersRandomList, playerid);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    new msg[128], randomhitforplayer = RandomNumberFromList(PlayersRandomList);
    if(randomlistforplayer != INVALID_RANDOM_NUMBER)
    {
                GetPlayerName(randomhitforplayer, msg, MAX_PLAYER_NAME);
        format(msg, sizeof msg, "You have a new hit! Kill {FF4040}%s{FFFFFF}!", msg);
        SendClientMessage(playerid, -1, msg);
        Hit[playerid] = randomhitforplayer;    
    }
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsPlayerConnected(killerid))
    {
        if(Hit[killerid] == playerid)
        {
            new msg[128], randomhitforplayer = RandomNumberFromList(PlayersRandomList);
            Hit[killerid] = randomhitforplayer;
            GetPlayerName(playerid, msg, MAX_PLAYER_NAME);
            format(msg, sizeof msg, "You killed %s and earned 500$", msg);
            SendClientMessage(killerid, -1, msg);
            format(msg, sizeof msg, "You have a new hit to do! Kill {FF4040}%s{FFFFFF}!", msg);
            SendClientMessage(killerid, -1, msg);
        }
    }
}
Reply


Messages In This Thread
Random Player - by geerdinho8 - 14.07.2011, 19:24
Re: Random Player - by Ricop522 - 14.07.2011, 19:33
Re: Random Player - by iggy1 - 14.07.2011, 19:45
Re: Random Player - by Shadoww5 - 14.07.2011, 20:31
Re: Random Player - by geerdinho8 - 17.07.2011, 02:30
Re: Random Player - by =WoR=Varth - 17.07.2011, 02:46
Re: Random Player - by CyNiC - 17.07.2011, 02:50
Re: Random Player - by geerdinho8 - 17.07.2011, 03:11
Re: Random Player - by =WoR=Varth - 17.07.2011, 03:14
Re: Random Player - by geerdinho8 - 17.07.2011, 03:17

Forum Jump:


Users browsing this thread: 2 Guest(s)