SA-MP Forums Archive
[HELP] Command Fix - 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: [HELP] Command Fix (/showthread.php?tid=126195)



[HELP] Command Fix - FreddeN - 07.02.2010

I got this /ra command from a friend, but he don't know how to fix it, either do I.
Could you just take a fast look at it and see if you find some errors that can make it to work.

Код:
  if(strcmp(cmd, "/ra", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			if(gTeam[playerid] == TEAM_LSPD || gTeam[playerid] == TEAM_FBI || gTeam[playerid] == TEAM_LSER && PlayerInfo[playerid][LAERank] >= 1)
			{
				SendClientMessage(playerid, COLOR_RED, "Identification Error - You are not a qualified Police Officer !");
				return 1;
			}
			GetPlayerName(playerid, sendername, sizeof(sendername));
			new length = strlen(cmdtext);
			while ((idx < length) && (cmdtext[idx] <= ' '))
			{
				idx++;
			}
			new offset = idx;
			new result[64];
			while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
			{
				result[idx - offset] = cmdtext[idx];
				idx++;
			}
			result[idx - offset] = EOS;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ra [text]");
				return 1;
			{
				format(string, sizeof(string), "Police Radio: %s: %s, over. **", sendername, result);
				SendRadioMessage(5, COLOR_BLUE, string);
				printf("%s", string);
				GetPlayerName(playerid, sendername, sizeof(sendername));
				format(string, sizeof(string), "%s whispers something in the radio.", sendername);
				ProxDetector(20.0, playerid, string,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
				return 1;
			}
			else
			{
				SendClientMessage(playerid, COLOR_RED, "Identification Error - You are not a Police Officer.");
				return 1;
			}
		}
		return 1;
	}
Thanks


Re: [HELP] Command Fix - MadeMan - 07.02.2010

pawn Код:
if(strcmp(cmd, "/ra", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
            if(gTeam[playerid] == TEAM_LSPD || gTeam[playerid] == TEAM_FBI || gTeam[playerid] == TEAM_LSER && PlayerInfo[playerid][LAERank] >= 1)
            {
                SendClientMessage(playerid, COLOR_RED, "Identification Error - You are not a qualified Police Officer !");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ra [text]");
                return 1;
            }
            format(string, sizeof(string), "Police Radio: %s: %s, over. **", sendername, result);
            SendRadioMessage(5, COLOR_BLUE, string);
            printf("%s", string);
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "%s whispers something in the radio.", sendername);
            ProxDetector(20.0, playerid, string,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
            return 1;
        }
        return 1;
    }



Re: [HELP] Command Fix - FreddeN - 07.02.2010

Quote:
Originally Posted by MadeMan
pawn Код:
if(strcmp(cmd, "/ra", true) == 0)
    {
      if(IsPlayerConnected(playerid))
      {
            if(gTeam[playerid] == TEAM_LSPD || gTeam[playerid] == TEAM_FBI || gTeam[playerid] == TEAM_LSER && PlayerInfo[playerid][LAERank] >= 1)
            {
                SendClientMessage(playerid, COLOR_RED, "Identification Error - You are not a qualified Police Officer !");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ra [text]");
                return 1;
            }
            format(string, sizeof(string), "Police Radio: %s: %s, over. **", sendername, result);
            SendRadioMessage(5, COLOR_BLUE, string);
            printf("%s", string);
            GetPlayerName(playerid, sendername, sizeof(sendername));
            format(string, sizeof(string), "%s whispers something in the radio.", sendername);
            ProxDetector(20.0, playerid, string,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE,COLOR_WHITE);
            return 1;
        }
        return 1;
    }
Thanks mate