SA-MP Forums Archive
need some help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: need some help (/showthread.php?tid=152712)



need some help - iStarzz - 05.06.2010

I want to make when a player types lol, it will give a random message send to everyone for example when i type:

FuTuRe: lol it will say FuTuRe: Weepleeeee zzzz or any other random message

I have this:
pawn Код:
new lolwords[1][] =
{
    {"lol"},
};
Hope somebody can help me


Re: need some help - TheChaoz - 05.06.2010

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);
    }  
  }
}
Hope it helps you