GameText
#1

How to make a timer with gametext, like 30 sec count down
Then when 30 is up a code should go there
Reply
#2

It's better to use a TextDraw

Like this:

PHP код:
//In the script:
const time 10//This would be 10sec
TextDrawShowForPlayer(playerid,txtid); //The countdown starts
@countdown(playerid,time);
//at the end of the script:
@countdown(playerid,x);@countdown(playerid,x) {
    if(--
== 0
    {
        
TextDrawHideForPlayer(playerid,txtid); //Here the countdown ends!
        
return 1;
    }
    new 
str[8];
    
valstr(str,x);
    
TextDrawSetString(txtidstr);
    
TextDrawShowForPlayer(playeridtxtid);
    return 
SetTimerEx(!"@countdown",999,0,!"ii",playerid,x);

Reply
#3

i know, but there anyway using gametext
Reply
#4

Then do the same with gametexts:

PHP код:
//In the script: 
const time 10//This would be 10sec 
GameTextForPlayer(playerid,!"10",1000,5); 
@
countdown(playerid,time); 
//at the end of the script: 
@countdown(playerid,x);@countdown(playerid,x) { 
    if(--
== 0)  return GameTextForPlayer(playerid,!"Los Los Los!",1000,5); 
    new 
str[8]; 
    
valstr(str,x); 
    
GameTextForPlayer(playerid,str,1000,5); 
    return 
SetTimerEx(!"@countdown",999,0,!"ii",playerid,x); 

Reply
#5

i don't get that function
pawn Код:
"GameTextForPlayer"
(2619) : error 025: function heading differs from prototype
(2619) : error 025: function heading differs from prototype
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.
is it like this one?

pawn Код:
if(GetPlayerTeam(playerid) == 1)
    {
        if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) == 0)
        {
            if(gMissionInt[playerid] == 1)
            {
                GameTextForPlayer(playerid, "Reattach your trailer!", 1500, 4);
            }
            return 1;
        }
    }
   
    if(IsPlayerInAnyVehicle(playerid) == 0)
    {
        if(gMissionInt[playerid] == 1)
        {
            GameTextForPlayer(playerid, "Get back in you're vehicle!", 1500, 4);
        }
    }
Reply
#6

anyone? i'm trying and trying to get 30 sec count down then failed mission.
i think this the code.

pawn Код:
forward TruckCheck(playerid);
public TruckCheck(playerid)
{
        if (IsPlayerInAnyVehicle(playerid) == 0)
        {
                GameTextForPlayer(playerid, "Get back in your TRUCK!", 1000, 5);
                return 1;
        }
        else if (IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) == 0)
        {
            GameTextForPlayer(playerid, "Reconnect your trailer!", 1000, 5);
            return 1;
        }
        return 0;
}
Reply
#7

Kid, if you don't know anything about scripting at all don't make a server. Modify 1000 with the amount of miliseconds you want
Reply
#8

I'm not a kid. i don't how they don't display in Gametext, last time i tired, didnt show up with the numbers. im seeing if someone know how to do it in way that works.
Reply
#9

I can help you with TeamViewer if you want Send me your data with PM
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)