/lockfcar issue
#1

So when I just ride the car in it's position I can do /lockfcar when its on its position [where I created it], but when I just walk away from the position I wont be able to do /lockfcar it says that Im not near a familycar

Here's the code:
pawn Код:
}
    if(strcmp(cmd, "/lockfcar", true) == 0)
    {
            new sendername2[MAX_PLAYER_NAME+1];
            GetPlayerName(playerid, sendername2,MAX_PLAYER_NAME);
            for(new fv=0;fv<MAX_FAMVEHICLES;fv++)
            {
                if(fVehicleInfo[fv][fvID] != 0 &&IsPlayerInRangeOfPoint(playerid, 5.0, fVehicleInfo[fv][fvX], fVehicleInfo[fv][fvY], fVehicleInfo[fv][fvZ]))
                {
                    if(PlayerInfo[playerid][pFMember] == fVehicleInfo[fv][fvFam])
                    {
                        if(fVehicleInfo[fv][fvLocked] != 0)
                        {
                            fVehicleInfo[fv][fvLocked] = 0;
                            UnLockCar(fVehicleInfo[fv][fvID]);
                            format(string, sizeof(string), "* %s has unlocked the family car.", sendername2);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            return 1;
                        }
                        if(fVehicleInfo[fv][fvLocked] == 0)
                        {
                            fVehicleInfo[fv][fvLocked] = 1;
                            LockCar(fVehicleInfo[fv][fvID]);
                            format(string, sizeof(string), "* %s has locked the family car.", sendername2);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            return 1;
                        }
                    }
                    else
                    {
                        return SendClientMessage(playerid, COLOR_GREY," You're not in the family that owns this car !");
                    }
                }
                else
                {
                    if(fv != MAX_FAMVEHICLES-1)
                    {
                        continue;
                    }
                    else
                    {
                        return SendClientMessage(playerid, COLOR_GREY," You're not near to any family car !");
                    }
                }
            }
            return 1;
    }
Reply
#2

Try:

pawn Код:
if(strcmp(cmd, "/lockfcar", true) == 0)
    {
            new sendername2[MAX_PLAYER_NAME+1];
            GetPlayerName(playerid, sendername2,MAX_PLAYER_NAME);
            for(new fv=0;fv<MAX_FAMVEHICLES;fv++)
            {
                if(fVehicleInfo[fv][fvID] != 0 &&IsPlayerInRangeOfPoint(playerid, 5.0, fVehicleInfo[fv][fvX], fVehicleInfo[fv][fvY], fVehicleInfo[fv][fvZ]))
                {
                    if(PlayerInfo[playerid][pFMember] == fVehicleInfo[fv][fvFam])
                    {
                        if(fVehicleInfo[fv][fvLocked] != 0)
                        {
                            fVehicleInfo[fv][fvLocked] = 0;
                            UnLockCar(fVehicleInfo[fv][fvID]);
                            format(string, sizeof(string), "* %s has unlocked the family car.", sendername2);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            return 1;
                        }
                        if(fVehicleInfo[fv][fvLocked] == 0)
                        {
                            fVehicleInfo[fv][fvLocked] = 1;
                            LockCar(fVehicleInfo[fv][fvID]);
                            format(string, sizeof(string), "* %s has locked the family car.", sendername2);
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                            return 1;
                        }
                    }
                    else
                    {
                        return SendClientMessage(playerid, COLOR_GREY," You're not in the family that owns this car !");
                    }
                }
                else
                {
                    if(fv != MAX_FAMVEHICLES-1)
                    {
                        continue;
                    }
                        return SendClientMessage(playerid, COLOR_GREY," You're not near to any family car !");
                }
            }
            return 1;
Reply
#3

didnt work, any other help?
Reply
#4

also, when I just go to the position that I did /createfcar in it, I can lock and unlock the car even if the car isnt there..
Reply
#5

That is some really ugly scripting, you need to work on your logic and program flow.
Reply
#6

You have to get the car's current position.
Reply
#7

Any help? I mean how do I do that?
Reply
#8

How do I do it?
Reply
#9

Don't double post.
Your codes are little ugly.
Reply
#10

How to fix it? should I re-write it? how?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)