GameTextForPlayer
#1

How do I lower down the following piece of code so it only sends for one second or less;
I've hardly ever used GameTextForPlayer

Код:
GameTextForPlayer(playerid,"~r~ERROR:~n~~y~No teamkilling", 3000, 1);
Reply
#2

Plus I want it too send to the killer, not the player. Here is the full OnPlayerDeath:

Код:
public OnPlayerDeath(playerid, killerid, reason) 
{
    if(killerid != INVALID_PLAYER_ID)
    { 
        if(GetPlayerTeam(killerid) == GetPlayerTeam(playerid))
        {

            GameTextForPlayer(playerid,"~n~~r~ERROR:~n~~y~No teamkilling", 3000, 1);

        }
		else
        {
            GameTextForPlayer(playerid,"~n~~g~Epic Shot!~n~~y~+3000", 3000, 1);
			GivePlayerMoney(killerid, 3000);
        }
    }

    SendDeathMessage(killerid, playerid, reason);

    return 1; 
}
Reply
#3

pawn Код:
GameTextForPlayer(playerid, string, 3000, 1);
3000 is the time it shows in milliseconds. 6000 is how many milliseconds are in a minute.

For the second code you posted, to send it to the killer, do this:
pawn Код:
GameTextForPlayer(killerid, string, 3000, 1);
Above changes playerid to killerid, killerid is the person who killed playerid.

Use https://sampwiki.blast.hk/wiki/GameTextForPlayer as a reference.
Reply
#4

To send message to killerid

Change :

pawn Код:
GameTextForPlayer(playerid,"~n~~g~Epic Shot!~n~~y~+3000", 3000, 1);
To
pawn Код:
GameTextForPlayer(killerid,"~n~~g~Epic Shot!~n~~y~+3000", 3000, 1);
Reply
#5

DBan and Jarnu told you about sending the message to the killerid instead of playerid, so I'm going to answer to your first question. The pre last parameter is the time which should be displayed for the text (in miliseconds).
pawn Код:
3000 ms = 3 seconds
// If you want 1 second, it would be:
1000 ms = 1 second
// If you want 0.5 second, it would be:
500 ms = 0.5 second
Reply
#6

First of all,

You are sending the game text to the player who died not to player who killed the player who died. Which means playerid.

Send it to the player who killed the player who died. (Killer ID)

For the first question Dwane answer it all.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)