SendClientMessage Seconds
#1

pawn Код:
SendClientMessage(playerid, COLOR_WHITE, "you have to stay 20 seconds");
can somebody tell me how to make number "20" decreasing ?

example: just like countdown 19, 18 ,17 , 16
Reply
#2

Make a timer which decreases a variable.
pawn Код:
new iNumber;
iNumber=20;//Set it to 20,so it will start from there
forward Countdown();
public Countdown()
{
   new msgString[128];//Number and the message to send
   iNumber--;
   format(msgString, sizeof(msgString), "You have to stay %d seconds.", iNumber);
   SendClientMessage(playerid, COLOR YOU WANT HERE ,msgString);
}
SetTimer("Countdown", 1000, true);//Will decrease iNumber by 1 every 1 second,and send the message
Reply
#3

didn't work
Reply
#4

Quote:
Originally Posted by AnonScripter
Посмотреть сообщение
didn't work
Sorry i forgot to add some arguments at SendClientMessage,try now.
Remember to add the color you want.
Reply
#5

pawn Код:
new Num = 20;
new Countdown[MAX_PLAYERS];

forward Count(playerid);
public Count(playerid)
{
       if(Num == 0)
       {
            KillTimer(Countdown[playerid]);
            SendClientMessage(playerid,colourhere,"stringhere");
       }
       else
       {
            Num--;
            new str[256];
            format(str,sizeof(str),"You have %d Seconds left",Num);
            SendClientMessage(playerid,color,str);
       }
       return 1;
}

//where you want this timer to start put this timer there

Countdown[playerid] = SetTimerEx("Count",1000,1,"d",playerid);
Reply
#6

Do you mean like this ? :-

SendClientMessage(s) Seconds (Code *Required*),
pawn Код:
SendClientMessage(playerid, COLOR_WHITE, "you have to stay 20 seconds");
SetTimer("twenty", 1000, 0);
SetTimer("nineteen", 2000, 0);
SetTimer("eighteen", 3000, 0);
SetTimer("seventeen", 4000, 0);
SetTimer("sixteen", 5000, 0);
SetTimer("fifteen", 6000, 0);
SetTimer("fourteen", 7000, 0);
SetTimer("thirteen", 8000, 0);
SetTimer("twelve", 9000, 0);
SetTimer("eleven", 10000, 0);
SetTimer("ten", 11000, 0);
SetTimer("nine", 12000, 0);
SetTimer("eight", 13000, 0);
SetTimer("seven", 14000, 0);
SetTimer("six", 15000, 0);
SetTimer("five", 16000, 0);
SetTimer("four", 17000, 0);
SetTimer("three", 18000, 0);
SetTimer("two", 19000, 0);
SetTimer("one", 20000, 0);
SetTimer("start", 21000, 0);
Forward and Public Callback for Countdown Timer for SendClientMessage(s) Seconds (without Freeze / UnFreeze),
pawn Код:
forward PlaySoundForPlayer(playerid, soundid);
public PlaySoundForPlayer(playerid, soundid)
{
    PlayerPlaySound(playerid,soundid, 0.0, 0.0, 0.0);
}

