function:OnPlayerNearProperty()
{
foreach(new i : Player)
{
if(PlayerInfo[i][pLoggedin] == false)
continue;
for(new p = 1; p < MAX_PROPERTY; p++)
{
if(!PropertyInfo[p][ePropertyDBID])
continue;
if(IsPlayerInRangeOfPoint(i, 3.0, PropertyInfo[p][ePropertyEntrance][0], PropertyInfo[p][ePropertyEntrance][1], PropertyInfo[p][ePropertyEntrance][2]))
{
if(GetPlayerInterior(i) != PropertyInfo[p][ePropertyEntranceInterior])
continue;
if(GetPlayerVirtualWorld(i) != PropertyInfo[p][ePropertyEntranceWorld])
continue;
if(!PropertyInfo[p][ePropertyOwnerDBID])
{
SendClientMessage(i, COLOR_DARKGREEN, "This property is for sale. Use /buyproperty.");
SendClientMessageEx(i, COLOR_DARKGREEN, "Price: $%i", PropertyInfo[p][ePropertyMarketPrice]);
}
else
{
SendClientMessageEx(i, COLOR_DARKGREEN, "You're standing on %s's porch. Use /enter to go in.", ReturnDBIDName(PropertyInfo[p][ePropertyOwnerDBID]));
}
}
}
}
return 1;
}
The following thing keeps repeating itself...
It just spams player in range with: This property is for sale OR You're standing on %s's porch. Use /enter to go in. Can anyone tell me how to fix this? [pawn] function:OnPlayerNearProperty() { foreach(new i : Player) { if(PlayerInfo[i][pLoggedin] == false) continue; for(new p = 1; p < MAX_PROPERTY; p++) { if(!PropertyInfo[p][ePropertyDBID]) continue; if(IsPlayerInRangeOfPoint(i, 3.0, PropertyInfo[p][ePropertyEntrance][0], PropertyInfo[p][ePropertyEntrance][1], PropertyInfo[p][ePropertyEntrance][2])) { if(GetPlayerInterior(i) != PropertyInfo[p][ePropertyEntranceInterior]) continue; if(GetPlayerVirtualWorld(i) != PropertyInfo[p][ePropertyEntranceWorld]) continue; if(!PropertyInfo[p][ePropertyOwnerDBID]) { SendClientMessage(i, COLOR_DARKGREEN, "This property is for sale. Use /buyproperty."); SendClientMessageEx(i, COLOR_DARKGREEN, "Price: $%i", PropertyInfo[p][ePropertyMarketPrice]); } else { SendClientMessageEx(i, COLOR_DARKGREEN, "You're standing on %s's porch. Use /enter to go in.", ReturnDBIDName(PropertyInfo[p][ePropertyOwnerDBID])); } } } } return 1; } [/[pawn] |
new PickUpPropertyInfo[MAX_PROPERTY];
PickUpPropertyInfo[propertyid] = CreatePickup(1272, 2, PropertyInfo[propertyid][ePropertyEntrance][0], PropertyInfo[propertyid][ePropertyEntrance][1], PropertyInfo[propertyid][ePropertyEntrance][2]);
//Remember that propertyid you have to change depending on where you add it
public OnPlayerPickUpPickup(playerid, pickupid)
{
for(new i = 1; i < MAX_PROPERTY; i++)
{
if(pickupid == PickUpPropertyInfo[i])
{
//In here you put the code you want me to send
}
}
return 1;
}
Your problem is that you do not have to check if the player is close to x place because when this place near X will send you infinite messages, to solve your problem I suggest you create a Pickup of the property.
I will give you an example, where you have your properties, add I am in the loaded when you create it, that will be the picukp PHP код:
PHP код:
PHP код:
|
PickUpPropertyInfo[1] = CreatePickup(1272, 2, PropertyInfo[1]........