Help with Trash Job
#1

This is job script:
When i wanna start job it don't shows checkpoint ....
Please help me ;(
Код:
#include <a_samp>
#include <core>
#include <float>
#include <a_players>
#include <a_vehicles>
#include <string>
#include <dini>
#include <time>
#define COLOR_GREEN 0x33AA33AA
#pragma unused ret_memcpy
public OnFilterScriptInit()
{
	print("\n--------------------------------------------");
	print("      Trash Job           \n");
	print("--------------------------------------------\n");
	SetTimer("checkpointUpdate", 1100, 1);
	SetTimer("TrashMissionTimer",1000,1);
	return 1;
}

forward TrashMissionTimer();
forward checkpointUpdate();
forward isPlayerInArea(playerID, Float:data[4]);
forward getCheckpointType(playerID);

new TrashDeliveryTime[MAX_PLAYERS];
new TrashDeliveryEarnings[MAX_PLAYERS];
new OnDelMission[MAX_PLAYERS];
new playerCheckpoint[MAX_PLAYERS];

#define CP_TRASHPICKUP1 0
#define CP_TRASHPICKUP2 1
#define CP_TRASHPICKUP3 2
#define CP_TRASHPICKUP4 3
#define CP_TRASHPICKUP5 4
#define CP_TRASHPICKUP6 5
#define CP_TRASHPICKUP7 6
#define CP_TRASHPICKUP8 7
#define CP_TRASHPICKUP9 8
#define CP_TRASHPICKUP10 9
#define CP_TRASHPICKUP11 10

#define MAX_POINTS 11
new Float:checkCoords[MAX_POINTS][4] = {
{4446.9814, 1987.1090, 4453.0605, 1992.0865}, // Trash Pickup 1
{4446.9814, 1987.1090, 4453.0605, 1992.0865}, // Trash Pickup 2
{4446.9814, 1987.1090, 4453.0605, 1992.0865}, // Trash Pickup 3
{4446.9814, 1987.1090, 4453.0605, 1992.0865}, // Trash Pickup 4
{4446.9814, 1987.1090, 4453.0605, 1992.0865}, // Trash Pickup 5
{4446.9814, 1987.1090, 4453.0605, 1992.0865}, // Trash Pickup 6
{4446.9814, 1987.1090, 4453.0605, 1992.0865}, // Trash Pickup 7
{4446.9814, 1987.1090, 4453.0605, 1992.0865}, // Trash Pickup 8
{4446.9814, 1987.1090, 4453.0605, 1992.0865}, // Trash Pickup 9
{4446.9814, 1987.1090, 4453.0605, 1992.0865}, // Trash Pickup 10
{4446.9814, 1987.1090, 4453.0605, 1992.0865} // Trash Pickup 11
};

new Float:checkpoints[MAX_POINTS][4] = {
{2581.4673,2148.2505,10.8203,5.0},
{2062.6243,2238.9121,10.1745,5.0},
{2297.3096,1567.2032,10.8203,5.0},
{2121.1802,1232.1056,10.8203,5.0},
{2198.5732,937.0938,10.8203,5.0},
{2049.3103,658.2263,11.3006,5.0},
{1654.0845,1080.9868,10.8203,5.0},
{1286.5367,1252.1665,10.8203,5.0},
{824.2954,856.6764,12.0343,5.0},
{-1689.0303,683.4731,21.7940,5.0},
{-1808.2322,-1649.6141,23.6609,5.0}
};

new checkpointType[MAX_POINTS] = {
CP_TRASHPICKUP1,
CP_TRASHPICKUP2,
CP_TRASHPICKUP3,
CP_TRASHPICKUP4,
CP_TRASHPICKUP5,
CP_TRASHPICKUP6,
CP_TRASHPICKUP7,
CP_TRASHPICKUP8,
CP_TRASHPICKUP9,
CP_TRASHPICKUP10,
CP_TRASHPICKUP11
};

public getCheckpointType(playerID) {
return checkpointType[playerCheckpoint[playerID]];
}

public isPlayerInArea(playerID, Float:data[4])
{

new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerID, X, Y, Z);
if(X >= data[0] && X <= data[2] && Y >= data[1] && Y <= data[3])
{
return 1;
}
return 0;
}

public checkpointUpdate()
{
for(new i=0; i<MAX_PLAYERS; i++)
{

 if(IsPlayerConnected(i))
 {
 if(OnDelMission[i] == 0)
 {



 for(new j=0; j < MAX_POINTS; j++)
 {

 if(isPlayerInArea(i, checkCoords[j]))
  {
  if(playerCheckpoint[i]!=j)
  {
  DisablePlayerCheckpoint(i);
  SetPlayerCheckpoint(i, checkpoints[j][0],checkpoints[j][1],checkpoints[j][2],checkpoints[j][3]);
  playerCheckpoint[i] = j;
  }
  }
  else
  {
  if(playerCheckpoint[i]==j)
  {
  DisablePlayerCheckpoint(i);
  playerCheckpoint[i] = 999;
  }
  }
 }
 }
}
}
}

