HELP WITH RANDOM PICKUPS SISTEM
#8

pawn Код:
if(1240 == 1)
This line of code is redudant. You don't need need the compiler to tell you that 1240 is NOT equal to 1, do you?

pawn Код:
new HeartPickup; // a global variable
new bool:IsHeartEventWinner[MAX_PLAYERS]; // a global array.

CMD:somevent(playerid,params[]) // you mentioned it should be like an event.
{
     if(IsPlayerAdmin(playerid)) // you probably don't want to let anyone create these events
     {
           SendClientMessageToAll(0xFF0000FF,"Some event has been started");
           HeartPickup = CreatePickup(1240, 1, x,y,z,-1); // change x,y,z to your positions
           IsHeartEventWinner[SelectRandomPlayer()] = true;
     }
     return 1;
}

public OnPlayerPickUpPickup(playerid,pickupid)
{
    if(pickupid == HeartPickup) // If its the heart pickup, not some other.
    {
            if(IsHeartEventWinner[playerid] == false)
            {
                   SendClientMessage(playerid,0xFF0000FF,"BAD");
            }
            else
            {
                   SendClientMessage(playerid,0x00FF00FF,"Good");
                   DestroyPickup(HeartPickup);
             }
    }
}

stock SelectRandomPlayer() // I found this function in forums.
{
     new random = Random(MAX_PLAYERS);
     if(IsPlayerConnected(random))
     {
           return random;
     }
     else
     {
           SelectRandomPlayer();
     }
}
Reply


Messages In This Thread
HELP WITH RANDOM PICKUPS SISTEM - by buburuzu19 - 08.09.2014, 14:36
Re: HELP WITH RANDOM PICKUPS SISTEM - by dusk - 08.09.2014, 14:58
Re: HELP WITH RANDOM PICKUPS SISTEM - by DavidBilla - 08.09.2014, 14:58
Re: HELP WITH RANDOM PICKUPS SISTEM - by buburuzu19 - 08.09.2014, 15:06
Re: HELP WITH RANDOM PICKUPS SISTEM - by DavidBilla - 08.09.2014, 15:39
Re: HELP WITH RANDOM PICKUPS SISTEM - by dusk - 08.09.2014, 15:44
Re: HELP WITH RANDOM PICKUPS SISTEM - by buburuzu19 - 09.09.2014, 06:35
Re: HELP WITH RANDOM PICKUPS SISTEM - by dusk - 09.09.2014, 08:15
Re: HELP WITH RANDOM PICKUPS SISTEM - by buburuzu19 - 09.09.2014, 11:45
Re: HELP WITH RANDOM PICKUPS SISTEM - by dusk - 09.09.2014, 13:07

Forum Jump:


Users browsing this thread: 1 Guest(s)