SA-MP Forums Archive
chat to people with the same surname (radio) - 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)
+--- Thread: chat to people with the same surname (radio) (/showthread.php?tid=503870)



chat to people with the same surname (radio) - gmstrikker - 31.03.2014

I do not know how to do, but I saw in a cool server with RPG Name _ Last Name, the command worked like this: I sent Antonio_Nunes / f Hi, all the server Surname Nunes saw that message as a radio only the family, someone knows how to do ?


Re: chat to people with the same surname (radio) - iBeast - 31.03.2014

meh posted wrong.


Re: chat to people with the same surname (radio) - gmstrikker - 01.04.2014

in the wrong place? so where do I post?


Re: chat to people with the same surname (radio) - Crayder - 01.04.2014

Its in the right place, but I don't understand what you want... Maybe you mean radio messages to the players on the same team...?


Re: chat to people with the same surname (radio) - stundje - 01.04.2014

He wants to have a command like, when u type /surname [text] that all the online players with the same surname as him will get the message. So the others won't see it.


Re: chat to people with the same surname (radio) - gmstrikker - 01.04.2014

It's like a radio for players on the same team, but it is for players with equal Surname
Example I Antonio_Nunes send a message saying HI!
Only those who have the surname Nunes will see this message!
The teams I could do, but not this.


Re: chat to people with the same surname (radio) - gmstrikker - 07.04.2014

any can help me?


Re: chat to people with the same surname (radio) - Stevolas - 07.04.2014

Not sure if this work, haven't tested. This is an example:

PS: This command uses zcmd and sscanf2
pawn Код:
stock GetPlayerLastName(playerid)
{
    new namestring[2][MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    split(name, namestring, '_');
    return namestring[1];
}

stock GetName(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    return name;
}

command(surname, playerid, params[])
{
    new text[128], string[128];
    if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /surname [text]");
    format(string, sizeof(string), "* %s says: %s *", GetName(playerid), text);
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(GetPlayerLastName(i) == GetPlayerLastName(playerid))
        {
            SendClientMessage(i, -1, string);
        }
    }
    SendClientMessage(i, -1, string);
    return 1;
}



Re: chat to people with the same surname (radio) - gmstrikker - 09.04.2014

I tried so now should work:
pawn Код:
if(strcmp(cmd, "/fa", true) == 0)
    {
        new string[128];
       
        new offset = idx;
        new result[64];
        result[idx - offset] = EOS;
        if(!strlen(result))
        {
            SendClientMessage(playerid, COLOR_R, "USE: (/fa) [familia chat]");
            return 1;
        }
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(GetPlayerLastName(i) == GetPlayerLastName2(i))
            {
                format(string, sizeof(string), "** Familia %s: %s. )) **", sendername, result);
                SendClientMessage(i, COLOR_BLUE, string);
            }
        }
        format(string, sizeof(string), "%s (rбdio): %s", sendername, result);
        ProxDetector(20.0, playerid, string, COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY,COLOR_GREY);
        return 1;
    }
Error:
pawn Код:
erro: if(GetPlayerLastName(i) == GetPlayerLastName2(i))
Line:
pawn Код:
error 033: array must be indexed (variable "GetPlayerLastName")
Stocks:
pawn Код:
// /fa
stock GetPlayerLastName(playerid)
{
    new namestring[2][MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    split(name, namestring, '_');
    return namestring[1];
}
stock GetPlayerLastName2(playerid)
{
    new namestring[2][MAX_PLAYER_NAME], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    split(name, namestring, '_');
    return namestring[1];
}



Re: chat to people with the same surname (radio) - gmstrikker - 10.04.2014

any help me?