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?
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
i have used the code he gave me but i have told u the new problem i have...
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);