forward twenty(playerid);
public twenty(playerid)
{
        GameTextForPlayer(playerid, "~g~20",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward nineteen(playerid);
public nineteen(playerid)
{
        GameTextForPlayer(playerid, "~g~19",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward eighteen(playerid);
public eighteen(playerid)
{
        GameTextForPlayer(playerid, "~g~18",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward seventeen(playerid);
public seventeen(playerid)
{
        GameTextForPlayer(playerid, "~g~17",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward sixteen(playerid);
public sixteen(playerid)
{
        GameTextForPlayer(playerid, "~g~16",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward fifteen(playerid);
public fifteen(playerid)
{
        GameTextForPlayer(playerid, "~g~15",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward fourteen(playerid);
public fourteen(playerid)
{
        GameTextForPlayer(playerid, "~g~14",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward thirteen(playerid);
public thirteen(playerid)
{
        GameTextForPlayer(playerid, "~g~13",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward twelve(playerid);
public twelve(playerid)
{
        GameTextForPlayer(playerid, "~g~12",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}
forward eleven(playerid);
public eleven(playerid)
{
        GameTextForPlayer(playerid, "~g~11",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward ten(playerid);
public ten(playerid)
{
        GameTextForPlayer(playerid, "~g~10",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward eight(playerid);
public eight(playerid)
{
        GameTextForPlayer(playerid, "~g~9",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}
forward nine(playerid);
public nine(playerid)
{
        GameTextForPlayer(playerid, "~g~8",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward seven(playerid);
public seven(playerid)
{
        GameTextForPlayer(playerid, "~g~7",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward six(playerid);
public six(playerid)
{
        GameTextForPlayer(playerid, "~g~6",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward five(playerid);
public five(playerid)
{
        GameTextForPlayer(playerid, "~g~5",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward four(playerid);
public four(playerid)
{
        GameTextForPlayer(playerid, "~y~4",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward three(playerid);
public three(playerid)
{
        GameTextForPlayer(playerid, "~p~3",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward two(playerid);
public two(playerid)
{
        GameTextForPlayer(playerid, "~b~2",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward one(playerid);
public one(playerid)
{
        GameTextForPlayer(playerid, "~w~1",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward start(playerid);
public start(playerid)
{
        GameTextForPlayer(playerid, "~b~Start !",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}
Forward and Public Callback for Countdown Timer for SendClientMessage(s) Seconds (with Freeze / UnFreeze),
pawn Код:
SendClientMessage(playerid, COLOR_WHITE, "you have to stay 20 seconds");
SetTimer("twenty", 1000, 0);
SetTimer("nineteen", 2000, 0);
SetTimer("eighteen", 3000, 0);
SetTimer("seventeen", 4000, 0);
SetTimer("sixteen", 5000, 0);
SetTimer("fifteen", 6000, 0);
SetTimer("fourteen", 7000, 0);
SetTimer("thirteen", 8000, 0);
SetTimer("twelve", 9000, 0);
SetTimer("eleven", 10000, 0);
SetTimer("ten", 11000, 0);
SetTimer("nine", 12000, 0);
SetTimer("eight", 13000, 0);
SetTimer("seven", 14000, 0);
SetTimer("six", 15000, 0);
SetTimer("five", 16000, 0);
SetTimer("four", 17000, 0);
SetTimer("three", 18000, 0);
SetTimer("two", 19000, 0);
SetTimer("one", 20000, 0);
SetTimer("start", 21000, 0);

forward PlaySoundForPlayer(playerid, soundid);
public PlaySoundForPlayer(playerid, soundid)
{
    PlayerPlaySound(playerid,soundid, 0.0, 0.0, 0.0);
}

forward twenty(playerid);
public twenty(playerid)
{
        GameTextForPlayer(playerid, "~g~20",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward nineteen(playerid);
public nineteen(playerid)
{
        GameTextForPlayer(playerid, "~g~19",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward eighteen(playerid);
public eighteen(playerid)
{
        GameTextForPlayer(playerid, "~g~18",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward seventeen(playerid);
public seventeen(playerid)
{
        GameTextForPlayer(playerid, "~g~17",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward sixteen(playerid);
public sixteen(playerid)
{
        GameTextForPlayer(playerid, "~g~16",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward fifteen(playerid);
public fifteen(playerid)
{
        GameTextForPlayer(playerid, "~g~15",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward fourteen(playerid);
public fourteen(playerid)
{
        GameTextForPlayer(playerid, "~g~14",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward thirteen(playerid);
public thirteen(playerid)
{
        GameTextForPlayer(playerid, "~g~13",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward twelve(playerid);
public twelve(playerid)
{
        GameTextForPlayer(playerid, "~g~12",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}
forward eleven(playerid);
public eleven(playerid)
{
        GameTextForPlayer(playerid, "~g~11",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward ten(playerid);
public ten(playerid)
{
        GameTextForPlayer(playerid, "~g~10",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward eight(playerid);
public eight(playerid)
{
        GameTextForPlayer(playerid, "~g~9",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}
forward nine(playerid);
public nine(playerid)
{
        GameTextForPlayer(playerid, "~g~8",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward seven(playerid);
public seven(playerid)
{
        GameTextForPlayer(playerid, "~g~7",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward six(playerid);
public six(playerid)
{
        GameTextForPlayer(playerid, "~g~6",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward five(playerid);
public five(playerid)
{
        GameTextForPlayer(playerid, "~g~5",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward four(playerid);
public four(playerid)
{
        GameTextForPlayer(playerid, "~y~4",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward three(playerid);
public three(playerid)
{
        GameTextForPlayer(playerid, "~p~3",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward two(playerid);
public two(playerid)
{
        GameTextForPlayer(playerid, "~b~2",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward one(playerid);
public one(playerid)
{
        GameTextForPlayer(playerid, "~w~1",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward start(playerid);
public start(playerid)
{
        GameTextForPlayer(playerid, "~b~Start !",2000,3);
        TogglePlayerControllable(playerid, 1);
        PlaySoundForPlayer(1138);
        return 1;
}
Reply
#7

Quote:
Originally Posted by SAMProductions
Посмотреть сообщение
Do you mean like this ? :-

SendClientMessage(s) Seconds (Code *Required*),
pawn Код:
SendClientMessage(playerid, COLOR_WHITE, "you have to stay 20 seconds");
SetTimer("twenty", 1000, 0);
SetTimer("nineteen", 2000, 0);
SetTimer("eighteen", 3000, 0);
SetTimer("seventeen", 4000, 0);
SetTimer("sixteen", 5000, 0);
SetTimer("fifteen", 6000, 0);
SetTimer("fourteen", 7000, 0);
SetTimer("thirteen", 8000, 0);
SetTimer("twelve", 9000, 0);
SetTimer("eleven", 10000, 0);
SetTimer("ten", 11000, 0);
SetTimer("nine", 12000, 0);
SetTimer("eight", 13000, 0);
SetTimer("seven", 14000, 0);
SetTimer("six", 15000, 0);
SetTimer("five", 16000, 0);
SetTimer("four", 17000, 0);
SetTimer("three", 18000, 0);
SetTimer("two", 19000, 0);
SetTimer("one", 20000, 0);
SetTimer("start", 21000, 0);
Forward and Public Callback for Countdown Timer for SendClientMessage(s) Seconds (without Freeze / UnFreeze),
pawn Код:
forward PlaySoundForPlayer(playerid, soundid);
public PlaySoundForPlayer(playerid, soundid)
{
    PlayerPlaySound(playerid,soundid, 0.0, 0.0, 0.0);
}

forward twenty(playerid);
public twenty(playerid)
{
        GameTextForPlayer(playerid, "~g~20",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward nineteen(playerid);
public nineteen(playerid)
{
        GameTextForPlayer(playerid, "~g~19",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward eighteen(playerid);
public eighteen(playerid)
{
        GameTextForPlayer(playerid, "~g~18",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward seventeen(playerid);
public seventeen(playerid)
{
        GameTextForPlayer(playerid, "~g~17",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward sixteen(playerid);
public sixteen(playerid)
{
        GameTextForPlayer(playerid, "~g~16",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward fifteen(playerid);
public fifteen(playerid)
{
        GameTextForPlayer(playerid, "~g~15",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward fourteen(playerid);
public fourteen(playerid)
{
        GameTextForPlayer(playerid, "~g~14",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward thirteen(playerid);
public thirteen(playerid)
{
        GameTextForPlayer(playerid, "~g~13",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward twelve(playerid);
public twelve(playerid)
{
        GameTextForPlayer(playerid, "~g~12",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}
forward eleven(playerid);
public eleven(playerid)
{
        GameTextForPlayer(playerid, "~g~11",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward ten(playerid);
public ten(playerid)
{
        GameTextForPlayer(playerid, "~g~10",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward eight(playerid);
public eight(playerid)
{
        GameTextForPlayer(playerid, "~g~9",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}
forward nine(playerid);
public nine(playerid)
{
        GameTextForPlayer(playerid, "~g~8",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward seven(playerid);
public seven(playerid)
{
        GameTextForPlayer(playerid, "~g~7",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward six(playerid);
public six(playerid)
{
        GameTextForPlayer(playerid, "~g~6",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward five(playerid);
public five(playerid)
{
        GameTextForPlayer(playerid, "~g~5",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward four(playerid);
public four(playerid)
{
        GameTextForPlayer(playerid, "~y~4",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward three(playerid);
public three(playerid)
{
        GameTextForPlayer(playerid, "~p~3",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward two(playerid);
public two(playerid)
{
        GameTextForPlayer(playerid, "~b~2",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward one(playerid);
public one(playerid)
{
        GameTextForPlayer(playerid, "~w~1",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}

forward start(playerid);
public start(playerid)
{
        GameTextForPlayer(playerid, "~b~Start !",2000,3);
        PlaySoundForPlayer(1138);
        return 1;
}
Forward and Public Callback for Countdown Timer for SendClientMessage(s) Seconds (with Freeze / UnFreeze),
pawn Код:
SendClientMessage(playerid, COLOR_WHITE, "you have to stay 20 seconds");
SetTimer("twenty", 1000, 0);
SetTimer("nineteen", 2000, 0);
SetTimer("eighteen", 3000, 0);
SetTimer("seventeen", 4000, 0);
SetTimer("sixteen", 5000, 0);
SetTimer("fifteen", 6000, 0);
SetTimer("fourteen", 7000, 0);
SetTimer("thirteen", 8000, 0);
SetTimer("twelve", 9000, 0);
SetTimer("eleven", 10000, 0);
SetTimer("ten", 11000, 0);
SetTimer("nine", 12000, 0);
SetTimer("eight", 13000, 0);
SetTimer("seven", 14000, 0);
SetTimer("six", 15000, 0);
SetTimer("five", 16000, 0);
SetTimer("four", 17000, 0);
SetTimer("three", 18000, 0);
SetTimer("two", 19000, 0);
SetTimer("one", 20000, 0);
SetTimer("start", 21000, 0);

forward PlaySoundForPlayer(playerid, soundid);
public PlaySoundForPlayer(playerid, soundid)
{
    PlayerPlaySound(playerid,soundid, 0.0, 0.0, 0.0);
}

forward twenty(playerid);
public twenty(playerid)
{
        GameTextForPlayer(playerid, "~g~20",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward nineteen(playerid);
public nineteen(playerid)
{
        GameTextForPlayer(playerid, "~g~19",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward eighteen(playerid);
public eighteen(playerid)
{
        GameTextForPlayer(playerid, "~g~18",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward seventeen(playerid);
public seventeen(playerid)
{
        GameTextForPlayer(playerid, "~g~17",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward sixteen(playerid);
public sixteen(playerid)
{
        GameTextForPlayer(playerid, "~g~16",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward fifteen(playerid);
public fifteen(playerid)
{
        GameTextForPlayer(playerid, "~g~15",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward fourteen(playerid);
public fourteen(playerid)
{
        GameTextForPlayer(playerid, "~g~14",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward thirteen(playerid);
public thirteen(playerid)
{
        GameTextForPlayer(playerid, "~g~13",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward twelve(playerid);
public twelve(playerid)
{
        GameTextForPlayer(playerid, "~g~12",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}
forward eleven(playerid);
public eleven(playerid)
{
        GameTextForPlayer(playerid, "~g~11",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward ten(playerid);
public ten(playerid)
{
        GameTextForPlayer(playerid, "~g~10",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward eight(playerid);
public eight(playerid)
{
        GameTextForPlayer(playerid, "~g~9",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}
forward nine(playerid);
public nine(playerid)
{
        GameTextForPlayer(playerid, "~g~8",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward seven(playerid);
public seven(playerid)
{
        GameTextForPlayer(playerid, "~g~7",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward six(playerid);
public six(playerid)
{
        GameTextForPlayer(playerid, "~g~6",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward five(playerid);
public five(playerid)
{
        GameTextForPlayer(playerid, "~g~5",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward four(playerid);
public four(playerid)
{
        GameTextForPlayer(playerid, "~y~4",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward three(playerid);
public three(playerid)
{
        GameTextForPlayer(playerid, "~p~3",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward two(playerid);
public two(playerid)
{
        GameTextForPlayer(playerid, "~b~2",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward one(playerid);
public one(playerid)
{
        GameTextForPlayer(playerid, "~w~1",2000,3);
        TogglePlayerControllable(playerid, 0);
        PlaySoundForPlayer(1138);
        return 1;
}

forward start(playerid);
public start(playerid)
{
        GameTextForPlayer(playerid, "~b~Start !",2000,3);
        TogglePlayerControllable(playerid, 1);
        PlaySoundForPlayer(1138);
        return 1;
}
This will lag the player like anything , because you are setting 20 timers together for the player...

Thats why we use a timer which repeats itself so that it reduces lag because system doesnt need to handle 20 timers together there ....

I am not telling you are wrong but your code will lag the player for much time. I have used it too thats why i am telling.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)