make this shorter?
#6

Quote:
Originally Posted by (SF)Noobanatior
Посмотреть сообщение
how is this
pawn Код:
forward Go(playerid);
new GoTimer[MAX_PLAYERS],GoTCount,GTStr[10];
public Go(playerid){
    switch(GoTCount){
        case 0:{
            GTStr = "~g~GO!!";
            KillTimer(GoTimer[playerid]);
            GoTimer[playerid] = 0;
        }
        default:format(GTStr,sizeof(GTStr),"~r~%d",g);
    }
    GameTextForAll(GTStr,3000,4);
    SoundForAll(1056);
    GoTCount--;
    return 1;
}

// up to go

COMMAND:countdown(playerid, params[])
{
    if(Countdown == 1) return SendClientMessage(playerid, Red, "countdown already on");
    SendClientMessage(playerid, Green, "count started");
    GoTimer[playerid] = SetTimer("Go",4000,1,"i",playerid);
    Countdown = 1;
    GoTCount = 5;
    return 1;
}
Timer and countdown variables? SIMPLIFICATION FAIL.

pawn Код:
forward Go();
new GoTCount, GTStr[10];
public Go(){
    switch(GoTCount){
        case 0: GTStr = "~g~GO!!";
        default:format(GTStr,sizeof(GTStr),"~r~%d",GoTCount);
    }
    GameTextForAll(GTStr,1500,4);
    SoundForAll(1056);
    if(GoTCount > 0)
    {
        GoTCount--;
        SetTimer("Go",1000,0);
    }
    return 1;
}

// up to go

COMMAND:countdown(playerid, params[])
{
    if(GoTCount != 0) return SendClientMessage(playerid, Red, "countdown already on");
    SendClientMessage(playerid, Green, "count started");
    SetTimer("Go",1000,0);
    GoTCount = 5;
    return 1;
}
Reply


Messages In This Thread
make this shorter? - by fissekarl - 22.05.2011, 18:43
Re: make this shorter? - by fissekarl - 23.05.2011, 10:42
Re: make this shorter? - by (SF)Noobanatior - 23.05.2011, 11:08
Re: make this shorter? - by fissekarl - 23.05.2011, 12:43
Re: make this shorter? - by Seven_of_Nine - 23.05.2011, 13:09
Re: make this shorter? - by Austin - 23.05.2011, 13:36
Re: make this shorter? - by fissekarl - 23.05.2011, 13:55
Re: make this shorter? - by Austin - 23.05.2011, 14:21
Re: make this shorter? - by fissekarl - 23.05.2011, 16:17

Forum Jump:


Users browsing this thread: 1 Guest(s)