Trunk system.
#8

pawn Code:
stock TrunkXY(playerid, &Float:x2, &Float:y2, Float:distance)
{
    new Float:a;
    GetPlayerPos(playerid, x2, y2, a);
    print("Player positions received");
    GetPlayerFacingAngle(playerid, a);
    print("Player facing angle received");
    if(GetPlayerVehicleID(playerid))
    {
        printf("Vehicle ID checked: %d", GetPlayerVehicleID(playerid));
        GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
    }
    print("Z angle");
    x2 += (distance * floatsin(-a+180, degrees));
    printf("x2 = %f", x2);
    y2 += (distance * floatcos(-a+180, degrees));
    printf("y2 = %f", y2);
   
    SetPlayerCheckpoint(playerid, x2, y2, a, 1.0);
    print("Checkpoint created.");
    AccessingTrunk[playerid] = 1;
    printf("AccessingTrunk = %d", AccessingTrunk[playerid]);
}
So I added that and in the console it printed:

Code:
[20:03:21] Player positions received
[20:03:21] Player facing angle received
[20:03:21] Vehicle ID checked: 1
[20:03:21] Z angle
[20:03:21] x2 = 763.608520
[20:03:21] y2 = 348.890686
[20:03:21] Checkpoint created.
[20:03:21] AccessingTrunk = 1
Under OnPlayerEnterCheckpoint I added this: Also on the LeaveCheckpoint this:

pawn Code:
public OnPlayerEnterCheckpoint(playerid)
{
    print("OnPlayerEnterCheckpoint called");
    if(AccessingTrunk[playerid] == 1)
    {
        print("Trunk accessing is checked.");
        new string[128];
        format(string, sizeof(string), "To use this vehicle's trunk, use the command '/trunk'.");
        SendClientMessage(playerid, WHITE, string);
        print("Message sent.");
    }
    return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    print("OnPlayerLeaveCheckpoint called");
    if(AccessingTrunk[playerid] == 1)
    {
        DisablePlayerCheckpoint(playerid);
        print("DisablePlayerCheckpoint(playerid);");
        AccessingTrunk[playerid] = 0;
        print("AccessingTrunk");
        SendClientMessage(playerid, WHITE, "You can no longer use this vehicle's trunk.");
    }
    return 1;
}
It didn't call.

Edit: Meant to edit the other post, sorry!
Reply


Messages In This Thread
Checkpoint help - by iGetty - 27.05.2012, 16:22
Re: Trunk system. - by vvhy - 27.05.2012, 17:18
Re: Trunk system. - by iGetty - 27.05.2012, 17:40
Re: Trunk system. - by saiberfun - 27.05.2012, 17:48
Re: Trunk system. - by iGetty - 27.05.2012, 18:02
Re: Trunk system. - by ReneG - 27.05.2012, 18:33
Re: Trunk system. - by iGetty - 27.05.2012, 18:41
Re: Trunk system. - by iGetty - 27.05.2012, 18:57
Re: Trunk system. - by ReneG - 27.05.2012, 19:08
Re: Trunk system. - by iGetty - 27.05.2012, 19:13

Forum Jump:


Users browsing this thread: 1 Guest(s)