SA-MP Forums Archive
how to show timer in gametext? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: how to show timer in gametext? (/showthread.php?tid=315892)



how to show timer in gametext? - niels44 - 04.02.2012

hey guys,
yes another question XD im scripting very much today XD

i have made it that when a player is in dealmode( /deal) and when he exits his car it says: get back in your car or you lose your job;
and i have made a timer which will auto disable the work he has after 15 seconds..
but how to put those 15 seconds on the screen as gametext?
like it is ticking of and the player can see it...
can anyone tell me how i have to do this?

codes:
pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
    if( DealEnable[ playerid ] == 1 ){
    SetTimerEx("StopDeal", 20000, 0, "d", playerid);
    SendClientMessage(playerid, COLOR_RED, "Go back in your car!, else you will lose your Job!!");
    StopAudioStreamForPlayer(playerid);
    }
    return 1;
}
public StopDeal(playerid)
{
    SetPlayerWantedLevel(playerid, 0);
    DealEnable[ playerid ] = 0;
    SendClientMessage(playerid, COLOR_RED, "you quited your Job!");
    return 1;
}

greets niels


Re: how to show timer in gametext? - niels44 - 04.02.2012

CAN ANYONE HELP ME@!!? PLS


Re: how to show timer in gametext? - InferNus` - 04.02.2012

Search for countdown scripts


Re: how to show timer in gametext? - niels44 - 04.02.2012

yeah sorry for bumping but i just need help right now... and i dont understand there is no one who can help me...
and for that countdown script eehm i will look and see if it is usable XD


Re: how to show timer in gametext? - Konstantinos - 04.02.2012

Yes, but you are not the only one that wants help right now. Imagine how the forum will be if every bumping every 20 minutes. As InferNus` said check tutorials on countdown and with the same way make the GameText.


Re: how to show timer in gametext? - ғαιιοцт - 04.02.2012

Код:
new StopDealCount[MAX_PLAYERS];
new StopDealt[MAX_PLAYERS]; //the timer for each player

public OnPlayerExitVehicle(playerid, vehicleid)
{
    if( DealEnable[ playerid ] == 1 ){
        StopDealCount[playerid] = 20; //how many seconds it should take (15 or 20)
        StopDealt[playerid] = SetTimerEx("StopDeal", 1000, 1, "d", playerid); //1 second timer
        SendClientMessage(playerid, COLOR_RED, "Go back in your car!, else you will lose your Job!!");
        StopAudioStreamForPlayer(playerid);
    }
    return 1;
}
public StopDeal(playerid)
{
    if(StopDealCount[playerid] == 0)
    {
        SetPlayerWantedLevel(playerid, 0);
        DealEnable[ playerid ] = 0;
        SendClientMessage(playerid, COLOR_RED, "you quited your Job!");
        KillTimer(StopDealt[playerid]);
    }
    else
    {
        StopDealCount[playerid] --;
        new String[20];
        format(String, sizeof String, "Time left: %i", StopDealCount[playerid]);
        GameTextForPlayer(playerid, String);
    }
    return 1;
}



Re: how to show timer in gametext? - niels44 - 04.02.2012

hmm yeah your right dwane :S sorry for bumping XD but i wanted to fix this XD anyway your right i will try not to do it again XD

and eehm i have this errors/warnings:
Код:
D:\Program Files\[0.3d]my own drifting gamemode\gamemodes\TorettoRacing1.pwn(12375) : warning 217: loose indentation
D:\Program Files\[0.3d]my own drifting gamemode\gamemodes\TorettoRacing1.pwn(12393) : warning 202: number of arguments does not match definition
D:\Program Files\[0.3d]my own drifting gamemode\gamemodes\TorettoRacing1.pwn(12393) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.
EDIT: errors fixed i saw that there had to be 2 more things after the string XD