I need some help with my trucking FS
#1

So I've made FS for trucking, with doesn't give out any warns. Also In-game all of the command errors work like
"you're not in truck" or so, but when I do everything right (Stand on right place, in right vehicle) Server gives out unknown command.

Here is the code:

Код:
#define FILTERSCRIPT

#include <a_samp>
#include <zcmd>
#include <sscanf2>

new PickUpLoad;
new PickUpUnload;

#if defined FILTERSCRIPT
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA



public OnFilterScriptInit()
{
	PickUpLoad = CreatePickup(1239, 1, 2334.8611, -2081.3384, 13.5469, 0); // Loading Point
	PickUpUnload = CreatePickup(1239, 1, -1969.5801, -2431.8479, 30.6250, 0); //Unloading point



	print("\n--------------------------------------");
	print("iron_delivery");
	print("--------------------------------------\n");
	return 1;
}

enum cInfo
{
	iron
};

new CarInfo[700][cInfo];

public OnFilterScriptExit()
{
	return 1;
}

#else

main()
{
	print("\n----------------------------------");
	print(" Blank Gamemode by your name here");
	print("----------------------------------\n");
}

#endif

public OnGameModeInit()
{
	// Don't use these lines if it's a filterscript
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerConnect(playerid)
{
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

public OnPlayerSpawn(playerid)
{
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

CMD:unloadiron(playerid, params[])
{
	if(GetPlayerScore(playerid) >= -500)
	{

		new vehicleid1 = GetPlayerVehicleID(playerid);
	    if(IsPlayerInRangeOfPoint(playerid, 7.0, 2334.8611, -2081.3384, 13.5469))
	    {
	        if(GetVehicleModel(vehicleid1) == 422 || GetVehicleModel(vehicleid1) == 543 || GetVehicleModel(vehicleid1) == 554)
	        {
	            if(CarInfo[vehicleid1][iron] == 25)
	            {
	                CarInfo[vehicleid1][iron] = 0;
	                new cash = random(1000-10000)+1000;
	                GivePlayerMoney(playerid, cash);
					new string[64];
					format(string,sizeof(string),"You earned %d from delivery",cash);
					SendClientMessage(playerid,0xFFFFFFAA,string);
					return 1;
				}
				else return SendClientMessage(playerid, 0x00000014, "Your truck is emtpy!");
			}
	        if(GetVehicleModel(vehicleid1) == 440 || GetVehicleModel(vehicleid1) == 609 || GetVehicleModel(vehicleid1) == 414 || GetVehicleModel(vehicleid1) == 456 || GetVehicleModel(vehicleid1) == 482)
	        {
	            if(CarInfo[vehicleid1][iron] == 50)
	            {
	                CarInfo[vehicleid1][iron] = 0;
	                new cash = random(2000-20000)+2000;
	                GivePlayerMoney(playerid, cash);
					new string[64];
					format(string,sizeof(string),"You earned %d from delivery",cash);
					SendClientMessage(playerid,0xFFFFFFAA,string);
					return 1;
				}
				else return SendClientMessage(playerid, COLOR_ORANGE, "Your truck is emtpy!");
			}
			if(GetVehicleModel(vehicleid1) == 403 || GetVehicleModel(vehicleid1) == 515 || GetVehicleModel(vehicleid1) == 455 || GetVehicleModel(vehicleid1) == 514)
	        {
	            if(CarInfo[vehicleid1][iron] == 100)
	            {
	                CarInfo[vehicleid1][iron] = 0;
	                new cash = random(3000-30000)+3000;
	                GivePlayerMoney(playerid, cash);
					new string[64];
					format(string,sizeof(string),"You earned %d from delivery",cash);
					SendClientMessage(playerid,COLOR_ORANGE,string);
					return 1;
				}
				else return SendClientMessage(playerid, COLOR_ORANGE, "Your truck is emtpy!");
			}
			if(GetVehicleModel(vehicleid1) == 435 || GetVehicleModel(vehicleid1) == 450 || GetVehicleModel(vehicleid1) == 591)
	        {
	            if(CarInfo[vehicleid1][iron] == 100)
	            {
	                CarInfo[vehicleid1][iron] = 0;
	                new cash = random(3000-30000)+3000;
	                GivePlayerMoney(playerid, cash);
					new string[64];
					format(string,sizeof(string),"You earned %d from delivery",cash);
					SendClientMessage(playerid,0xFFFFFFAA,string);
					return 1;
				}
				else return SendClientMessage(playerid, COLOR_ORANGE, "Your truck is emtpy!");
			}
			else return SendClientMessage(playerid, COLOR_ORANGE, "You are not in a truck!");
		}
		else return SendClientMessage(playerid, COLOR_ORANGE, "You are not near the delivery point!");
	}
	else return SendClientMessage(playerid, COLOR_ORANGE, "Your job isn't trucker.");
}

CMD:loadiron(playerid, params[])
{
	if(GetPlayerScore(playerid) >= -500)
	{
		new vehicleid1 = GetPlayerVehicleID(playerid);
	    if(IsPlayerInRangeOfPoint(playerid, 7.0, -1969.5801, -2431.8479, 30.6250))
	    {
			if(GetVehicleModel(vehicleid1) == 422 || GetVehicleModel(vehicleid1) == 543 || GetVehicleModel(vehicleid1) == 554)
	        {
	            if(CarInfo[vehicleid1][iron] == 0)
	            {
	                CarInfo[vehicleid1][iron] = 25;
	                GivePlayerMoney(playerid, -1000);
					SendClientMessage(playerid, COLOR_ORANGE, "You loaded full truck of iron, and paid  $1000 for it! Head to unload place");
					return 1;
				}
				else return SendClientMessage(playerid, COLOR_ORANGE, "Your truck is emtpy!");
			}
	        if(GetVehicleModel(vehicleid1) == 440 || GetVehicleModel(vehicleid1) == 609 || GetVehicleModel(vehicleid1) == 414 || GetVehicleModel(vehicleid1) == 456 || GetVehicleModel(vehicleid1) == 482)
	        {
	            if(CarInfo[vehicleid1][iron] == 0)
	            {
	                CarInfo[vehicleid1][iron] = 50;
	                GivePlayerMoney(playerid, -2000);
					SendClientMessage(playerid, 0x00900082, "You loaded full truck iron, and paid  $2000 for it! Head to unload place");
					return 1;
				}
				else return SendClientMessage(playerid, 0x00000014, "Your truck is emtpy!");
			}
			if(GetVehicleModel(vehicleid1) == 403 || GetVehicleModel(vehicleid1) == 515 || GetVehicleModel(vehicleid1) == 455 || GetVehicleModel(vehicleid1) == 514)
	        {
	            if(CarInfo[vehicleid1][iron] == 0)
	            {
	                CarInfo[vehicleid1][iron] = 100;
	                GivePlayerMoney(playerid, -3000);
					SendClientMessage(playerid, 0x00900082, "You loaded full truck of iron, and paid  $3000 for it! Head to unload place");
					return 1;
				}
				else return SendClientMessage(playerid, 0x00000014, "Your truck is full!");
			}
			if(GetVehicleModel(vehicleid1) == 435 || GetVehicleModel(vehicleid1) == 450 || GetVehicleModel(vehicleid1) == 591)
	        {
	            if(CarInfo[vehicleid1][iron] == 0)
	            {
	                CarInfo[vehicleid1][iron] = 100;
	                GivePlayerMoney(playerid, -3000);
					SendClientMessage(playerid, 0x00900082, "You loaded full trailer iron, and paid  $3000 for it! Head to unload place");
					return 1;
				}
				else return SendClientMessage(playerid, COLOR_ORANGE, "Your truck is already full!");
			}
			else return SendClientMessage(playerid, COLOR_ORANGE, "You are not in a iron delivery truck!");
		}
		else return SendClientMessage(playerid, COLOR_ORANGE, "You are not near a loading point!");
	}
	else return SendClientMessage(playerid, COLOR_ORANGE, "Your job isn't trucker.");

}

CMD:helptruck(playerid, params[])
{
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "Small trucks: Bobcat(422), Sadler(543), Yosemite(554)");
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "Medium trucks: Rumpo(440), Boxville(609), Mule(414), Yankee(456), Burrito(482)");
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "Big trucks: Linerunner(403), Roadtrain(515), Flatbed(455), Tanker(514)");
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "Trailers: Article-trailer(435), Article-trailer 2(450), Article-trailer 3(591)");
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "");
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "Small trucks can only carry up to 25 pieces of iron, wicth will cost you 1k.");
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "Medium trucks can only carry up to 50 pieces of iron, wicth will cost you 2k.");
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "Big trucks and trailers can carry up to 50 pieces of iron, wicth will cost you 3k.");
	SendClientMessage(playerid, COLOR_LIGHTBLUE, "Trailers can be taken for free from Flint Country gas station.");
}

