Red Checkpoint with house system.
#1

Am trying to add this red checkpoint but i can't find the id for it am wanting it for my house system so rather then the pickup i wanna use the red checkpoint whenever the player is close to the house.

Код:
House_Refresh(houseid)
{
	if (houseid != -1 && HouseData[houseid][houseExists])
	{
		if (IsValidDynamic3DTextLabel(HouseData[houseid][houseText3D]))
		    DestroyDynamic3DTextLabel(HouseData[houseid][houseText3D]);

		if (IsValidDynamicPickup(HouseData[houseid][housePickup]))
		    DestroyDynamicPickup(HouseData[houseid][housePickup]);

		if (IsValidDynamicMapIcon(HouseData[houseid][houseMapIcon]))
		    DestroyDynamicMapIcon(HouseData[houseid][houseMapIcon]);

		static
		    string[128];

		if (!HouseData[houseid][houseOwner]) {
			format(string, sizeof(string), "[%s]\n%s", FormatNumber(HouseData[houseid][housePrice]), HouseData[houseid][houseAddress]);
            HouseData[houseid][houseText3D] = CreateDynamic3DTextLabel(string, 0x33AA33FF, HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2], 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, HouseData[houseid][houseExteriorVW], HouseData[houseid][houseExterior]);
		}
		else {
			format(string, sizeof(string), "%s", HouseData[houseid][houseAddress]);
			HouseData[houseid][houseText3D] = CreateDynamic3DTextLabel(string, COLOR_WHITE, HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2], 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, HouseData[houseid][houseExteriorVW], HouseData[houseid][houseExterior]);
		}
		    // Pickup ID how can i make the red checkpoint?
        HouseData[houseid][housePickup] = CreateDynamicPickup(1273, 23, HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2], HouseData[houseid][houseExteriorVW], HouseData[houseid][houseExterior]);
        HouseData[houseid][houseMapIcon] = CreateDynamicMapIcon(HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2], (HouseData[houseid][houseOwner] != 0) ? (32) : (31), 0, HouseData[houseid][houseExteriorVW], HouseData[houseid][houseExterior]);
	}
	return 1;
}
What i want.

Reply
#2

You mean this?
wiki.sa-mp.com/wiki/SetPlayerCheckpoint
Reply
#3

Quote:
Originally Posted by Puppy
Посмотреть сообщение
You mean this?
wiki.sa-mp.com/wiki/SetPlayerCheckpoint
Yeah that's the one how can i make it work with the housing system.
Reply
#4

Example:
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, RANGE, HouseData[i][HousePos][0], HouseData[i][HousePos][1], HouseData[i][HousePos][2]))
{
     SetPlayerCheckpoint(playerid, HouseData[i][HousePos][0], HouseData[i][HousePos][1], HouseData[i][HousePos][2]);
     return 1;
}
And then simply use DisablePlayerCheckpoint to remove it.
Reply
#5

okay done that part what about this bit to define whenever if the player is near the house or not.

if (IsValidDynamicPickup(HouseData[houseid][housePickup]))
DestroyDynamicPickup(HouseData[houseid][housePickup]);


Thanks for the help by the way
Reply
#6

It'll be harder to keep track of things such as that. I'd recommend setting a variable such as HouseIconSet or something.

Is there a purpose for not using pickups? This may interfere with other active checkpoints, also, which would be another downside of using checkpoints.
Reply
#7

still don't no what to do with this

if (IsValidDynamicPickup(HouseData[houseid][housePickup]))
Reply
#8

Just put DisablePlayerCheckpoint.
Reply
#9

Testing to see if it work's got a few warnings if you mind helping me fixing it.

not working.
Reply
#10

Still not working however, i have did this and i still not see the checkpoint when near the house exterior. and interior

Код:

House_Nearest(playerid)
{
    for (new i = 0; i != MAX_HOUSES; i ++) if (HouseData[i][houseExists] && IsPlayerInRangeOfPoint(playerid, 2.5, HouseData[i][housePos][0], HouseData[i][housePos][1], HouseData[i][housePos][2]))
	{
		if (GetPlayerInterior(playerid) == HouseData[i][houseExterior] && GetPlayerVirtualWorld(playerid) == HouseData[i][houseExteriorVW])
			return i;
	}
	// Checkpoint
	if(IsPlayerInRangeOfPoint(playerid, HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2]))
	{
		SetPlayerCheckpoint(playerid, HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2]);
		return 1;
	}
	return -1;
}
Код:

