06.12.2013, 17:05
my code for locking the car :
and SetVehicleParamsForPlayer doesnt work it doesnt lock the vehicle but i got a public called Lockcar:
how can i use the lockcar to lock it?
i have tried LockCar(carid); it shows error that it's not defined and also i tried vehicleid instead of carid it shows error,what should i write to let it work?
pawn Код:
if(strcmp(cmd, "/lock", true) == 0)
{
if(IsPlayerConnected(playerid))
{
for(new i= 0; i < MAX_PLAYERS; i++)
{
if(i == playerid) continue;
if(PlayerInfo[playerid][PlayerCarModel] == 0 || PlayerInfo[playerid][PlayerCarModel2] == 0)
{
SendClientMessage(playerid, COLOR_GREY," You dont own a vehicle.");
return 1;
}
new Float: x, Float: y, Float: z;
GetVehiclePos(PlayerInfo[playerid][CarLinkID], x, y, z);
if(IsPlayerInRangeOfPoint(playerid, PlayerInfo[playerid][Car2LinkID], x, y, z))
{
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 locked their vehicle.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
PlayerInfo[playerid][LockedCar] = 1;
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1);
}
GetVehiclePos(PlayerInfo[playerid][Car2LinkID], x, y, z);
if(IsPlayerInRangeOfPoint(playerid, PlayerInfo[playerid][Car2LinkID], x, y, z))
{
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 locked their vehicle.", sendername);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
PlayerInfo[playerid][LockedCar2] = 1;
SetVehicleParamsForPlayer(GetPlayerVehicleID(playerid),i, 0, 1);
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You are too far away from your vehicle !");
return 1;
}
}
}
return 1;
}
pawn Код:
forward LockCar(carid);
pawn Код:
public LockCar(carid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
SetVehicleParamsForPlayer(carid,i,0,1);
PlayerInfo[i][LockedCar] = 1;
}
}
}
i have tried LockCar(carid); it shows error that it's not defined and also i tried vehicleid instead of carid it shows error,what should i write to let it work?