public TrashMissionTimer()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
	{
   if(OnDelMission[i] == 1337)
	 {
    TrashDeliveryTime[i] ++;
    TrashDeliveryEarnings[i] --;

  }
 }
}

public OnPlayerConnect(playerid)
{
TrashDeliveryTime[playerid] =0;
TrashDeliveryEarnings[playerid] =0;
OnDelMission[playerid] =0;
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	OnDelMission[playerid] =0;
  return 1;
}

public OnPlayerCommandText(playerid,cmdtext[])
{
  new idx;
  	new cmd[256];
  cmd = strtok(cmdtext, idx);
  if (strcmp("/adarbas", cmd, true, 10) == 0)
	{
		if(!IsPlayerInAnyVehicle(playerid)) {
		SendClientMessage(playerid,COLOR_GREEN,"Komunalinių atliekų rinkimą gali pradėti tik būdamas TrashMaster sunkveћimyje...");
		return 1;
	}
	  if(OnDelMission[playerid] == 1337) {
		SendClientMessage(playerid,COLOR_GREEN,"Tu jau dirbi");
		return 1;
	}
	  new vehicleid = GetPlayerVehicleID(playerid);
  	if(GetVehicleModel(vehicleid) != 408) {
  	SendClientMessage(playerid,COLOR_GREEN,"Komunalinių atliekų rinkimą gali pradėti tik būdamas TrashMaster sunkveћimyje...");
		return 1;
	}
		new vidy = GetPlayerVehicleID(playerid);
	  if(GetVehicleModel(vidy) == 408) {
	  SetPlayerSkin(playerid, 158);
		SendClientMessage(playerid, 0xA9A9A9AA, "Komunalinių Atliekų Rinkimas");
		SendClientMessage(playerid,0xADD8E6AA,"Tu pradėjai Atliekų Surinkimo Darbą. Jeigu iљlipsi iљ sunkveћimio, tuomet tavo darbas baigsis");
		SendClientMessage(playerid,0xADD8E6AA,"Tavo reikiamas maљrutas yra pavaizduotas Maћajame ћemėlapyje raudonu taљku.");
		SendClientMessage(playerid,0xADD8E6AA,"Atlygį gausi tik kai būsi atveћęs atliekas į savartyną.");
		SendClientMessage(playerid,0xADD8E6AA,"Atlygio dydis priklauso nuo sugaiљto laiko. Tad nesnausk ir pirmyn!!!");
		SendClientMessage(playerid,0xADD8E6AA,"Pirmas tavo marљrutas Well Stacked Pizza Co, Old Las Venturas Strip rajone");
		DisablePlayerCheckpoint(playerid);
  	playerCheckpoint[playerid] = 0;
  	TrashDeliveryTime[playerid] =0;
  	TrashDeliveryEarnings[playerid] =80000;
    SetPlayerCheckpoint(playerid,checkpoints[0][0],checkpoints[0][1],checkpoints[0][2],checkpoints[0][3]); // no 1
		OnDelMission[playerid] = 1337;
		}
		return 1;
  }
	return 0;
}

