Detecting if player is not near checkpoint [HELP] -
fonia5 - 11.01.2015
Am trying to detect if the player is not near the checkpoint any ideas?
Код:
for (new i = 0; i < MAX_HOUSES; i ++)
{
// If the player is near checkpoint.
if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseData[i][housePos][0], HouseData[i][housePos][1], HouseData[i][housePos][2]))
{
// Setting the checkpoint.
SetPlayerCheckpoint(playerid, HouseData[i][housePos][0], HouseData[i][housePos][1], HouseData[i][housePos][2], 2);
// Removing the red icon on the map.
RemovePlayerMapIcon(playerid, 12);
}
// Else return may not work.
else return DisablePlayerCheckpoint(playerid);
}
And when i delete the house the checkpoint will destroy for a second and come back.
Код:
House_Delete(houseid)
{
if (houseid != -1 && HouseData[houseid][houseExists])
{
new string[64];
format(string, sizeof(string), "DELETE FROM `houses` WHERE `houseID` = '%d'", HouseData[houseid][houseID]);
mysql_function_query(g_iHandle, string, false, "", "");
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]);
DisablePlayerCheckpoint(houseid);
for (new i = 0; i < MAX_BACKPACKS; i ++) if (BackpackData[i][backpackExists] && BackpackData[i][backpackHouse] == HouseData[houseid][houseID]) {
Backpack_Delete(i);
}
House_RemoveFurniture(houseid);
House_RemoveAllItems(houseid);
HouseData[houseid][houseExists] = false;
HouseData[houseid][houseOwner] = 0;
HouseData[houseid][houseID] = 0;
}
return 1;
}
Re: Detecting if player is not near checkpoint [HELP] -
Divergent - 11.01.2015
if(!(IsPlayerInRangeOfPoint(playerid, 2, HouseData[i][housePos][0], HouseData[i][housePos][1], HouseData[i][housePos][2])))
?
Re: Detecting if player is not near checkpoint [HELP] -
fonia5 - 11.01.2015
Quote:
Originally Posted by Divergent
if(!(IsPlayerInRangeOfPoint(playerid, 2, HouseData[i][housePos][0], HouseData[i][housePos][1], HouseData[i][housePos][2])))
?
|
That's if the player is near the created checkpoint but the issue when i enter that rage and move away from the created checkpoint it wont disable that's why i need help detecting the player if he not near it.
Re: Detecting if player is not near checkpoint [HELP] -
rickisme - 11.01.2015
Replace :
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseData[i][housePos][0], HouseData[i][housePos][1], HouseData[i][housePos][2]))
With :
pawn Код:
if(HouseData[houseid][houseExists] && IsPlayerInRangeOfPoint(playerid, 2.0, HouseData[i][housePos][0], HouseData[i][housePos][1], HouseData[i][housePos][2]))
Re: Detecting if player is not near checkpoint [HELP] -
fonia5 - 11.01.2015
Quote:
Originally Posted by rickisme
Replace :
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 2.0, HouseData[i][housePos][0], HouseData[i][housePos][1], HouseData[i][housePos][2]))
With :
pawn Код:
if(HouseData[houseid][houseExists] && IsPlayerInRangeOfPoint(playerid, 2.0, HouseData[i][housePos][0], HouseData[i][housePos][1], HouseData[i][housePos][2]))
|
Give it a try.
Re: Detecting if player is not near checkpoint [HELP] -
fonia5 - 11.01.2015
Still not working
Re: Detecting if player is not near checkpoint [HELP] -
rickisme - 11.01.2015
hmm, just don't understand why you use SetPlayerCheckpoint ?
U wanna create a system like this right ?
https://www.youtube.com/watch?v=36Xq...ature=*********
If yes, using CreateDynamicCP (streamer) instead SetPlayerCheckpoint
Re: Detecting if player is not near checkpoint [HELP] -
fonia5 - 11.01.2015
Yeah bang same as that however, i can't seem to get DynamicCP to work it only set's a red icon on the HUD radar what should i do just convert Setplayercheckpoint to CreateDynamicCP
and i am using streamer plugin
Re: Detecting if player is not near checkpoint [HELP] -
rickisme - 11.01.2015
Just look at streamer function
pawn Код:
native CreateDynamicCP(Float:x, Float:y, Float:z, Float:size, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 100.0);
Example code ( It's will create a CP size 2.0 at house exterior pos when player get closed ( distance 10.0 ) )
pawn Код:
HouseInfo[houseid][hPickupID] = CreateDynamicCP(HouseInfo[houseid][hExterior][0], HouseInfo[houseid][hExterior][1], HouseInfo[houseid][hExterior][2], 2.0, .worldid = HouseInfo[houseid][hExtVW], .interiorid = HouseInfo[houseid][hExtIW], .streamdistance = 10.0);
So if player far away than 10.0, CP will auto hide for player
Re: Detecting if player is not near checkpoint [HELP] -
fonia5 - 11.01.2015
I have did this before it never shows.