I need help!!
#1

Im making a filterscript with Truck Jobs - and i need it so when i type "/work" a random checkpoint gets spawned at a selection of locations at my choice (using enum arrays, new:rand and SetPlayerCheckpoint(playerid....)

Everytime i type "/work" the filterscript (or the bit of script that is associated with "/work") crashes SAMP, i have tested it with and XP/Vista and Windows 7 Computer, im still having the same problem. Its not the server as i can type it when im not in a vehicle (it filters those out as it needs a vehicle and trailer to do the 'mission')

Heres my PAWN Code:

Код:
#include <a_samp>

public OnFilterScriptInit()
{
	print("Truck Delivery's v1");
	return 1;
	
}

//Make some destinations...
// ARRAY NAME deliveries
enum missions {lx,ly,lz,lpname[64],loadname[32],ux,uy,uz,ulpname[64]}
new deliveries[4][missions] = {
// Template: {lx, ly, lz, lpname, loadname, ux, uy, uz, upname},
// Dont include comma on last!!!!
{2508.4147969219, -1680.45083173828, 13.882020950317, "Johnson Supplies", "Food and Drink", -1279.8430175781, 13.548866211973, 14.1484375, "San Fierro Airport Goods"},
{2417.0979003906, -2465.91483066405, 13.625, "Los Santos Docks Outlet", "Golf Supplies", -2762.4267578125, -407.31970214844, 7.1383958094482, "Avispa Country Club"},
{1571.642822656, -2465.91483066405, -2.685785635375, "Los Santos Airport Loading Bay", "Car Parts and Equipment", -1787.2645263672, 1194.8106689453, 24.9765625, "Michelles Garage"},
{1244.3974609375, -2055.2719726563, 59.858139038086, "Los Santos Tourism Manor", "Souvenirs", -1530.7282714844, 503.84100361797, 7.1796875, "San Fierro Military Services"}
};

// Random Checkpoint Generator, uses array above
public SetDeliveryRandomCheckpoint(playerid)
{
    new rand = random(sizeof(deliveries));
    SetPlayerCheckpoint(playerid, deliveries[rand][lx], deliveries[rand][ly], deliveries[rand][lz], 10); // Randomize the Checkpoint by using enum statement with sizeof array - simples :)
	return 1;
}

// Begin the script...
public OnPlayerSpawn(playerid)
{
	SendClientMessage(playerid, 0x00FF00FF, "Type /work to start earning money");
	SendClientMessage(playerid, 0x00FF00FF, "You must be in a truck with a trailer attached to work");
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/work", cmdtext, true, 5) == 0)
	{
	    if (IsPlayerInAnyVehicle(playerid) == 1)
	    {
	        if (IsTrailerAttachedToVehicle(GetPlayerVehicleID(playerid)) == 1)
	        {
	            SetDeliveryRandomCheckpoint(playerid);
				GameTextForPlayer(playerid, "Deliver the trailer to the ~r~marked ~rlocation", 10, 1);
				SendClientMessage(playerid, 0x00FF00FF, "When you have reached the marked location, park and type /deliver");
	        }
	        else
	        {
	        SendClientMessage(playerid, 0x00FF00FF, "You must have a trailer attached to your truck to work");
	        }
	    }
	    else
	    {
	        SendClientMessage(playerid, 0x00FF00FF, "You must be in a vehicle to work");
	 	}
	 	return 1;
	}
	// There already? You better deliver...
	if (IsPlayerInCheckpoint(playerid) == 1)
	{
		if(IsPlayerInAnyVehicle(playerid) == 1)
		{
		SendClientMessageToAll(0x00FF00FF, "A delivery has been made");
	    SendClientMessage(playerid, 0x00FF00FF, "Well done, you succesfully delivered");
	    SendClientMessage(playerid, 0x00FF00FF, "You earned $2500 for your effort");
	    GivePlayerMoney(playerid, 2500);
	    DestroyVehicle(GetVehicleTrailer(GetPlayerVehicleID(playerid)));
	    }
	    
	}
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}
Sorry if its a bit big, i dont know how to use pastebin
Reply
#2

I really need this sorted soonish, sorry to rush everyone thats read it

*Sorry about the bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)