CMD:frisktruck(playerid, params[])
{
	new vehicleid1 = GetPlayerVehicleID(playerid);
	if(GetPlayerScore(playerid) >= -500)
	{
		if(GetVehicleModel(vehicleid1) == 422 || GetVehicleModel(vehicleid1) == 543 || GetVehicleModel(vehicleid1) == 554)
	    {
			if(CarInfo[vehicleid1][iron] == 0)
			{
			    SendClientMessage(playerid, 0x00900082, "Iron 0/25");
			    return 1;
			}
			if(CarInfo[vehicleid1][iron] == 25)
			{
				SendClientMessage(playerid, 0x00900082, "Iron 25/25");
				return 1;
			}
		}
		if(GetVehicleModel(vehicleid1) == 440 || GetVehicleModel(vehicleid1) == 609 || GetVehicleModel(vehicleid1) == 414 || GetVehicleModel(vehicleid1) == 456 || GetVehicleModel(vehicleid1) == 482)
	    {
			if(CarInfo[vehicleid1][iron] == 0)
			{
			    SendClientMessage(playerid, 0x00900082, "Iron 0/50");
			    return 1;
			}
			if(CarInfo[vehicleid1][iron] == 50)
			{
				SendClientMessage(playerid, 0x00900082, "Iron 50/50");
				return 1;
			}
		}
		if(GetVehicleModel(vehicleid1) == 403 || GetVehicleModel(vehicleid1) == 515 || GetVehicleModel(vehicleid1) == 455 || GetVehicleModel(vehicleid1) == 514)
		{

			if(CarInfo[vehicleid1][iron] == 0)
			{
			    SendClientMessage(playerid, 0x00900082, "Iron 0/100");
			    return 1;
			}
			if(CarInfo[vehicleid1][iron] == 100)
			{
				SendClientMessage(playerid, 0x00900082, "Iron 100/100");
				return 1;
			}
		}
		if(GetVehicleModel(vehicleid1) == 435 || GetVehicleModel(vehicleid1) == 450 || GetVehicleModel(vehicleid1) == 591)
  		{
			if(CarInfo[vehicleid1][iron] == 0)
			{
			    SendClientMessage(playerid, 0x00900082, "Iron 0/100");
			    return 1;
			}
			if(CarInfo[vehicleid1][iron] == 100)
			{
				SendClientMessage(playerid, 0x00900082, "Iron 100/100");
				return 1;
			}
			return 1;
		}
		else return SendClientMessage(playerid, 0x00000014, "You are not near any trucks!");
	}
	else return SendClientMessage(playerid, 0x00000014, "You cannot use this command");
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
   	if(pickupid == PickUpLoad)
	{
		GameTextForPlayer(playerid,"~b~Use /unloadiron to sell your iron!",2000,1);
	    return 1;
	}
  	if(pickupid == PickUpUnload)
	{
		GameTextForPlayer(playerid,"~b~Use /loadiron to buy your iron!",2000,1);
	    return 1;
	}
	return 1;
}
Reply


Messages In This Thread
I need some help with my trucking FS - by Zigonja - 29.05.2013, 17:20
Re: I need some help with my trucking FS - by GiamPy. - 29.05.2013, 21:17
Re: I need some help with my trucking FS - by Zigonja - 29.05.2013, 21:38
Re: I need some help with my trucking FS - by GiamPy. - 29.05.2013, 21:44
Re: I need some help with my trucking FS - by Zigonja - 29.05.2013, 22:09
Re: I need some help with my trucking FS - by Zigonja - 30.05.2013, 12:19
Re: I need some help with my trucking FS - by GiamPy. - 30.05.2013, 12:23
Re: I need some help with my trucking FS - by Zigonja - 30.05.2013, 13:28

Forum Jump:


Users browsing this thread: 1 Guest(s)