My locks
#1

pawn Код:
if(strcmp(cmd, "/lock", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new mcar = GetPlayerVehicleID(playerid);
            new Float:cx, Float:cy, Float:cz;
            GetVehiclePos(mcar, cx, cy, cz);
            if(IsPlayerInRangeOfPoint(playerid, 4, PlayerInfo[playerid][CarX], PlayerInfo[playerid][CarY], PlayerInfo[playerid][CarZ]))
            {
                if(gVehicleLock[playerid] != 1)
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You don't have a lock for this vehicle !");
                    return 1;
                }
                GetPlayerName(playerid, sendername, sizeof(sendername));
                if(PlayerInfo[playerid][pMask] == 1) format(string, sizeof(string), "* Stranger has locked their vehicle.");
                else format(string, sizeof(string), "* %s has locked their vehicle.", sendername);
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                for(new i = 0; i < MAX_PLAYERS; i++)SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1);
                PlayerInfo[playerid][HouseCarLock] = 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   You are too far away from your vehicle !");
                return 1;
            }
        }
        return 1;
    }
    if(strcmp(cmd, "/unlock", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new mcar = GetPlayerVehicleID(playerid);
            new Float:cx, Float:cy, Float:cz;
            GetVehiclePos(mcar, cx, cy, cz);
            if(IsPlayerInRangeOfPoint(playerid, 4, cx, cy, cz))
            {
                if(gVehicleLock[playerid] != 1)
                {
                    SendClientMessage(playerid, COLOR_GREY, "   You don't have a lock for this vehicle !");
                    return 1;
                }
                if(PlayerInfo[playerid][HouseCarLock] == 1)
                {
                    GetPlayerName(playerid, sendername, sizeof(sendername));
                    PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                    if(PlayerInfo[playerid][pMask] == 1) format(string, sizeof(string), "* Stranger has locked their vehicle.");
                    else format(string, sizeof(string), "* %s has unlocked their vehicle.", sendername);
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    for(new i = 0; i < MAX_PLAYERS; i++)SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 0);
                    PlayerInfo[playerid][HouseCarLock] = 0;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   You are too far away from your vehicle !");
                return 1;
            }
        }
        return 1;
    }
now it doesnt spam or...; but if i do /lock and i am outside the car,if i am inside it it works,and the same for unlock if i am inside the car it unlocks,if i am outside it doesnt work why?
Reply
#2

Does it say "You are too far away from your vehicle" or nothing happens?
Reply
#3

no,when i am near the vehicle it shows: (my name) has Locked their vehicle but it doesnt lock it,if i get inside the car and do /lock it locks the car,and same for unlock
Reply
#4

https://sampforum.blast.hk/showthread.php?tid=480359
Reply
#5

i have used the code he gave me but i have told u the new problem i have...
Reply
#6

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 0)
TO
pawn Код:
new engine, lights, alarm, doors, bonnet, boot, objective;
    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
    SetVehicleParamsEx(vehicleid, engine, lights, true, false, bonnet, boot, objective);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)