SA-MP Forums Archive
Problem with a string and result.. - 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: Problem with a string and result.. (/showthread.php?tid=260691)



Problem with a string and result.. - Jack_Leslie - 10.06.2011

EDIT: Fixed, forgot a %s lol.


Re: Problem with a string and result.. - PGTips - 10.06.2011

Dont worry i cant explain what i did to it plus i put somthings in wrong and had to edit it


plus i have go cya later


Re: Problem with a string and result.. - Jack_Leslie - 10.06.2011

Quote:
Originally Posted by PGTips
Посмотреть сообщение
pawn Код:
if(strcmp(cmd, "/departments", true) == 0 || strcmp(cmd, "/d", true) == 0)
{
        if(IsPlayerConnected(playerid))
            {
                SendClientMessage(playerid, TEAM_CYAN_COLOR, "You cannot speak, you have been silenced");
                return 1;
            }
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[128];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/d)epartments [department chat]");
                return 1;
            }
            if(PlayerInfo[playerid][pDBanned] == 1)
            {
                SendClientMessage(playerid, COLOR_GREY, "** You are Banned From Cop Duty!");
                return 1;
            }
            if(//yourcode here[playerid] == // your code here)
            {
                if(PlayerInfo[playerid][pSwat] == 4) { format(string, sizeof(string), "Commander %s: %s, over.", sendername, result); }
                else if(PlayerInfo[playerid][pSwat] == 3) { format(string, sizeof(string), "Sub-Commander %s: %s, over.", sendername, result); }
                else if(PlayerInfo[playerid][pSwat] == 2) { format(string, sizeof(string), "Instructor %s: %s, over.", sendername, result); }
                else if(PlayerInfo[playerid][pSwat] == 1) { format(string, sizeof(string), "Operative %s: %s, over.", sendername, result); }
                else
                {
                    format(string, sizeof(string), "[Unknown] %s (radio): %s, over.", sendername, result);
                }
                ProxDetector(7.5, playerid, string,COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                SentMessage[playerid] = 1;
                SendRadioMessage(3, COLOR_//, string);
                SendRadioMessage(2,  COLOR_//, string);
                SendRadioMessage(1,  COLOR_//, string);
                SendRadioMessage(4,  COLOR_//, string);
                SendRadioMessage(12, COLOR_//, string);
                SendRadioMessage(7,  COLOR_//, string);
                SentMessage[playerid] = 0;
                return 1;
            }
That doesn't really make any sense..