Una ayudita por favor
#1

alguien me ayuda con esto quiero poner 2 pero siempre me aparece en el mismo nunca sale el segundo
Код:
// Create a checkpoint to indicate the base
SetPlayerCheckpoint(playerid, 2444.62, 2778.15, 10.82, 10.0);
SetPlayerCheckpoint(playerid, 1454.30, 2578.08, 5.25, 10.0);
Reply
#2

Ponle el uno y al llegar al uno ponle el otro, o de otra manera mapea los cp, y por rango programas con pawno.
Reply
#3

Quote:
Originally Posted by jotajeda
Посмотреть сообщение
Ponle el uno y al llegar al uno ponle el otro, o de otra manera mapea los cp, y por rango programas con pawno.
y eso como lo hago me lo puedes hacer tu por favor que salga uno y luego otro por favor
Reply
#4

Quote:
Originally Posted by miguelangel988
Посмотреть сообщение
y eso como lo hago me lo puedes hacer tu por favor que salga uno y luego otro por favor
pawn Код:
new cp[1][MAX_PLAYERS];

public OnPlayerSpawn(playerid)//o en otro momento
{
    SetPlayerCheckpoint(playerid, 2444.62, 2778.15, 10.82, 10.0);//un cp
    cp[0][playerid] = 1;//se usarб como identificador del cp de arriba.
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)//aqui se llama cuando entra a un cp
{
    if(cp[0][playerid])//identifica al cp 1 si es 1 pasa si es 0 no.
    {
        if(IsPlayerInRangeOfPoint(playerid, 10.0 , 2444.62, 2778.15, 10.82 ) )//rango
        {
            SetPlayerCheckpoint(playerid, 1454.30, 2578.08, 5.25, 10.0);//cp 2
            cp[0][playerid] = 0;// reset v 1
            cp[1][playerid] = 1; //set v 2
            return true;
        }
    }
    if(cp[1][playerid]) //lo mismo de arriba.
    {
        if(IsPlayerInRangeOfPoint(playerid, 10.0 , 1454.30, 2578.08, 5.25 ) )//cp 2
        {
            SetPlayerSkin(playerid,178); // :D
            print("Fin");
        }
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by jotajeda
Посмотреть сообщение
pawn Код:
new cp[1][MAX_PLAYERS];

public OnPlayerSpawn(playerid)//o en otro momento
{
    SetPlayerCheckpoint(playerid, 2444.62, 2778.15, 10.82, 10.0);//un cp
    cp[0][playerid] = 1;//se usarб como identificador del cp de arriba.
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)//aqui se llama cuando entra a un cp
{
    if(cp[0][playerid])//identifica al cp 1 si es 1 pasa si es 0 no.
    {
        if(IsPlayerInRangeOfPoint(playerid, 10.0 , 2444.62, 2778.15, 10.82 ) )//rango
        {
            SetPlayerCheckpoint(playerid, 1454.30, 2578.08, 5.25, 10.0);//cp 2
            cp[0][playerid] = 0;// reset v 1
            cp[1][playerid] = 1; //set v 2
            return true;
        }
    }
    if(cp[1][playerid]) //lo mismo de arriba.
    {
        if(IsPlayerInRangeOfPoint(playerid, 10.0 , 1454.30, 2578.08, 5.25 ) )//cp 2
        {
            SetPlayerSkin(playerid,178); // :D
            print("Fin");
        }
    }
    return 1;
}
me lo puedes poner aqui por favor este es el codigo que te pase pero completo

Код:
// Forward the function used to repair a camera (when the player entered a racecheckpoint)
forward Roadworker_RepairCamera(playerid);
new Text:Test;
new Text:Test1;
enum TBrokenVehicleLocation
{
	BrokenName[50], // Holds the name of the location where the vehicle is located
	Float:BrokenX, // Holds the X coordinate where the vehicle spawns
	Float:BrokenY, // Holds the Y coordinate where the vehicle spawns
	Float:BrokenZ // Holds the Z coordinate where the vehicle spawns
}
new ABrokenVehicles[][TBrokenVehicleLocation] =
{
	{"Shady Creeks", -2047.5, -1882.25, 52.4},
	{"Angel Pine", -2072.5, -2407.75, 30.7},
	{"Shady Creeks", -1595.25, -2625.0, 52.6},
	{"Back O Beyond", -990.25, -2335.5, 66.8},
	{"Flint County", 46.5, -2654.25, 40.5},
	{"Los Santos Inlet", -313.5, -1959.75, 20.0},
	{"Leafy Hollow", -833.0, -1737.25, 80.8},
	{"Flint Range", -347.5, -1331.0, 17.1},
	{"Flint County", 17.25, -987.75, 28.7},
	{"Fallen Tree", -763.0, -621.25, 61.5},
	{"Foster Valley", -1885.5, -435.5, 25.2},
	{"Missionary Hill", -2451.25, -681.0, 133.6},
	{"Garcia", -2371.5, 118.25, 35.3},
	{"Downtown", -1781.5, 429.25, 16.6},
	{"Palisades", -2905.0, 656.5, 6.3},
	{"Paradiso", -2771.25, 1239.5, 22.6}
//	{"nnnnnnnnnn", xxxxxxx, yyyyyyyy, zzzzzzz},
};



// This function is called when a roadworker wants to start a job by entering "/work"
Roadworker_StartRandomJob(playerid)
{
	Test = TextDrawCreate(240.000000, 368.000000, "");
	TextDrawBackgroundColor(Test, 255);
	TextDrawFont(Test, 1);
	TextDrawLetterSize(Test, 0.289999, 2.799997);
	TextDrawColor(Test, -1);
	TextDrawSetOutline(Test, 0);
	TextDrawSetProportional(Test, 1);
	TextDrawSetShadow(Test, 1);
	TextDrawSetSelectable(Test, 0);

	Test1 = TextDrawCreate(228.000000, 390.000000, "");
	TextDrawBackgroundColor(Test1, 255);
	TextDrawFont(Test1, 1);
	TextDrawLetterSize(Test1, 16.310024, 0.499997);
	TextDrawColor(Test1, -1);
	TextDrawSetOutline(Test1, 0);
	TextDrawSetProportional(Test1, 1);
	TextDrawSetShadow(Test1, 1);
	TextDrawSetSelectable(Test1, 0);

	// Setup local variables
	new vid, trailerid;

	// If the player is the driver of the vehicle (GetPlayerVehicleSeat returns -1 if the player is not in a vehicle)
	if (GetPlayerVehicleSeat(playerid) == 0)
	{
		// Get the vehicle-id
		vid = GetPlayerVehicleID(playerid);
		// Get the trailer-id
		trailerid = GetVehicleTrailer(vid);

		switch (GetVehicleModel(vid))
		{
		    case VehicleUtilityVan: // With a Utility Van, you're gonna do "repair speedcamera" job-type
		    {
    		    // Setup local variables
    			new Float:x, Float:y, Float:z, CamID;
    			// Get a random speedcamera (no previous camera has been fixed yet, so Exception = -1 (invalid camera))
    			CamID = GetRandomCamera(-1);
    			// Check if there are no speedcamera's
    			if (CamID == -1)
    			{
    				SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Nгo tem radares na cidade para vocк fazer manutenзгo!");
    				return 1;
    			}

    			// Job has started
    			APlayerData[playerid][JobStarted] = true;
    			// Set job-type
    			APlayerData[playerid][JobID] = 1; // Job-type: "repair speedcameras"
    			// Store the CamID
    			APlayerData[playerid][JobLoc1] = CamID;
    			// Set the TextDraw so the player can see it
    			TextDrawSetString(Trapo[playerid], TXT_RepairSpeedcamera);

    			// Grab the x, y, z positions for the checkpoint
    			x = ACameras[CamID][CamX];
    			y = ACameras[CamID][CamY];
    			z = ACameras[CamID][CamZ];
    			// Create a racecheckpoint where the player should repair a speedcamera
                SetPlayerRaceCheckpoint(playerid, 1, x, y, z, 0.0, 0.0, 0.0, 2.5);
    			// Create a checkpoint to indicate the base
    			SetPlayerCheckpoint(playerid, -1870.0, -1710.0, 21.8, 7.0);

    			// Store the vehicleID (required to be able to check if the player left his vehicle)
    			APlayerData[playerid][VehicleID] = vid;
    			APlayerData[playerid][TrailerID] = trailerid;
    			// Start a timer that ticks every second to see if the player is still inside his vehicle
    			APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission;
    			// Inform the player what he must do
    			SendClientMessage(playerid, 0xFFFFFFFF, "{a9c4e4}Repare o {ffffff}radar {a9c4e4}indicado no mapa, ou {ffffff}retorne para a base {a9c4e4}para terminar o trabalho.");
			}
			case VehicleTowTruck: 
			{
				new Float:x, Float:y, Float:z, RouteText[128];
				APlayerData[playerid][JobStarted] = true;
				APlayerData[playerid][JobID] = 2;
				APlayerData[playerid][JobLoc1] = random(sizeof(ABrokenVehicles));
				APlayerData[playerid][JobStep] = 1;
				format(RouteText, 128, TXT_TowBrokenVehicle, ABrokenVehicles[APlayerData[playerid][JobLoc1]][BrokenName]);
				TextDrawSetString(Trapo[playerid], RouteText);
				x = ABrokenVehicles[APlayerData[playerid][JobLoc1]][BrokenX];
				y = ABrokenVehicles[APlayerData[playerid][JobLoc1]][BrokenY];
				z = ABrokenVehicles[APlayerData[playerid][JobLoc1]][BrokenZ];
				SetPlayerCheckpoint(playerid, x, y, z, 10.0);
				APlayerData[playerid][LoadID] = CreateBrokenVehicle(x, y, z);
				APlayerData[playerid][VehicleID] = vid;
				APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission;
				SendClientMessage(playerid, 0xFFFFFFFF, "{a9c4e4}Leve o {ffffff}veнculo quebrado{a9c4e4} para o triturador.");
			}
		}
	}

	return 1;
}
Roadworker_EnterCheckpoint(playerid)
{
	new RouteText[128];
	if (APlayerData[playerid][JobID] == 2)
	{
		if (GetPlayerVehicleID(playerid) == APlayerData[playerid][VehicleID])
		{
			switch (APlayerData[playerid][JobStep])
			{
			    case 1: 
			    {
					DisablePlayerCheckpoint(playerid);
					AttachTrailerToVehicle(APlayerData[playerid][LoadID], GetPlayerVehicleID(playerid));
					format(RouteText, 128, TXT_DeliverBrokenVehicle, ABrokenVehicles[APlayerData[playerid][JobLoc1]][BrokenName]);
					TextDrawSetString(Trapo[playerid], RouteText);
					SetPlayerCheckpoint(playerid, -1868.5, -1684.0, 21.8, 10.0);
					APlayerData[playerid][JobStep] = 2;
					APlayerData[playerid][VehicleID] = GetPlayerVehicleID(playerid);
					APlayerData[playerid][TrailerID] = APlayerData[playerid][LoadID];
					SendClientMessage(playerid, 0xFFFFFFFF, "{228B22}Reboque o {ffffff}veнculo quebrado{228B22} atй o triturador.");
			    }
			    case 2: 
			    {
			        AVehicleData[APlayerData[playerid][LoadID]][Owned] = false;
			        DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
			        DestroyVehicle(APlayerData[playerid][LoadID]);
			        APlayerData[playerid][LoadID] = 0;
					Roadworker_EndJob(playerid);
					RewardPlayer(playerid, 3500, 1);
					SendClientMessage(playerid, 0xFFFFFFFF, "{a9c4e4}Vocк ganhou {00ff00}R${ffffff}3500{a9c4e4} por entregar esse veнculo quebrado no triturador.");
                    SetPVarInt(playerid, "PVarGold", 20);
					APlayerData[playerid][StatsRoadworkerJobs]++;
					PlayerFile_Save(playerid);
			    }
			}
		}
		else
			SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Vocк precisa de um Towtruck para continuar.");
	}

	return 1;
}
Roadworker_EnterRaceCheckpoint(playerid)
{
	if (APlayerData[playerid][JobID] == 1) 
	{
		if (GetPlayerVehicleSeat(playerid) == -1)
		{
            new newtextxDgh[1000];
            format(newtextxDgh, sizeof(newtextxDgh), "Fazendo Manutencao ao Radar ~n~           ~r~Aguarde ~w~~h~...");
            TextDrawSetString(Test, newtextxDgh);
            TextDrawShowForPlayer(playerid, Test);

            new linhabonita[1000];
            format(linhabonita, sizeof(linhabonita), ".");
            TextDrawSetString(Test1, linhabonita);
            TextDrawShowForPlayer(playerid, Test1);

			TogglePlayerControllable(playerid, 0);
			APlayerData[playerid][LoadingTimer] = SetTimerEx("Roadworker_RepairCamera", 5000, false, "d" , playerid);
		}
		else
		    SendClientMessage(playerid, 0xFFFFFFFF, TXT_NeedOnFootToProceed);
	}
	return 1;
}
public Roadworker_RepairCamera(playerid)
{
    // Setup local variables
	new Float:x, Float:y, Float:z, CamID;

	// Pay the player for fixing this camera
	RewardPlayer(playerid, 5000, 1);

	// Also increase the stats
	APlayerData[playerid][StatsRoadworkerJobs]++;
	// Save the player's account
	PlayerFile_Save(playerid);

	// Get a random speedcamera (don't allow the function to choose the same camera that just has been fixed)
	CamID = GetRandomCamera(APlayerData[playerid][JobLoc1]);
	// Store the CamID
	APlayerData[playerid][JobLoc1] = CamID;

	// Set the mission-TextDraw so the player can see it
	TextDrawSetString(Trapo[playerid], TXT_RepairSpeedcamera);

	// First delete the racecheckpoint
	DisablePlayerRaceCheckpoint(playerid);
	// Grab the x, y, z positions for the checkpoint
	x = ACameras[CamID][CamX];
	y = ACameras[CamID][CamY];
	z = ACameras[CamID][CamZ];
	// Create a new racecheckpoint where the player should repair a speedcamera
	SetPlayerRaceCheckpoint(playerid, 1, x, y, z, 0.0, 0.0, 0.0, 2.5);

	// Enable the player's actions (he can move again)
	TogglePlayerControllable(playerid, 1);

    new newtextxDgh[1000];
    format(newtextxDgh, sizeof(newtextxDgh), " ");
    TextDrawSetString(Test, newtextxDgh);
    TextDrawShowForPlayer(playerid, Test);

    new linhabonitaxD[1000];
    format(linhabonitaxD, sizeof(linhabonitaxD), "");
    TextDrawSetString(Test1, linhabonitaxD);
    TextDrawShowForPlayer(playerid, Test1);

    new JOAOMONTEIRO[1000];
	format(JOAOMONTEIRO, sizeof(JOAOMONTEIRO), "{a9c4e4}Vocк ganhou {00ff00}R${ffffff}5000{a9c4e4} por fazer a manutenзгo desse radar.");
	SendClientMessageToAll(-1, JOAOMONTEIRO);
	format(JOAOMONTEIRO, sizeof(JOAOMONTEIRO), "{228B22}Repare o prуximo {ffffff}radar {228B22}indicado no mapa, ou {ffffff}retorne para a base {228B22}para terminar o trabalho.");
	SendClientMessageToAll(-1, JOAOMONTEIRO);
}
GetRandomCamera(Exception)
{
	new CameraList[100], CamCount = -1, CamID;
	for (CamID = 0; CamID < 100; CamID++)
	{
		if (ACameras[CamID][CamSpeed] > 0)
		{
			CamCount++;
			CameraList[CamCount] = CamID;
		}
	}
	if (CamCount == -1)
	    return -1;
	CamID = CameraList[random(CamCount + 1)];
	while (CamID == Exception)
		CamID = CameraList[random(CamCount + 1)];
	return CamID;
}
Roadworker_EndJob(playerid)
{
	if (APlayerData[playerid][JobStarted] == true)
	{
		APlayerData[playerid][JobStarted] = false;
		APlayerData[playerid][JobStep] = 0;
		APlayerData[playerid][JobID] = 0;
		APlayerData[playerid][VehicleTimerTime] = 0;
		APlayerData[playerid][VehicleID] = 0;
		APlayerData[playerid][TrailerID] = 0;
		APlayerData[playerid][JobLoc1] = 0;
		APlayerData[playerid][JobLoc2] = 0;
		if (APlayerData[playerid][LoadID] != 0)
		{
			DestroyVehicle(APlayerData[playerid][LoadID]);
			APlayerData[playerid][LoadID] = 0; 
		}
		DisablePlayerCheckpoint(playerid);
		DisablePlayerRaceCheckpoint(playerid);
		TextDrawSetString(Trapo[playerid], RoadWorker_NoJobText);
		KillTimer(APlayerData[playerid][LoadingTimer]);
	}
	return 1;
}
CreateBrokenVehicle(Float:x, Float:y, Float:z)
{
	new vid, panels, doors, lights, tires;
	new paramsengine, paramslights, paramsalarm, paramsdoors, paramsbonnet, paramsboot, paramsobjective;
	new BrokenVids[] = {400, 401, 402, 404, 405, 409, 410, 411, 412, 415, 419, 420, 421, 424, 426, 429, 434, 436, 438, 439, 442, 445, 451, 458, 466, 467, 474, 475, 477, 479, 480, 489, 490, 491, 492, 494, 495, 496, 500, 502, 503, 504, 505, 506, 507, 516, 517, 518, 526, 527, 528, 529, 533, 534, 535, 536, 540, 541, 542, 543, 545, 546, 547, 549, 550, 551, 552, 554, 555, 558, 559, 560, 561, 562, 565, 566, 567, 568, 575, 576, 579, 580, 582, 585, 587, 588, 589, 596, 597, 598, 599, 600, 602, 603};
    vid = CreateVehicle(BrokenVids[random(sizeof(BrokenVids))], x, y, z, random(360), random(126), random(126), 3600);
	AVehicleData[vid][Owned] = true;
	GetVehicleParamsEx(vid, paramsengine, paramslights, paramsalarm, paramsdoors, paramsbonnet, paramsboot, paramsobjective);
	SetVehicleParamsEx(vid, paramsengine, paramslights, paramsalarm, true, paramsbonnet, paramsboot, true);
	tires = encode_tires(1, 1, 1, 1); 
	panels = encode_panels(3, 3, 3, 3, 3, 3, 3); 
	doors = encode_doors(4, 4, 4, 4, 4, 4); 
	lights = encode_lights(1, 1, 1, 1);
	UpdateVehicleDamageStatus(vid, panels, doors, lights, tires);
	SetVehicleHealth(vid, 300.0);
	return vid;
}
encode_tires(tire1, tire2, tire3, tire4)
{
	return tire1 | (tire2 << 1) | (tire3 << 2) | (tire4 << 3);
}
encode_panels(flp, frp, rlp, rrp, windshield, front_bumper, rear_bumper)
{
    return flp | (frp << 4) | (rlp << 8) | (rrp << 12) | (windshield << 16) | (front_bumper << 20) | (rear_bumper << 24);
}
encode_doors(bonnet, boot, driver_door, passenger_door, behind_driver_door, behind_passenger_door)
{
    #pragma unused behind_driver_door
    #pragma unused behind_passenger_door
    return bonnet | (boot << 8) | (driver_door << 16) | (passenger_door << 24);
}
encode_lights(light1, light2, light3, light4)
{
    return light1 | (light2 << 1) | (light3 << 2) | (light4 << 3);
}
Reply
#6

Solo con ver me diу cancer, lo que te puse es para que tengas una idea, analiza todo y ponlo tu mismo. te harй un daсo si te hago todo, asi nunca aprenderбs.
Reply
#7

Quote:
Originally Posted by miguelangel988
Посмотреть сообщение
me lo puedes poner aqui por favor este es el codigo que te pase pero completo
Aca te lo dejo,pero es mejor que aprendas tu

pawn Код:
#include <a_samp>
// Forward the function used to repair a camera (when the player entered a racecheckpoint)
forward Roadworker_RepairCamera(playerid);
new Text:Test;
new Text:Test1;
new cp[2][MAX_PLAYERS];
enum TBrokenVehicleLocation
{
    BrokenName[50], // Holds the name of the location where the vehicle is located
    Float:BrokenX, // Holds the X coordinate where the vehicle spawns
    Float:BrokenY, // Holds the Y coordinate where the vehicle spawns
    Float:BrokenZ // Holds the Z coordinate where the vehicle spawns
}
new ABrokenVehicles[][TBrokenVehicleLocation] =
{
    {"Shady Creeks", -2047.5, -1882.25, 52.4},
    {"Angel Pine", -2072.5, -2407.75, 30.7},
    {"Shady Creeks", -1595.25, -2625.0, 52.6},
    {"Back O Beyond", -990.25, -2335.5, 66.8},
    {"Flint County", 46.5, -2654.25, 40.5},
    {"Los Santos Inlet", -313.5, -1959.75, 20.0},
    {"Leafy Hollow", -833.0, -1737.25, 80.8},
    {"Flint Range", -347.5, -1331.0, 17.1},
    {"Flint County", 17.25, -987.75, 28.7},
    {"Fallen Tree", -763.0, -621.25, 61.5},
    {"Foster Valley", -1885.5, -435.5, 25.2},
    {"Missionary Hill", -2451.25, -681.0, 133.6},
    {"Garcia", -2371.5, 118.25, 35.3},
    {"Downtown", -1781.5, 429.25, 16.6},
    {"Palisades", -2905.0, 656.5, 6.3},
    {"Paradiso", -2771.25, 1239.5, 22.6}
//  {"nnnnnnnnnn", xxxxxxx, yyyyyyyy, zzzzzzz},
};

public OnPlayerSpawn(playerid)//o en otro momento
{
    SetPlayerCheckpoint(playerid, 2444.62, 2778.15, 10.82, 10.0);//un cp
    cp[0][playerid] = 1;//se usarб como identificador del cp de arriba.
    return 1;
}

public OnPlayerEnterCheckpoint(playerid)//aqui se llama cuando entra a un cp
{
    if(cp[0][playerid])//identifica al cp 1 si es 1 pasa si es 0 no.
    {
        if(IsPlayerInRangeOfPoint(playerid, 10.0 , 2444.62, 2778.15, 10.82 ) )//rango
        {
            SetPlayerCheckpoint(playerid, 1454.30, 2578.08, 5.25, 10.0);//cp 2
            cp[0][playerid] = 0;// reset v 1
            cp[1][playerid] = 1; //set v 2
            return true;
        }
    }
    if(cp[1][playerid]) //lo mismo de arriba.
    {
        if(IsPlayerInRangeOfPoint(playerid, 10.0 , 1454.30, 2578.08, 5.25 ) )//cp 2
        {
            SetPlayerSkin(playerid,178); // :D
            print("Fin");
        }
    }
    return 1;
}
// This function is called when a roadworker wants to start a job by entering "/work"
Roadworker_StartRandomJob(playerid)
{
    Test = TextDrawCreate(240.000000, 368.000000, "");
    TextDrawBackgroundColor(Test, 255);
    TextDrawFont(Test, 1);
    TextDrawLetterSize(Test, 0.289999, 2.799997);
    TextDrawColor(Test, -1);
    TextDrawSetOutline(Test, 0);
    TextDrawSetProportional(Test, 1);
    TextDrawSetShadow(Test, 1);
    TextDrawSetSelectable(Test, 0);

    Test1 = TextDrawCreate(228.000000, 390.000000, "");
    TextDrawBackgroundColor(Test1, 255);
    TextDrawFont(Test1, 1);
    TextDrawLetterSize(Test1, 16.310024, 0.499997);
    TextDrawColor(Test1, -1);
    TextDrawSetOutline(Test1, 0);
    TextDrawSetProportional(Test1, 1);
    TextDrawSetShadow(Test1, 1);
    TextDrawSetSelectable(Test1, 0);

    // Setup local variables
    new vid, trailerid;

    // If the player is the driver of the vehicle (GetPlayerVehicleSeat returns -1 if the player is not in a vehicle)
    if (GetPlayerVehicleSeat(playerid) == 0)
    {
        // Get the vehicle-id
        vid = GetPlayerVehicleID(playerid);
        // Get the trailer-id
        trailerid = GetVehicleTrailer(vid);

        switch (GetVehicleModel(vid))
        {
            case VehicleUtilityVan: // With a Utility Van, you're gonna do "repair speedcamera" job-type
            {
                // Setup local variables
                new Float:x, Float:y, Float:z, CamID;
                // Get a random speedcamera (no previous camera has been fixed yet, so Exception = -1 (invalid camera))
                CamID = GetRandomCamera(-1);
                // Check if there are no speedcamera's
                if (CamID == -1)
                {
                    SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Nгo tem radares na cidade para vocк fazer manutenзгo!");
                    return 1;
                }

                // Job has started
                APlayerData[playerid][JobStarted] = true;
                // Set job-type
                APlayerData[playerid][JobID] = 1; // Job-type: "repair speedcameras"
                // Store the CamID
                APlayerData[playerid][JobLoc1] = CamID;
                // Set the TextDraw so the player can see it
                TextDrawSetString(Trapo[playerid], TXT_RepairSpeedcamera);

                // Grab the x, y, z positions for the checkpoint
                x = ACameras[CamID][CamX];
                y = ACameras[CamID][CamY];
                z = ACameras[CamID][CamZ];
                // Create a racecheckpoint where the player should repair a speedcamera
                SetPlayerRaceCheckpoint(playerid, 1, x, y, z, 0.0, 0.0, 0.0, 2.5);
                // Create a checkpoint to indicate the base
                SetPlayerCheckpoint(playerid, -1870.0, -1710.0, 21.8, 7.0);

                // Store the vehicleID (required to be able to check if the player left his vehicle)
                APlayerData[playerid][VehicleID] = vid;
                APlayerData[playerid][TrailerID] = trailerid;
                // Start a timer that ticks every second to see if the player is still inside his vehicle
                APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission;
                // Inform the player what he must do
                SendClientMessage(playerid, 0xFFFFFFFF, "{a9c4e4}Repare o {ffffff}radar {a9c4e4}indicado no mapa, ou {ffffff}retorne para a base {a9c4e4}para terminar o trabalho.");
            }
            case VehicleTowTruck:
            {
                new Float:x, Float:y, Float:z, RouteText[128];
                APlayerData[playerid][JobStarted] = true;
                APlayerData[playerid][JobID] = 2;
                APlayerData[playerid][JobLoc1] = random(sizeof(ABrokenVehicles));
                APlayerData[playerid][JobStep] = 1;
                format(RouteText, 128, TXT_TowBrokenVehicle, ABrokenVehicles[APlayerData[playerid][JobLoc1]][BrokenName]);
                TextDrawSetString(Trapo[playerid], RouteText);
                x = ABrokenVehicles[APlayerData[playerid][JobLoc1]][BrokenX];
                y = ABrokenVehicles[APlayerData[playerid][JobLoc1]][BrokenY];
                z = ABrokenVehicles[APlayerData[playerid][JobLoc1]][BrokenZ];
                SetPlayerCheckpoint(playerid, x, y, z, 10.0);
                APlayerData[playerid][LoadID] = CreateBrokenVehicle(x, y, z);
                APlayerData[playerid][VehicleID] = vid;
                APlayerData[playerid][VehicleTimerTime] = Job_TimeToFailMission;
                SendClientMessage(playerid, 0xFFFFFFFF, "{a9c4e4}Leve o {ffffff}veнculo quebrado{a9c4e4} para o triturador.");
            }
        }
    }

    return 1;
}
Roadworker_EnterCheckpoint(playerid)
{
    new RouteText[128];
    if (APlayerData[playerid][JobID] == 2)
    {
        if (GetPlayerVehicleID(playerid) == APlayerData[playerid][VehicleID])
        {
            switch (APlayerData[playerid][JobStep])
            {
                case 1:
                {
                    DisablePlayerCheckpoint(playerid);
                    AttachTrailerToVehicle(APlayerData[playerid][LoadID], GetPlayerVehicleID(playerid));
                    format(RouteText, 128, TXT_DeliverBrokenVehicle, ABrokenVehicles[APlayerData[playerid][JobLoc1]][BrokenName]);
                    TextDrawSetString(Trapo[playerid], RouteText);
                    SetPlayerCheckpoint(playerid, -1868.5, -1684.0, 21.8, 10.0);
                    APlayerData[playerid][JobStep] = 2;
                    APlayerData[playerid][VehicleID] = GetPlayerVehicleID(playerid);
                    APlayerData[playerid][TrailerID] = APlayerData[playerid][LoadID];
                    SendClientMessage(playerid, 0xFFFFFFFF, "{228B22}Reboque o {ffffff}veнculo quebrado{228B22} atй o triturador.");
                }
                case 2:
                {
                    AVehicleData[APlayerData[playerid][LoadID]][Owned] = false;
                    DetachTrailerFromVehicle(GetPlayerVehicleID(playerid));
                    DestroyVehicle(APlayerData[playerid][LoadID]);
                    APlayerData[playerid][LoadID] = 0;
                    Roadworker_EndJob(playerid);
                    RewardPlayer(playerid, 3500, 1);
                    SendClientMessage(playerid, 0xFFFFFFFF, "{a9c4e4}Vocк ganhou {00ff00}R${ffffff}3500{a9c4e4} por entregar esse veнculo quebrado no triturador.");
                    SetPVarInt(playerid, "PVarGold", 20);
                    APlayerData[playerid][StatsRoadworkerJobs]++;
                    PlayerFile_Save(playerid);
                }
            }
        }
        else
            SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}Vocк precisa de um Towtruck para continuar.");
    }

    return 1;
}
Roadworker_EnterRaceCheckpoint(playerid)
{
    if (APlayerData[playerid][JobID] == 1)
    {
        if (GetPlayerVehicleSeat(playerid) == -1)
        {
            new newtextxDgh[1000];
            format(newtextxDgh, sizeof(newtextxDgh), "Fazendo Manutencao ao Radar ~n~           ~r~Aguarde ~w~~h~...");
            TextDrawSetString(Test, newtextxDgh);
            TextDrawShowForPlayer(playerid, Test);

            new linhabonita[1000];
            format(linhabonita, sizeof(linhabonita), ".");
            TextDrawSetString(Test1, linhabonita);
            TextDrawShowForPlayer(playerid, Test1);

            TogglePlayerControllable(playerid, 0);
            APlayerData[playerid][LoadingTimer] = SetTimerEx("Roadworker_RepairCamera", 5000, false, "d" , playerid);
        }
        else
            SendClientMessage(playerid, 0xFFFFFFFF, TXT_NeedOnFootToProceed);
    }
    return 1;
}
public Roadworker_RepairCamera(playerid)
{
    // Setup local variables
    new Float:x, Float:y, Float:z, CamID;

    // Pay the player for fixing this camera
    RewardPlayer(playerid, 5000, 1);

    // Also increase the stats
    APlayerData[playerid][StatsRoadworkerJobs]++;
    // Save the player's account
    PlayerFile_Save(playerid);

    // Get a random speedcamera (don't allow the function to choose the same camera that just has been fixed)
    CamID = GetRandomCamera(APlayerData[playerid][JobLoc1]);
    // Store the CamID
    APlayerData[playerid][JobLoc1] = CamID;

    // Set the mission-TextDraw so the player can see it
    TextDrawSetString(Trapo[playerid], TXT_RepairSpeedcamera);

    // First delete the racecheckpoint
    DisablePlayerRaceCheckpoint(playerid);
    // Grab the x, y, z positions for the checkpoint
    x = ACameras[CamID][CamX];
    y = ACameras[CamID][CamY];
    z = ACameras[CamID][CamZ];
    // Create a new racecheckpoint where the player should repair a speedcamera
    SetPlayerRaceCheckpoint(playerid, 1, x, y, z, 0.0, 0.0, 0.0, 2.5);

    // Enable the player's actions (he can move again)
    TogglePlayerControllable(playerid, 1);

    new newtextxDgh[1000];
    format(newtextxDgh, sizeof(newtextxDgh), " ");
    TextDrawSetString(Test, newtextxDgh);
    TextDrawShowForPlayer(playerid, Test);

    new linhabonitaxD[1000];
    format(linhabonitaxD, sizeof(linhabonitaxD), "");
    TextDrawSetString(Test1, linhabonitaxD);
    TextDrawShowForPlayer(playerid, Test1);

    new JOAOMONTEIRO[1000];
    format(JOAOMONTEIRO, sizeof(JOAOMONTEIRO), "{a9c4e4}Vocк ganhou {00ff00}R${ffffff}5000{a9c4e4} por fazer a manutenзгo desse radar.");
    SendClientMessageToAll(-1, JOAOMONTEIRO);
    format(JOAOMONTEIRO, sizeof(JOAOMONTEIRO), "{228B22}Repare o prуximo {ffffff}radar {228B22}indicado no mapa, ou {ffffff}retorne para a base {228B22}para terminar o trabalho.");
    SendClientMessageToAll(-1, JOAOMONTEIRO);
}
GetRandomCamera(Exception)
{
    new CameraList[100], CamCount = -1, CamID;
    for (CamID = 0; CamID < 100; CamID++)
    {
        if (ACameras[CamID][CamSpeed] > 0)
        {
            CamCount++;
            CameraList[CamCount] = CamID;
        }
    }
    if (CamCount == -1)
        return -1;
    CamID = CameraList[random(CamCount + 1)];
    while (CamID == Exception)
        CamID = CameraList[random(CamCount + 1)];
    return CamID;
}
Roadworker_EndJob(playerid)
{
    if (APlayerData[playerid][JobStarted] == true)
    {
        APlayerData[playerid][JobStarted] = false;
        APlayerData[playerid][JobStep] = 0;
        APlayerData[playerid][JobID] = 0;
        APlayerData[playerid][VehicleTimerTime] = 0;
        APlayerData[playerid][VehicleID] = 0;
        APlayerData[playerid][TrailerID] = 0;
        APlayerData[playerid][JobLoc1] = 0;
        APlayerData[playerid][JobLoc2] = 0;
        if (APlayerData[playerid][LoadID] != 0)
        {
            DestroyVehicle(APlayerData[playerid][LoadID]);
            APlayerData[playerid][LoadID] = 0;
        }
        DisablePlayerCheckpoint(playerid);
        DisablePlayerRaceCheckpoint(playerid);
        TextDrawSetString(Trapo[playerid], RoadWorker_NoJobText);
        KillTimer(APlayerData[playerid][LoadingTimer]);
    }
    return 1;
}
CreateBrokenVehicle(Float:x, Float:y, Float:z)
{
    new vid, panels, doors, lights, tires;
    new paramsengine, paramslights, paramsalarm, paramsdoors, paramsbonnet, paramsboot, paramsobjective;
    new BrokenVids[] = {400, 401, 402, 404, 405, 409, 410, 411, 412, 415, 419, 420, 421, 424, 426, 429, 434, 436, 438, 439, 442, 445, 451, 458, 466, 467, 474, 475, 477, 479, 480, 489, 490, 491, 492, 494, 495, 496, 500, 502, 503, 504, 505, 506, 507, 516, 517, 518, 526, 527, 528, 529, 533, 534, 535, 536, 540, 541, 542, 543, 545, 546, 547, 549, 550, 551, 552, 554, 555, 558, 559, 560, 561, 562, 565, 566, 567, 568, 575, 576, 579, 580, 582, 585, 587, 588, 589, 596, 597, 598, 599, 600, 602, 603};
    vid = CreateVehicle(BrokenVids[random(sizeof(BrokenVids))], x, y, z, random(360), random(126), random(126), 3600);
    AVehicleData[vid][Owned] = true;
    GetVehicleParamsEx(vid, paramsengine, paramslights, paramsalarm, paramsdoors, paramsbonnet, paramsboot, paramsobjective);
    SetVehicleParamsEx(vid, paramsengine, paramslights, paramsalarm, true, paramsbonnet, paramsboot, true);
    tires = encode_tires(1, 1, 1, 1);
    panels = encode_panels(3, 3, 3, 3, 3, 3, 3);
    doors = encode_doors(4, 4, 4, 4, 4, 4);
    lights = encode_lights(1, 1, 1, 1);
    UpdateVehicleDamageStatus(vid, panels, doors, lights, tires);
    SetVehicleHealth(vid, 300.0);
    return vid;
}
encode_tires(tire1, tire2, tire3, tire4)
{
    return tire1 | (tire2 << 1) | (tire3 << 2) | (tire4 << 3);
}
encode_panels(flp, frp, rlp, rrp, windshield, front_bumper, rear_bumper)
{
    return flp | (frp << 4) | (rlp << 8) | (rrp << 12) | (windshield << 16) | (front_bumper << 20) | (rear_bumper << 24);
}
encode_doors(bonnet, boot, driver_door, passenger_door, behind_driver_door, behind_passenger_door)
{
    #pragma unused behind_driver_door
    #pragma unused behind_passenger_door
    return bonnet | (boot << 8) | (driver_door << 16) | (passenger_door << 24);
}
encode_lights(light1, light2, light3, light4)
{
    return light1 | (light2 << 1) | (light3 << 2) | (light4 << 3);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)