How to make goldpot minigame
#1

i was wondering... how can i make this minigame...
on top:
pawn Код:
new goldpotpickup;
in ongamemodeint:
pawn Код:
SetTimer("GoldPot", 180000, true);
and in Goldpot
pawn Код:
forward GoldPot(playerid);
public GoldPot(playerid)
{
    switch(random(4))//
    {
    if(case 0)
        {
                 //my funct here
        }
    else if(case 1)
        {
               //my funct here
        }
    else if(case 2)
        {
                 //my funct here
        }
    else if(case 3)
        {
                //my funct here
        }
    }
}
and
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == goldpotpickup)
    {
    GivePlayerMoney(playerid,10000);
    SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
    DestroyPickup(goldpotpickup);
    new name[MAX_PLAYER_NAME], string[44];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "%s has Won Goldpot! ($10000+1 score)!",name);
    SendClientMessageToAll(COLOR_GREEN, string);
        return 1;
    }
    return 0;
}
i got some erros:

Код:
(592): error 002: only a single statement (or expression) can follow each "case"
(592) : error 029: invalid expression, assumed zero
(592) : error 029: invalid expression, assumed zero
(592) : fatal error 107: too many error messages on one line
error line is here:

pawn Код:
forward GoldPot(playerid);
public GoldPot(playerid)
{
    switch(random(4))//
    {
    if(case 0) //error line
        {
                //myfucnt
        }
    else if(case 1)
        {
                //myfunct
        }
    else if(case 2)
        {
                //myfunct
        }
    else if(case 3)
        {
                //myfunct
        }
    }
}
Reply
#2

It's not if(case), but its case:

So:

pawn Код:
case 0:
{
    First
}
case 1:
{
    Second
}
Reply
#3

thanks
it worked!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)