public OnPlayerEnterCheckpoint(playerid)
{
  new string[256];
	if(getCheckpointType(playerid) == 0 && getCheckpointType(playerid) == 0)
	{
	  if(OnDelMission[playerid] == 1337)
	  {
		SendClientMessage(playerid, 0xA9A9A9AA, "Komunalinės Atliekos");
		SendClientMessage(playerid,0xADD8E6AA,"Tu surinkai atliekas iљ Well Stacked Pizza Co");
		SendClientMessage(playerid,0xADD8E6AA,"Kitas tavo marљrutas Well Stacked Pizza Co, The Emerald Isle rajone");
    DisablePlayerCheckpoint(playerid);
  	playerCheckpoint[playerid] = 1;
    SetPlayerCheckpoint(playerid,checkpoints[1][0],checkpoints[1][1],checkpoints[1][2],checkpoints[1][3]); // no 2
	}
    return 1;
	}

	if(getCheckpointType(playerid) == 1 && getCheckpointType(playerid) == 1)
	{
	  if(OnDelMission[playerid] == 1337)
	  {
		SendClientMessage(playerid, 0xA9A9A9AA, "Komunalinės Atliekos");
		SendClientMessage(playerid,0xADD8E6AA,"Tu surinkai atliekas iљ Well Stacked Pizza Co");
		SendClientMessage(playerid,0xADD8E6AA,"Kitas tavo marљrutas Caligulas Casino ");
		DisablePlayerCheckpoint(playerid);
  	playerCheckpoint[playerid] = 2;
    SetPlayerCheckpoint(playerid,checkpoints[2][0],checkpoints[2][1],checkpoints[2][2],checkpoints[2][3]); // no 2
	}
    return 1;
	}
	if(getCheckpointType(playerid) == 2 && getCheckpointType(playerid) == 2)
	{
	  if(OnDelMission[playerid] == 1337)
	  {
		SendClientMessage(playerid, 0xA9A9A9AA, "Komunalinės Atliekos");
		SendClientMessage(playerid,0xADD8E6AA,"Tu surinkai atliekas iљ Caligulas Casino");
		SendClientMessage(playerid,0xADD8E6AA,"Kitas tavo marљrutas Admin HQ ");
		DisablePlayerCheckpoint(playerid);
  	playerCheckpoint[playerid] = 3;
    SetPlayerCheckpoint(playerid,checkpoints[3][0],checkpoints[3][1],checkpoints[3][2],checkpoints[3][3]); // no 2
	}
    return 1;
	}
	if(getCheckpointType(playerid) == 3 && getCheckpointType(playerid) == 3)
	{
	  if(OnDelMission[playerid] == 1337)
	  {
		SendClientMessage(playerid, 0xA9A9A9AA, "Komunalinės Atliekos");
		SendClientMessage(playerid,0xADD8E6AA,"Tu surinkai atliekas iљ from Admin HQ");
		SendClientMessage(playerid,0xADD8E6AA,"Kitas tavo marљrutas Ammunation parduotuvė");
		DisablePlayerCheckpoint(playerid);
  	playerCheckpoint[playerid] = 4;
    SetPlayerCheckpoint(playerid,checkpoints[4][0],checkpoints[4][1],checkpoints[4][2],checkpoints[4][3]); // no 2
	}
    return 1;
	}
	if(getCheckpointType(playerid) == 4 && getCheckpointType(playerid) == 4)
	{
	  if(OnDelMission[playerid] == 1337)
	  {
		SendClientMessage(playerid, 0xA9A9A9AA, "Komunalinės Atliekos");
		SendClientMessage(playerid,0xADD8E6AA,"Tu surinkai atliekas iљ Ammunation parduotuvės");
		SendClientMessage(playerid,0xADD8E6AA,"Kitas tavo marљrutas senos Močiutės namas Rockshore rajone");
		DisablePlayerCheckpoint(playerid);
  	playerCheckpoint[playerid] = 5;
    SetPlayerCheckpoint(playerid,checkpoints[5][0],checkpoints[5][1],checkpoints[5][2],checkpoints[5][3]); // no 2
	}
    return 1;
	}
	if(getCheckpointType(playerid) == 5 && getCheckpointType(playerid) == 5)
	{
	  if(OnDelMission[playerid] == 1337)
	  {
		new grandmarand = random(10000);

    SendClientMessage(playerid, 0xA9A9A9AA, "Komunalinės Atliekos");
		SendClientMessage(playerid,0xADD8E6AA,"Tu surinkai atliekas iљ senos Močiutės namo Rockshore rajone");
		format(string, sizeof(string), "Sena Močiutė tau padovanojo $%d uћ gerą darbą. Pakvipo Meile!!!.",grandmarand);
  	SendClientMessage(playerid,0xADD8E6AA, string);
  	format(string, sizeof(string), "~r~Dovana-~w~$%d~n~",grandmarand);
		GameTextForPlayer(playerid,string,6000,3);
		SendClientMessage(playerid,0xADD8E6AA,"Kitas tavo marљrutas LVA Freight Depot");
		GivePlayerMoney(playerid,grandmarand);
		DisablePlayerCheckpoint(playerid);
  	playerCheckpoint[playerid] = 6;
    SetPlayerCheckpoint(playerid,checkpoints[6][0],checkpoints[6][1],checkpoints[6][2],checkpoints[6][3]); // no 2
	}
    return 1;
	}
	if(getCheckpointType(playerid) == 6 && getCheckpointType(playerid) == 6)
	{
	  if(OnDelMission[playerid] == 1337)
	  {
	  SendClientMessage(playerid, 0xA9A9A9AA, "Komunalinės Atliekos");
	  SendClientMessage(playerid,0xADD8E6AA,"Tu surinkai atliekas iљ LVA Freight Depot");
		SendClientMessage(playerid,0xADD8E6AA,"Kitas tavo marљrutas LVPD Air Support Unit");
		DisablePlayerCheckpoint(playerid);
  	playerCheckpoint[playerid] = 7;
    SetPlayerCheckpoint(playerid,checkpoints[7][0],checkpoints[7][1],checkpoints[7][2],checkpoints[7][3]); // no 2
	}
    return 1;
	}
	if(getCheckpointType(playerid) == 7 && getCheckpointType(playerid) == 7)
	{
	  if(OnDelMission[playerid] == 1337)
	  {
	  SendClientMessage(playerid, 0xA9A9A9AA, "Komunalinės Atliekos");
		SendClientMessage(playerid,0xADD8E6AA,"Tu surinkai atliekas iљ LVPD Air Support Unit");
		SendClientMessage(playerid,0xADD8E6AA,"Kitas tavo marљrutas The Quarry");
		DisablePlayerCheckpoint(playerid);
  	playerCheckpoint[playerid] = 8;
    SetPlayerCheckpoint(playerid,checkpoints[8][0],checkpoints[8][1],checkpoints[8][2],checkpoints[8][3]); // no 2
	}
    return 1;
	}
	if(getCheckpointType(playerid) == 8 && getCheckpointType(playerid) == 8)
	{
	  if(OnDelMission[playerid] == 1337)
	  {
		SendClientMessage(playerid, 0xA9A9A9AA, "Komunalinės Atliekos");
		SendClientMessage(playerid,0xADD8E6AA,"Tu surinkai atliekas iљ The Quarry");
		SendClientMessage(playerid,0xADD8E6AA,"Kitas tavo marљrutas San Fierro Police Department");
		DisablePlayerCheckpoint(playerid);
  	playerCheckpoint[playerid] = 9;
    SetPlayerCheckpoint(playerid,checkpoints[9][0],checkpoints[9][1],checkpoints[9][2],checkpoints[9][3]); // no 2
	}
    return 1;
	}
	if(getCheckpointType(playerid) == 9 && getCheckpointType(playerid) == 9)
	{
	  if(OnDelMission[playerid] == 1337)
	  {
		SendClientMessage(playerid, 0xA9A9A9AA, "Komunalinės Atliekos");
		SendClientMessage(playerid,0xADD8E6AA,"Tu surinkai atliekas iљ San Fierro Police Department");
		SendClientMessage(playerid,0xADD8E6AA,"Tai buvo paskutinis tavo marљrutas. Dabar nuvaћiuok į savartyną!");
		SendClientMessage(playerid,0xADD8E6AA,"Miesto savivaldybė tau sumokės tik tada, kai atliekos bus savartyne!");
		DisablePlayerCheckpoint(playerid);
  	playerCheckpoint[playerid] = 10;
    SetPlayerCheckpoint(playerid,checkpoints[10][0],checkpoints[10][1],checkpoints[10][2],checkpoints[10][3]); // no 2
 }
    return 1;
	}
	if(getCheckpointType(playerid) == 10 && getCheckpointType(playerid) == 10)
	{
	  if(OnDelMission[playerid] == 1337)
	  {
		new trashtime = (TrashDeliveryTime[playerid]);
		new trashearn = (TrashDeliveryEarnings[playerid]);
		new trashname[30];
		GetPlayerName(playerid,trashname,30);
		format(string, sizeof(string), "%s surinko visas atliekas ir padarė miestą љvaresnį. Jis uћtruko %d sekundћių(-es)",trashname,trashtime);
  	SendClientMessageToAll(0x00C7FFAA, string);
		SendClientMessage(playerid, 0xA9A9A9AA, "Komunalinės Atliekos");
		SendClientMessage(playerid,0xADD8E6AA,"Tu surinkai visas atliekas. Tu padarei miestą љvaresnį");
		format(string, sizeof(string), "Uћtrukai %d sekundћių(-es). Atlygis: $%d ",trashtime,trashearn);
  	SendClientMessage(playerid,0xADD8E6AA, string);
		DisablePlayerCheckpoint(playerid);
  	playerCheckpoint[playerid] = 999;
  	OnDelMission[playerid] =0;
  	GivePlayerMoney(playerid,trashearn);
	  }
	  return 1;
  }
  return 0;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
  if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
	{
  new vehicleid = GetPlayerVehicleID(playerid);
  if(GetVehicleModel(vehicleid) == 408) {
  SendClientMessage(playerid,0x00C7FFAA,"Raљyk /adarbas, kad pradėtum dirbti Komunalinių Atliekų Surinkėjo Darbą");
  return 1;
	}
 }
  return 0;
}
Reply
#2

Please use the Code button for your script, its really hard to read that
Reply
#3

Ok
Reply
#4

Patrikas, he want's you to post your code at pastebin, not quoting it again..
Reply
#5

Use http://pastbin.com

OR
Код:
Use the CODE TAGS!

Reply
#6

I'm a new in this forum, sorry
Reply
#7

It's okay, everyone was new at one point

Okay, which command do you use to start the job?
Reply
#8

When in TrashMaster write /adarbas command.
Reply
#9

Anyone could fix this problem?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)