what's wrong?
#1

What's wrong with this command?
Код:
if(strcmp("/work", cmdtext, true, 10) == 0)
	{
	    new string[200];
		new pvehiclemodel = GetVehicleModel(GetPlayerVehicleID(playerid));
		if(PlayerInfo[playerid][pWorking] == 0)
		{
			if(pvehiclemodel == 592)
			{
			    if(PlayerInfo[playerid][pFlyLicense] > 0)
			    {
			    	new rand = random(sizeof(FlyingMissionRandom));
			    	CreatePlayerMission(playerid, FlyingMissionRandom[rand][UseTrailerCheck], FlyingMissionRandom[rand][MissionPay], FlyingMissionRandom[rand][loadx], FlyingMissionRandom[rand][loady], FlyingMissionRandom[rand][loadz], FlyingMissionRandom[rand][unloadx], FlyingMissionRandom[rand][unloady], FlyingMissionRandom[rand][unloadz]);
					format(string, sizeof(string), "%s", FlyingMissionRandom[rand][MissionName]);
					SendClientMessage(playerid, COLOR_YELLOW, string);
					PlayerInfo[playerid][pWorking] = 3;
				}
				else
				{
				    SendClientMessage(playerid, COLOR_RED, "You don't have a flying license");
				    RemovePlayerFromVehicle(playerid);
				}
			}
			else if(pvehiclemodel == 403 || pvehiclemodel == 514 || pvehiclemodel == 515)
			{
			    if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
			    {
			    	new rand = random(sizeof(TruckingMissionRandom));
			    	CreatePlayerMission(playerid, TruckingMissionRandom[rand][UseTrailerCheck], FlyingMissionRandom[rand][MissionPay], TruckingMissionRandom[rand][loadx], TruckingMissionRandom[rand][loady], TruckingMissionRandom[rand][loadz], TruckingMissionRandom[rand][unloadx], TruckingMissionRandom[rand][unloady], TruckingMissionRandom[rand][unloadz]);
			    	format(string, sizeof(string), "%s", FlyingMissionRandom[rand][MissionName]);
			    	SendClientMessage(playerid, COLOR_YELLOW, string);
			    	PlayerInfo[playerid][pWorking] = 2;
				}
				else
				{
				    SendClientMessage(playerid, COLOR_RED, "You don't have a trailer attached.");
				}
			}
			else if(pvehiclemodel == 525)
			{
				PlayerInfo[playerid][pWorking] = 1;
				SendClientMessage(playerid, COLOR_YELLOW, "You are now a tow trucker");
			}
			else
			{
			    SendClientMessage(playerid, COLOR_RED, "You can't work on this vehicle.");
			}
		}
		else
		{
		    SendClientMessage(playerid, COLOR_RED, "You are already working");
		}
		return 1;
	}
If i'm in the airplane, it just sets a mission, but when i am in a truck or something, it sais: SERVER: Unknown command
Reply
#2

how is this
pawn Код:
if(strcmp("/work", cmdtext, true, 10) == 0)
    {
        new string[200];
        new pvehiclemodel = GetVehicleModel(GetPlayerVehicleID(playerid));
        if(PlayerInfo[playerid][pWorking] == 0)
        {
            if(pvehiclemodel == 592)
            {
                if(PlayerInfo[playerid][pFlyLicense] > 0)
                {
                    new rand = random(sizeof(FlyingMissionRandom));
                    CreatePlayerMission(playerid, FlyingMissionRandom[rand][UseTrailerCheck], FlyingMissionRandom[rand][MissionPay], FlyingMissionRandom[rand][loadx], FlyingMissionRandom[rand][loady], FlyingMissionRandom[rand][loadz], FlyingMissionRandom[rand][unloadx], FlyingMissionRandom[rand][unloady], FlyingMissionRandom[rand][unloadz]);
                    format(string, sizeof(string), "%s", FlyingMissionRandom[rand][MissionName]);
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    PlayerInfo[playerid][pWorking] = 3;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "You don't have a flying license");
                    RemovePlayerFromVehicle(playerid);
                }
            }
            if(pvehiclemodel == 403 || pvehiclemodel == 514 || pvehiclemodel == 515)
            {
                if(IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)))
                {
                    new rand = random(sizeof(TruckingMissionRandom));
                    CreatePlayerMission(playerid, TruckingMissionRandom[rand][UseTrailerCheck], FlyingMissionRandom[rand][MissionPay], TruckingMissionRandom[rand][loadx], TruckingMissionRandom[rand][loady], TruckingMissionRandom[rand][loadz], TruckingMissionRandom[rand][unloadx], TruckingMissionRandom[rand][unloady], TruckingMissionRandom[rand][unloadz]);
                    format(string, sizeof(string), "%s", FlyingMissionRandom[rand][MissionName]);
                    SendClientMessage(playerid, COLOR_YELLOW, string);
                    PlayerInfo[playerid][pWorking] = 2;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "You don't have a trailer attached.");
                }
            }
            if(pvehiclemodel == 525)
            {
                PlayerInfo[playerid][pWorking] = 1;
                SendClientMessage(playerid, COLOR_YELLOW, "You are now a tow trucker");
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "You can't work on this vehicle.");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You are already working");
        }
        return 1;
    }
Reply
#3

it still sais: Unknown command
Reply
#4

Try put this at the bottom of OnPlayerCommandText:

PHP код:
new cmd[256], idx;
cmd strtok(cmdtextidx); 
And after replace this:

PHP код:
if(strcmp("/work"cmdtexttrue10) == 0
By this:

PHP код:
if(strcmp("/work"cmdtrue10) == 0
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)