SA-MP Forums Archive
/c <text> - 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: /c <text> (/showthread.php?tid=198568)



/c <text> - blackwave - 12.12.2010

I'm trying to make a code, for group chat, for everyone. And it gets the team of the player who typed, and send for all other players of his team (1 command for any teams), but that crashs, and I've tried always
pawn Код:
dcmd_c(playerid,params[])
{
    new string[128];
    new name[30]; GetPlayerName(playerid, name, 30);
    if(sscanf(params, "s[128]", params[2])) return SendClientMessage(playerid, cinza, "/c <texto>");
    format(string,sizeof(string),"%s [ID:%d]: %s",name,playerid,params[2]);
    foreach (Player, i)
    {
     
      if(GetPlayerTeam(playerid) == GetPlayerTeam(i))
      {
        SendClientMessage(i, agua, string);
      }
    }
    return 1;
}
DCMD + SSCANF


Re: /c <text> - rjjj - 12.12.2010

I think that this code can solve your problem:


pawn Код:
dcmd_c(playerid,params[])
{
    new string[128],
    new string2[128];
    new name[30];
    GetPlayerName(playerid, name, 30);
    if (sscanf(params, "s",string2)) SendClientMessage(playerid, cinza, "/c <texto>");
    format(string, sizeof(string),"%s [ID:%d]: %s", name, playerid, string2);
    foreach (Player, i)
    {
      if(GetPlayerTeam(playerid) == GetPlayerTeam(i))
      {
        SendClientMessage(i, agua, string);
      }
    }
    return 1;
}

I hope that i have helped


Re: /c <text> - blackwave - 12.12.2010

Quote:
Originally Posted by rjjj
Посмотреть сообщение
I think that this code can solve your problem:


pawn Код:
dcmd_c(playerid,params[])
{
    new string[128],
    new string2[128];
    new name[30];
    GetPlayerName(playerid, name, 30);
    if (sscanf(params, "s",string2)) SendClientMessage(playerid, cinza, "/c <texto>");
    format(string, sizeof(string),"%s [ID:%d]: %s", name, playerid, string2);
    foreach (Player, i)
    {
      if(GetPlayerTeam(playerid) == GetPlayerTeam(i))
      {
        SendClientMessage(i, agua, string);
      }
    }
    return 1;
}

I hope that i have helped
Vlws ae cara