SA-MP Forums Archive
I think this command need something to work, but what ? - 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: I think this command need something to work, but what ? (/showthread.php?tid=400041)



I think this command need something to work, but what ? - Kethrios - 16.12.2012

Hi everyone !

I have a problem with a mafia command.
When an italian guy want to speak in italian, he have to use /mafia italian <text>

The thing is, when he speak, Ok, people see [Italian] as they don't understand. But people who are also italian, in the mafia, see [Italian] too.

And when someone try /mafia italian <text> he can't se what he's writing, or what the others are saying.
The only way that he see what he's writing is to don't be near a player.

Here is my code :





pawn Код:
if(strcmp(subcmd, "italian", true) == 0))
        {
            if(PlayerInfo[playerid][pMember] == 14)
            {
                GetPlayerName(playerid, playername, sizeof(playername));
                new length = strlen(cmdtext);
                while ((idx < length) && (cmdtext[idx] <= ' '))
                    {idx++;}
                new offset = idx;
                while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
                    {result[idx - offset] = cmdtext[idx]; idx++;}
                result[idx - offset] = EOS;
                if(!strlen(result))
                {
                    SendClientMessage(playerid, COLOR_FACTION, "[Action] /mafia italian [texte]>");
                    return 1;
                }
                new Float:x, Float:y, Float:z;
                GetPlayerPos(playerid,x,y,z);
                print("Lancement Boucle 86");
                for(new p = 0; p < MAX_PLAYERS; p++)
                {
                    if(IsPlayerConnected(p))
                    {
                        if(PlayerToPoint(20, p, x, y, z))
                        {
                            if(PlayerInfo[p][pMember] == 14)
                            {

                                format(string, sizeof(string), "%s dit: [Italian] %s", playername, result);
                                ProxDetector(20.0, playerid, string,COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5,true);
                                return 1;
                            }
                            else
                            {
                                format(string, sizeof(string), "%s dit: [Unknow Language]", playername);
                                ProxDetector(20.0, playerid, string,COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5,true);
                                return 1;
                            }
                        }
                    }
                }
                print("End Boucle 86");
            }


Thanks for helping me guys !


Re: I think this command need something to work, but what ? - Nordic - 16.12.2012

not sure what you are asking but:

for playermember = 14

this will always be executed :
pawn Код:
format(string, sizeof(string), "%s dit: [Italian] %s", playername, result);
ProxDetector(20.0, playerid, string,COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5,true);
return 1;
so if Member 14 is Mafia, they will always see "[Italian]"


Re : I think this command need something to work, but what ? - Kethrios - 16.12.2012

Yes, I edited my thread to be more precise

Quote:

The thing is, when he speak, Ok, people see [Italian] as they don't understand. But people who are also italian, in the mafia, see [Italian] too.

And when someone try /mafia italian <text> he can't se what he's writing, or what the others are saying.
The only way that he see what he's writing is to don't be near a player.