12.01.2015, 01:20
Hey, I made a bunch of saved positions for repair points but how can I make a checkpoint like thing that I have to be in it and I type /repair in the car to repair? Thanks (I have all of the coords if you need them)
CMD:repair(playerid, params[])
{
if( IsPlayerInRangeOfPoint(playerid, 3.0, 0.0, 0.0, 0.0) ||
IsPlayerInRangeOfPoint(playerid, 3.0, 0.0, 0.0, 0.0) ||
IsPlayerInRangeOfPoint(playerid, 3.0, 0.0, 0.0, 0.0) ||
IsPlayerInRangeOfPoint(playerid, 3.0, 0.0, 0.0, 0.0) ||
IsPlayerInRangeOfPoint(playerid, 3.0, 0.0, 0.0, 0.0
/* continue the pattern to add more */)){
// rest..
}
return return SendClientMessage(playerid, -1, "You can't do that here");
}
stock PlayerIsAnAnyRepairPoint(playerid, Float:range=3.0)
{
if(!IsPlayerConnected(playerid))
return -1;
static Float:RepairPoints[][3] = {
{0.0, 0.0, 0.0},
{0.0, 0.0, 0.0},
{0.0, 0.0, 0.0},
{0.0, 0.0, 0.0},
{0.0, 0.0, 0.0},
{0.0, 0.0, 0.0},
{0.0, 0.0, 0.0},
{0.0, 0.0, 0.0}
// continue the pattern to add more
};
for(new i; i < sizeof(RepairPoints); i++)
{
if(IsPlayerInRangeOfPoint(playerid, range, RepairPoints[i][0], RepairPoints[i][1], RepairPoints[i][2])
{
return i;
}
}
return -1;
}
CMD:repair(playerid, params[])
{
new
id = PlayerIsAnAnyRepairPoint(playerid);
if(id == -1)
return return SendClientMessage(playerid, -1, "You can't do that here");
// rest..
}