GameTextForAll Issue?
#1

I seem to be having a rather strange (slightly noobish) issue with a timer and a GameTextForAll. Here's the code:

pawn Код:
dcmd_takeoff(playerid, params[])
{
    #pragma unused params
    if(GetPlayerTeam(playerid) != TEAM_PILOT) return SendClientMessage(playerid, COLOUR_RED, "Only Pilots can use this command.");
    if(!IsPlayerInAnyVehicle(playerid) || !IsVehicleAircraft(GetVehicleModel(GetPlayerVehicleID(playerid)))) return SendClientMessage(playerid, COLOUR_RED, "You need to be in an aircraft to use this command.");
    GameTextForPlayer(playerid, "~g~Requesting Take Off", 2000, 5);
    new tmpString[45];
    format(tmpString, sizeof(tmpString), "~y~TOWER<>%s~n~~g~Take off granted", TailNumbers[GetPlayerVehicleID(playerid)]);
    SetTimerEx("TransmissionTimer", 5000, false, "s", playerid, tmpString);
    return 1;
}

dcmd_land(playerid, params[])
{
    #pragma unused params
    if(GetPlayerTeam(playerid) != TEAM_PILOT) return SendClientMessage(playerid, COLOUR_RED, "Only Pilots can use this command.");
    if(!IsPlayerInAnyVehicle(playerid) || !IsVehicleAircraft(GetVehicleModel(GetPlayerVehicleID(playerid)))) return SendClientMessage(playerid, COLOUR_RED, "You need to be in an aircraft to use this command.");
    GameTextForPlayer(playerid, "~g~Requesting to Land", 2000, 5);
    new tmpString[45];
    format(tmpString, sizeof(tmpString), "~y~TOWER<>%s~n~~g~Landing Granted", TailNumbers[GetPlayerVehicleID(playerid)]);
    SetTimerEx("TransmissionTimer", 5000, false, "s", playerid, tmpString);
    return 1;
}

//It is forwarded at the start of the script.
public TransmissionTimer(message[])
{
    GameTextForAll(message, 5000, 5);
}
//I have already fixed the incorrect parameter count in SetTimerEx (by removing the playerid parameter).

Basically, I call either command (/takeoff or /land) and I get the "Requesting to Take Off/Land" message. But, I never get the second message that should be sent from the timer. I can confirm that the timer is being called by using the print function.

I don't know else to explain it.

Has anyone got any ideas?

Thanks in advance,
Ash.

Oh, there's reputation (I think I can give around 4 points) in it for whoever can sort this, as it's really bugging me.
Reply
#2

pawn Код:
public TransmissionTimer(message[])
{
    GameTextForAll(message, 5000, 5);
    print("test");
}
did you print it like that?
Reply
#3

Use a different gametext style like 3.
Reply
#4

Quote:
Originally Posted by bartje01
Посмотреть сообщение
pawn Код:
public TransmissionTimer(message[])
{
    GameTextForAll(message, 5000, 5);
    print("test");
}
did you print it like that?
Yeap, I also printed what was being sent in "message" and it printed what should of been in there.

Quote:
Originally Posted by MP2
Посмотреть сообщение
Use a different gametext style like 3.
I originally attempted it using style 2, with no results. I shall try type 3 when I get in from school later today.
Reply
#5

I tested this earlier - style 3 works fine. Style 5 has issues.
Reply
#6

pawn Код:
SetTimerEx("TransmissionTimer", 5000, false, "ds", playerid, tmpString);
You have 2 params. playerid took 's' so message didn't have it's own to use so it wasn't transmitted.

Have fun.
Reply
#7

Quote:
Originally Posted by [MG]Dimi
Посмотреть сообщение
pawn Код:
SetTimerEx("TransmissionTimer", 5000, false, "ds", playerid, tmpString);
You have 2 params. playerid took 's' so message didn't have it's own to use so it wasn't transmitted.

Have fun.
I'd already fixed that; I'm sure I mentioned that in the first post...

I shall test style 3 in a few minutes.

Thanks
Reply
#8

Still no joy, even with style 3.
Reply
#9

Send a clientmessage in the timer to see if it's getting called, and with what values.
Reply
#10

Quote:
Originally Posted by MP2
Посмотреть сообщение
Send a clientmessage in the timer to see if it's getting called, and with what values.
I'm just doing a quick print debug, I've changed the timer abit (for two reasons). One, to see if it was an issue with GameTextForAll, and two, because it needs to only be sent to pilots (TEAM_PILOT) not everyone.

Here is the new timer code (with debugging prints):
pawn Код:
public TransmissionTimer(message[])
{
    printf("Called TransmissionTimer(%s)", message);
    SendClientMessageToAll(COLOUR_YELLOW, message);
    print("Sent SCMTA debugging message.");
    for(new i; i < GetMaxPlayers(); i++)
    {
        if(!IsPlayerConnected(i)) continue;
        printf("Playerid %i is connected.", i);
        if(GetPlayerTeam(i) == TEAM_PILOT)
        {
            printf("\tSending message. (Message: %s)", message);
            GameTextForPlayer(i, message, 5000, 3);
            printf("\tMessage sent. (Message: %s)", message);
        }
    }
    printf("Finished calling TransmissionTimer(%s)", message);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)