27.05.2012, 16:22
Below I have posted the code for my trunk system, I'm having an issue with the checkpoints.
When I enter the checkpoint, nothing happens at all, so I can't see the SendClientMessage that it shows in the "OnPlayerEnterCheckpoint", or the "OnPlayerLeaveCheckpoint".
Does anybody know what's the problem here?
Thanks!
When I enter the checkpoint, nothing happens at all, so I can't see the SendClientMessage that it shows in the "OnPlayerEnterCheckpoint", or the "OnPlayerLeaveCheckpoint".
Does anybody know what's the problem here?
Thanks!
pawn Code:
command(opentrunk, playerid, params[])
{
new model = GetVehicleModel(GetPlayerVehicleID(playerid)), string[256];
new iVehicleID = GetPlayerVehicleID(playerid);
if(model == 509 || model == 481 || model == 510 || model == 462 || model == 448 || model == 581 || model == 522 || model == 461 || model == 521 || model == 523 || model == 463 || model == 586 || model == 468 || model == 471) return SendClientMessage(playerid, WHITE, "This vehicle doesn't have a trunk.");
else
{
if(AccessingTrunk[playerid] == 0)
{
if(OwnedVeh(iVehicleID) != 0)
{
if(strmatch(vInfo[OwnedVeh(iVehicleID)][vOwner], pName(playerid)))
{
new Float:Pos[5];
GetPlayerPos(playerid, Pos[1], Pos[2], Pos[3]);
TrunkXY(playerid, Pos[1], Pos[2], 3);
format(string, sizeof(string), "* %s pops a button to open the trunk *", RemoveUnderScore(playerid));
CloseMessage(playerid, ACTION, string);
AccessingTrunk[playerid] = 1;
RemovePlayerFromVehicle(playerid);
}
else return SendClientMessage(playerid, YELLOW, "This vehicle isn't yours, therefore you can't use the trunk.");
}
else return SendClientMessage(playerid, WHITE, "This vehicle hasn't got a trunk installed.");
}
else return SendClientMessage(playerid, WHITE, "You are already accessing this vehicle's trunk.");
}
return 1;
}
pawn Code:
stock TrunkXY(playerid, &Float:x2, &Float:y2, Float:distance)
{
new Float:a;
GetPlayerPos(playerid, x2, y2, a);
GetPlayerFacingAngle(playerid, a);
if(GetPlayerVehicleID(playerid))
{
GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
}
x2 += (distance * floatsin(-a+180, degrees));
y2 += (distance * floatcos(-a+180, degrees));
SetPlayerCheckpoint(playerid, x2, y2, a, 1.0);
}
pawn Code:
public OnPlayerEnterCheckpoint(playerid)
{
if(AccessingTrunk[playerid] == 1)
{
new string[128];
format(string, sizeof(string), "To use this vehicle's trunk, use the command '/trunk'.");
SendClientMessage(playerid, WHITE, string);
}
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
if(AccessingTrunk[playerid] == 1)
{
DisablePlayerCheckpoint(playerid);
AccessingTrunk[playerid] = 0;
SendClientMessage(playerid, WHITE, "You can no longer use this vehicle's trunk.");
}
return 1;
}