House_Refresh(houseid, playerid)
{
	if (houseid != -1 && HouseData[houseid][houseExists])
	{
		if (IsValidDynamic3DTextLabel(HouseData[houseid][houseText3D]))
		    DestroyDynamic3DTextLabel(HouseData[houseid][houseText3D]);

  			// Destroying the checkpoint if player leaves or house gets destroyed
		     DisablePlayerCheckpoint(HouseData[houseid][houseCheckpoint]);

		if (IsValidDynamicMapIcon(HouseData[houseid][houseMapIcon]))
		    DestroyDynamicMapIcon(HouseData[houseid][houseMapIcon]);

		static
		    string[128];

		if (!HouseData[houseid][houseOwner])
		{
			format(string, sizeof(string), "[%s]\n%s", FormatNumber(HouseData[houseid][housePrice]), HouseData[houseid][houseAddress]);
            HouseData[houseid][houseText3D] = CreateDynamic3DTextLabel(string, 0x33AA33FF, HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2], 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, HouseData[houseid][houseExteriorVW], HouseData[houseid][houseExterior]);
		}
		else
		{
			format(string, sizeof(string), "%s", HouseData[houseid][houseAddress]);
			HouseData[houseid][houseText3D] = CreateDynamic3DTextLabel(string, COLOR_WHITE, HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2], 15.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, HouseData[houseid][houseExteriorVW], HouseData[houseid][houseExterior]);
		}
		// Checkpoint
  		if(IsPlayerInRangeOfPoint(playerid, HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2]))
		{
     		SetPlayerCheckpoint(playerid, HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2]);
     		return 1;
		}
        //HouseData[houseid][houseCheckpoint] = CreateDynamicPickup(1273, 23, HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2], HouseData[houseid][houseExteriorVW], HouseData[houseid][houseExterior]);
        HouseData[houseid][houseMapIcon] = CreateDynamicMapIcon(HouseData[houseid][housePos][0], HouseData[houseid][housePos][1], HouseData[houseid][housePos][2], (HouseData[houseid][houseOwner] != 0) ? (32) : (31), 0, HouseData[houseid][houseExteriorVW], HouseData[houseid][houseExterior]);
	}
	return 1;
}
Код:
CMD:createhouse(playerid, params[])
{
	static
	    price,
	    id,
	    address[32];

    if (PlayerData[playerid][pAdmin] < 5)
	    return SendErrorMessage(playerid, "You don't have permission to use this command.");

	if (sscanf(params, "ds[32]", price, address))
	    return SendSyntaxMessage(playerid, "/createhouse [price] [address]");

	for (new i = 0; i != MAX_HOUSES; i ++) if (HouseData[i][houseExists] && !strcmp(HouseData[i][houseAddress], address, true)) {
	    return SendErrorMessage(playerid, "The address \"%s\" is already in use (ID: %d).", address, i);
	}
	id = House_Create(playerid, address, price);

	if (id == -1)
	    return SendErrorMessage(playerid, "The server has reached the limit for houses.");

	SendServerMessage(playerid, "You have successfully created house ID: %d.", id);
	return 1;
}

CMD:destroyhouse(playerid, params[])
{
	static
	    id = 0;

    if (PlayerData[playerid][pAdmin] < 5)
	    return SendErrorMessage(playerid, "You don't have permission to use this command.");

	if (sscanf(params, "d", id))
	    return SendSyntaxMessage(playerid, "/destroyhouse [house id]");

	if ((id < 0 || id >= MAX_HOUSES) || !HouseData[id][houseExists])
	    return SendErrorMessage(playerid, "You have specified an invalid house ID.");

	House_Delete(id);
	SendServerMessage(playerid, "You have successfully destroyed house ID: %d.", id);
	return 1;
}
+REP to whoever fixes me this issue as i have no clue on what i am doing not scripted in a long time.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)