Getting Help with Trashmaster Back Coordinate
#1

Hello There !

I would like to get a little help from you guys
I just got stucked somewhere i hope someone from you can help me out

I want the player should stand at the back of the vehicle and then only the system should work currently it works near the door of the vehicle

Here is my code please help me


pawn Код:
if((newkeys & KEY_FIRE) && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
    {
        new Float:cx, Float:cy, Float:cz;
        GetVehiclePos(oldcar[playerid], cx, cy, cz);
        if(IsPlayerInRangeOfPoint(playerid, 3, cx, cy, cz) && GetVehicleModel(oldcar[playerid]) == 408)
        {
            if(PlayerInfo[playerid][pJob] == 25 && HoldingObject[playerid] == 2)
            {

                GivePlayerCash(playerid, 30);
                        new string[256];
                RemovePlayerAttachedObject(playerid, 0);
                HoldingObject[playerid] = 0;
                format(string, sizeof(string), " %s places the trash bag into the garbage truck", GetPlayerNameEx(playerid));
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
Reply
#2

Maybe adjust your
GetVehiclePos(oldcar[playerid], cx, cy, cz);
if(IsPlayerInRangeOfPoint(playerid, 3, cx, cy, cz)
Reply
#3

checking the vehicles angle woud work a bit not sure how
Reply
#4

I already tried brothers,Maybe a example or if you could show me how to do it would help me alot !
Reply
#5

PHP код:
if(IsPlayerInRangeOfPoint(playerid3cxcycz) && GetVehicleModel(oldcar[playerid]) == 408
Increase the 3 to 5.0 - It will work.
Reply
#6

He wants to detect if you're at the BACK of the trashmaster - not anywhere around it!

Put this in 'offset.inc' and include it: http://pastebin.com/XmED67FC

The trashmaster's y offset for the back is -4.5:

pawn Код:
new Float:x, Float:y, Float:z;
GetVehiclePos(vehicleid, x, y, z);
GetOffset(x, y, z, a, 0, -4.5, 0, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 2.0, x, y, z))
{
    // They are at the back of the trashmaster
}
(Un-tested)
Reply
#7

@MP2
In the line
GetOffset(x, y, z, a, 0, -4.5, 0, x, y, z);
a is giving me error i guess its the angle should i use 0 or just remove it ?
Reply
#8

What error..? The angle needs to be the vehicle's angle. I forgot about that. Use this:

pawn Код:
new Float:x, Float:y, Float:z, Float:a;
GetVehiclePos(vehicleid, x, y, z);
[B]GetVehicleZAngle(vehicleid, a);
GetOffset(x, y, z, a, 0, -4.5, 0, x, y, z);
if(IsPlayerInRangeOfPoint(playerid, 2.0, x, y, z))
{
    // They are at the back of the trashmaster
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)