Help with Command
#1

I created a "gps system" for my server with a few different commands..now i want them to do all in 1 cmd...
this is what i have:
Код:
dcmd_gps(playerid,params[])
{
	if(PlayerData[playerid][Logged] == 1)
	{
	  new tmp[256], idx;
	  tmp = strtok(params,idx);
		if(!strlen(tmp))
		{
		  SendClientMessage(playerid, GREY, "/gps[list/hc/ds/gap/off]");
		}
		if(strcmp(tmp, "list", true || tmp, "off", true || tmp, "hc", true || tmp, "ds", true || tmp, "gap", true) == 0) //thats the line the error prefers to
		{
		  if(strcmp(tmp, "list", true) == 0)
		  {
		    SendClientMessage(playerid, CYAN, "----[RLRP]GPS System, Destination List----");
		    SendClientMessage(playerid, ORANGE, "hc - Higher Command Building");
		    SendClientMessage(playerid, ORANGE, "ds - Driving School");
		    SendClientMessage(playerid, ORANGE, "gap - Greek Airport");
    		}
    		if(strcmp(tmp, "off", true) == 0)
    		{
    		  if(PlayerData[playerid][gps] == 1)
    		  {
    		  SendClientMessage(playerid,CYAN, "----[RLRP]GPS System -- Disabled----");
					PlayerData[playerid][gps] = 0;
					DisablePlayerCheckpoint(playerid);
				}else{
				  SendClientMessage(playerid,GREY, "[RLRP]GPS System is not running");
				}
			}
			if(strcmp(tmp, "hc", true) == 0)
			{
			  if(PlayerData[playerid][gps] == 0)
				{
      			SendClientMessage(playerid,CYAN, "----[RLRP]GPS System -- Enabled----");
		      SendClientMessage(playerid,ORANGE, "* GPS System Set To Higher Command Building - San Fierro");
					SetPlayerCheckpoint(playerid,-2760.5947,375.4701,4.8881,3);
					PlayerData[playerid][gps] = 1;
				}else{
		  			SendClientMessage(playerid,ORANGE, "* GPS System Set To Higher Command Building - San Fierro");
		  			SetPlayerCheckpoint(playerid,-2760.5947,375.4701,4.8881,3);
		  			PlayerData[playerid][gps] = 1;
				}
			}
			if(strcmp(tmp, "ds", true) == 0)
			{
			  if(PlayerData[playerid][gps] == 0)
			  {
			    SendClientMessage(playerid,CYAN, "----[RLRP]GPS System -- Enabled");
			    SendClientMessage(playerid,ORANGE, "* GPS System Set To Driving School - San Fierro");
					SetPlayerCheckpoint(playerid,-2046.6417,-75.4851,35.1654,3);
					PlayerData[playerid][gps] = 1;
				}else{
          SendClientMessage(playerid,ORANGE, "* GPS System Set To Driving School - San Fierro");
				  SetPlayerCheckpoint(playerid,-2046.6417,-75.4851,35.1654,3);
				  PlayerData[playerid][gps] = 1;
				}
			}
			if(strcmp(tmp, "gap", true) == 0)
			{
  			if(PlayerData[playerid][gps] == 0)
				{
      			SendClientMessage(playerid,CYAN, "----[RLRP]GPS System -- Enabled");
      			SendClientMessage(playerid,ORANGE, "* GPS System Set To Greek Airport - Las Venturas");
					SetPlayerCheckpoint(playerid,2913.2195,2120.8821,11.0760,3);
					PlayerData[playerid][gps] = 1;
				}else{
				  SendClientMessage(playerid,ORANGE, "* GPS System Set To Greek Airport - Las Venturas");
				  SetPlayerCheckpoint(playerid,2913.2195,2120.8821,11.0760,3);
				  PlayerData[playerid][gps] = 1;
				}
			}
		}else{
		  SendClientMessage(playerid, GREY, "/gps[list/hc/ds/gap/off]");
		}
	}
	return 1;
}
but it always says:

(503 : error 033: array must be indexed (variable "tmp")


i would thank you if you could tell me how to fix it..
Reply
#2

pawn Код:
dcmd_gps(playerid,params[])
{
    if(PlayerData[playerid][Logged] == 1)
    {
        new tmp[256], idx;
        tmp = strtok(params,idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, GREY, "/gps[list/hc/ds/gap/off]");
            return 1;
        }
        if(strcmp(tmp, "list", true) == 0)
        {
            SendClientMessage(playerid, CYAN, "----[RLRP]GPS System, Destination List----");
            SendClientMessage(playerid, ORANGE, "hc - Higher Command Building");
            SendClientMessage(playerid, ORANGE, "ds - Driving School");
            SendClientMessage(playerid, ORANGE, "gap - Greek Airport");
        }
        else if(strcmp(tmp, "off", true) == 0)
        {
            if(PlayerData[playerid][gps] == 1)
            {
                SendClientMessage(playerid,CYAN, "----[RLRP]GPS System -- Disabled----");
                PlayerData[playerid][gps] = 0;
                DisablePlayerCheckpoint(playerid);
            }
            else
            {
                SendClientMessage(playerid,GREY, "[RLRP]GPS System is not running");
            }
        }
        else if(strcmp(tmp, "hc", true) == 0)
        {
            if(PlayerData[playerid][gps] == 0)
            {
                SendClientMessage(playerid,CYAN, "----[RLRP]GPS System -- Enabled----");
                SendClientMessage(playerid,ORANGE, "* GPS System Set To Higher Command Building - San Fierro");
                SetPlayerCheckpoint(playerid,-2760.5947,375.4701,4.8881,3);
                PlayerData[playerid][gps] = 1;
            }
            else
            {
                SendClientMessage(playerid,ORANGE, "* GPS System Set To Higher Command Building - San Fierro");
                SetPlayerCheckpoint(playerid,-2760.5947,375.4701,4.8881,3);
                PlayerData[playerid][gps] = 1;
            }
        }
        else if(strcmp(tmp, "ds", true) == 0)
        {
            if(PlayerData[playerid][gps] == 0)
            {
                SendClientMessage(playerid,CYAN, "----[RLRP]GPS System -- Enabled");
                SendClientMessage(playerid,ORANGE, "* GPS System Set To Driving School - San Fierro");
                SetPlayerCheckpoint(playerid,-2046.6417,-75.4851,35.1654,3);
                PlayerData[playerid][gps] = 1;
            }
            else
            {
                SendClientMessage(playerid,ORANGE, "* GPS System Set To Driving School - San Fierro");
                SetPlayerCheckpoint(playerid,-2046.6417,-75.4851,35.1654,3);
                PlayerData[playerid][gps] = 1;
            }
        }
        else if(strcmp(tmp, "gap", true) == 0)
        {
            if(PlayerData[playerid][gps] == 0)
            {
                SendClientMessage(playerid,CYAN, "----[RLRP]GPS System -- Enabled");
                SendClientMessage(playerid,ORANGE, "* GPS System Set To Greek Airport - Las Venturas");
                SetPlayerCheckpoint(playerid,2913.2195,2120.8821,11.0760,3);
                PlayerData[playerid][gps] = 1;
            }
            else
            {
                SendClientMessage(playerid,ORANGE, "* GPS System Set To Greek Airport - Las Venturas");
                SetPlayerCheckpoint(playerid,2913.2195,2120.8821,11.0760,3);
                PlayerData[playerid][gps] = 1;
            }
        }
        else
        {
            SendClientMessage(playerid, GREY, "/gps[list/hc/ds/gap/off]");
        }
    }
    return 1;
}
Reply
#3

k thanks...just because of the "else" lol
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)