Random TextDraw in "OnPlayerDeath"? -
KurtAngle - 29.08.2013
Hey! I need a little help. I would like that when a player death, appear at he random TextDraw.
Example of random message:
"Ahaha! you're fuc**d now!" or
"Oh Oh! You're died!" or
"What are you doing man? Wake up!"
This message, random with textdraw...
Thanks for the help!
Re: Random TextDraw in "OnPlayerDeath"? -
KurtAngle - 29.08.2013
No anybody know?
Re: Random TextDraw in "OnPlayerDeath"? -
Konstantinos - 29.08.2013
Make the textdraw, store the ID and replace it on my comments
pawn Код:
new
Random_Death_Msg[ ][ ] =
{
"Ahaha! you're fuc**d now!",
"Oh Oh! You're died!",
"What are you doing man? Wake up!"
}
;
public OnPlayerDeath( playerid, killerid, reason )
{
new
rand = random( sizeof( Random_Death_Msg ) )
;
TextDrawSetString( /* The TextDraw to change */, Random_Death_Msg[ rand ] );
TextDrawShowForPlayer( playerid, /* The ID of the textdraw to show */ );
SetTimerEx( "OnPlayerHideDeathTD", 3000, false, "i", playerid );
return 1;
}
forward OnPlayerHideDeathTD( playerid );
public OnPlayerHideDeathTD( playerid )
{
TextDrawHideForPlayer( playerid, /* The ID of the textdraw to show */ );
}
EDIT:
Quote:
Originally Posted by Misiur
and if your next post/thread will be "pls give me textdraw code", I'll find you, and I'll kill you.
|
lol
Re: Random TextDraw in "OnPlayerDeath"? -
Misiur - 29.08.2013
You have to write textdraw code yourself (and if your next post/thread will be "pls give me textdraw code", I'll find you, and I'll kill you. Search for editor, or for tutorial using this forums search function/******).
First of all, create an array containing your messages (outside callbacks/functions, best if somewhere near top of your script)
pawn Код:
new const DeathMessages[3][32] = {
"Damn man, you suck!",
"Get the hell up",
"HA-HA, HA-HA"
};
The "const" means you won't change those messages programmatically later, 3 is the number of your messages, 32 is max length of your single message. You could use packed strings to make stuff take less memory, but I don't think I'm able to explain it to you.
Now, you just have to use random(number of messages), and you are set.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason) {
SendClientMessage(playerid, -1, DeathMessages[random(3)]);
return 1;
}
Change SendClientMessage code to your textdraw code, and done!
@up: ಠ_ಠ
Re: Random TextDraw in "OnPlayerDeath"? -
Aliassassin123456 - 29.08.2013
pawn Код:
new randomstr[][] = {"~r~Ahaha! you're fuc**d now!","~y~Oh Oh! You're died!","~b~What are you doing man? Wake up!"}
public OnPlayerDeath(playerid, killerid, reason)
{
GameTextForPlayer(playerid, randomstr[random(sizeof(randomstr))], 3000, 5);
return 1;
}
Re: Random TextDraw in "OnPlayerDeath"? -
KurtAngle - 29.08.2013
Thank you Konstantinos.. it work!