Is there any shorter way to write that?
#1

Is there any shorter form of this code?
pawn Код:
if(iRace_Pos == 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);
            }
            else if(iRace_Pos == 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);
            }
            else if(iRace_Pos == 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);
            }
            else if(iRace_Pos > 3 || iRace_Pos < 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(iRace_Pos == 21)
            {
                format(PosString, sizeof(PosString),"{ffaa00}%s {ffffff}has finished the race {ffaa00}21st!",Max_Reward/iRace_Pos, GetName(playerid));
                SendClientMessageToAll(0xff0000, PosString);
            }
            else if(iRace_Pos == 22)
            {
                format(PosString, sizeof(PosString),"{ffaa00}%s {ffffff}has finished the race {ffaa00}22nd!",Max_Reward/iRace_Pos, GetName(playerid));
                SendClientMessageToAll(0xff0000, PosString);
            }
            else if(iRace_Pos == 23)
            {
                format(PosString, sizeof(PosString),"{ffaa00}%s {ffffff}has finished the race {ffaa00}23rd!",Max_Reward/iRace_Pos, GetName(playerid));
                SendClientMessageToAll(0xff0000, PosString);
            }
            else if(iRace_Pos > 23 || iRace_Pos < 31 || iRace_Pos == 34)
            {
                format(PosString, sizeof(PosString),"{ffaa00}%s {ffffff}has finished the race {ffaa00}%sth!",Max_Reward/iRace_Pos, GetName(playerid));
                SendClientMessageToAll(0xff0000, PosString);
            }
            if(iRace_Pos == 31)
            {
                format(PosString, sizeof(PosString),"{ffaa00}%s {ffffff}has finished the race {ffaa00}31st!",Max_Reward/iRace_Pos, GetName(playerid));
                SendClientMessageToAll(0xff0000, PosString);
            }
            else if(iRace_Pos == 32)
            {
                format(PosString, sizeof(PosString),"{ffaa00}%s {ffffff}has finished the race {ffaa00}32nd!",Max_Reward/iRace_Pos, GetName(playerid));
                SendClientMessageToAll(0xff0000, PosString);
            }
            else if(iRace_Pos == 33)
            {
                format(PosString, sizeof(PosString),"{ffaa00}%s {ffffff}has finished the race {ffaa00}33rd!",Max_Reward/iRace_Pos, GetName(playerid));
                SendClientMessageToAll(0xff0000, PosString);
            }
Thanks 4 helpers
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)