Repair in checkpoint with command -
DownDuckling - 12.01.2015
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)
Re: Repair in checkpoint with command -
Divergent - 12.01.2015
CMD:repair(playerid, params[])
{
if(!IsPlayerInRangeOfPoint(playerid, radius, x, y, z)) return SendClientMessage(playerid, -1, "You can't do that here");
rest of command
}
or you can use checkpoints
new repaircheckpoint[playerid] = 0;
SetPlayerCheckPoint(playerid, x, y, z, size);
repaircheckpoint[playerid] = 1;
public OnPlayerEnterCheckpoint
{
if(repaircheckpoint[playerid] = 1)
{
repaircheckpoint[playerid] = 0;
DisablePlayerCheckpoint(playerid);
rest of repair function
}
}
Re: Repair in checkpoint with command -
DownDuckling - 12.01.2015
I have multiple checkpoints however, how could I just work with them?
Re: Repair in checkpoint with command -
DownDuckling - 12.01.2015
*bump*
Re: Repair in checkpoint with command -
Vince - 12.01.2015
If
all checkpoints are repair checkpoints you might as well just use IsPlayerInCheckpoint. For some reason that functions always seems to be forgotten. Apparently it's much more fun to copy coordinates.
Respuesta: Repair in checkpoint with command -
Zume - 12.01.2015
You can do so:
pawn Код:
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");
}
or so
pawn Код:
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..
}
Of course, there are many ways you can find more.
Re: Respuesta: Repair in checkpoint with command -
DownDuckling - 12.01.2015
Thanks. That was all I needed
Re: Respuesta: Repair in checkpoint with command -
DownDuckling - 12.01.2015
C:\SA-MP Servers\SA-MP Server (Mine)\gamemodes\roleplay.pwn(92) : error 001: expected token: ")", but found "{"
C:\SA-MP Servers\SA-MP Server (Mine)\gamemodes\roleplay.pwn(495) : warning 216: nested comment
C:\SA-MP Servers\SA-MP Server (Mine)\gamemodes\roleplay.pwn(602) : error 029: invalid expression, assumed zero
C:\SA-MP Servers\SA-MP Server (Mine)\gamemodes\roleplay.pwn(603) : warning 209: function "@_yCrepair" should return a value
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Never mind :P Help me fix it?
Re: Repair in checkpoint with command -
Raisingz - 12.01.2015
We need the code to help you, post it first
Re: Repair in checkpoint with command -
DownDuckling - 12.01.2015
CMD:repair(playerid, params[])
{
new id = PlayerIsAnAnyRepairPoint(playerid);
RepairVehicle(GetPlayerVehicleID(playerid));
if(id == -1) return return SendClientMessage(playerid, -1, "You can't do that here");
}