Is there any shorter way to write that?
#2

pawn Код:
switch(iRace_Pos)
{
    case 1:
    {
        GivePlayerMoney(playerid,100000);
        format(PosString, sizeof(PosString),"{ffaa00}%s {ffffff}has finished the race {ffaa00}1st!",Max_Reward/iRace_Pos, GetName(playerid));
        SendClientMessageToAll(0xff0000, PosString);
    }
    case 2:
    {
        GivePlayerMoney(playerid,85000);
        format(PosString, sizeof(PosString),"{ffaa00}%s {ffffff}has finished the race {ffaa00}2nd!",Max_Reward/iRace_Pos, GetName(playerid));
        SendClientMessageToAll(0xff0000, PosString);
    }
    case 3:
    {
        GivePlayerMoney(playerid,75000);
        format(PosString, sizeof(PosString),"{ffaa00}%s {ffffff}has finished the race {ffaa00}3rd!",Max_Reward/iRace_Pos, GetName(playerid));
        SendClientMessageToAll(0xff0000, PosString);
    }
    case 4..21:
    {
        GivePlayerMoney(playerid,(200000/iRace_Pos));
        format(PosString, sizeof(PosString),"{ffaa00}%s {ffffff}has finished the race {ffaa00}%sth!",Max_Reward/iRace_Pos, GetName(playerid));
        SendClientMessageToAll(0xff0000, PosString);
    }
    ...
}
If I were you, I would first of all make it dynamic.
Reply


Messages In This Thread
Is there any shorter way to write that? - by nuriel8833 - 01.02.2012, 12:07
Re: Is there any shorter way to write that? - by T0pAz - 01.02.2012, 12:11
Re: Is there any shorter way to write that? - by -ExG-VirusKiller - 01.02.2012, 12:17
Re: Is there any shorter way to write that? - by nuriel8833 - 01.02.2012, 12:26

Forum Jump:


Users browsing this thread: 1 Guest(s)