I want to make when a player types lol, it will give a random message send to everyone for example when i type:
pawn Код:
public OnPlayerText(playerid, text[])
{
if(strcmp(text, "lol", true) == 0){
RandomMessageToAll(0xFFFF00FF);
}
return 1;
}
forward RandomMessageToAll(color);
public RandomMessageToAll(color)
{
for(new i=0; i<MAX_PLAYERS; i++){
if(IsPlayerConnected(i)){
new str[128], name[MAX_PLAYER_NAME], RandomMessage;
GetPlayerName(i, name, sizeof(name));
RandomMessage = random(4);
switch(RandomMessage){
case 0: format(str, sizeof(str), "random message 1");
case 1: format(str, sizeof(str), "random message 2");
case 2: format(str, sizeof(str), "random message 3");
case 3: format(str, sizeof(str), "random message 4");
}
format(str, sizeof(str), "%s: %s", name, str);
SendClientMessage(i, color, str);
}
}
}