Random messages with string
#1

So i have a simple random message system made, But my question is now how can i put strings in the random messages.

Here the code to explain more:

pawn Код:
new randominf[][] =
    {
        "[BOT]Do you know that %s %d kills have!",
        "[BOT]Do you know that %s registered on %s!",
        "[BOT]Do you know that %s is member level %d!"
    };
[BOT]Do you know that %s %d kills have! = Than is the %s the name and the %d the kills but how can i get the kills and the name in the random messages.




Already thanks for the help!
Reply
#2

pawn Код:
new str[128];
new rand = random(sizeof(randominf));
switch(rand)
{
    case 0: format(str,sizeof(str),randominf[rand],GetName(giveplayerid),kills[giveplayerid]);
    case 1: format(str,sizeof(str),randominf[rand],GetName(giveplayerid),something);
    default: format(str,sizeof(str),randominf[rand],GetName(giveplayerid),level[giveplayerid]);
}
SendClientMessageToAll(-1,str);
Reply
#3

worked thanks! +rep
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)