01.04.2011, 15:38
Here is my code for my death messages, but I was wondering if it was possible to randomize messages, As you can see one line of code says
Is it possible to randomise the message so that it doesnt allways say "has fucked up" and can maybe change to... "has re-arranged the face of %s" ?
Is this possible?
pawn Код:
format(string, sizeof(string), "{FF6600}*** %s has fucked up %s, with a %s", killer, playername, deathreason);
Is this possible?
pawn Код:
new string[256];
new deathreason[20];
GetPlayerName(playerid, playername, sizeof(playername));
GetWeaponName(reason, deathreason, 20);
if (killerid == INVALID_PLAYER_ID) {
switch (reason) {
case WEAPON_DROWN:
{
format(string, sizeof(string), "{FF6600}*** %s has drowned.)", playername);
}
default:
{
if (strlen(deathreason) > 0) {
format(string, sizeof(string), "{FF6600}*** %s has died. (%s)", playername, deathreason);
} else {
format(string, sizeof(string), "{FF6600}*** %s has died.", playername);
}
}
}
}
else {
new killer[MAX_PLAYER_NAME];
GetPlayerName(killerid, killer, sizeof(killer));
if (strlen(deathreason) > 0) {
format(string, sizeof(string), "{FF6600}*** %s has fucked up %s, with a %s", killer, playername, deathreason);
} else {
format(string, sizeof(string), "{FF6600}*** %s has fucked up %s.", killer, playername);
}
}
SendClientMessageToAll(COLOR_YELLOW, string);
return 1;
}