01.06.2012, 18:14
I made this command to check if i was near my second car it would say a message.. Where would i put this in the lock command to make it say it if im near the second vehicle if i type /lock
Command
If you help me i will appreciate it
Command
pawn Code:
command(lol, playerid, params[])
{
#pragma unused params
if(Player[playerid][PlayerCarModel2] > 0)
{
if(IsPlayerInRangeOfVehicle(playerid, Player[playerid][Car2LinkID], 10))
{
if(Player[playerid][Car2LinkID] > 0)
{
SendClientMessage(playerid, WHITE, "Yes you are near your vehicle");
}
}
}
}
pawn Code:
command(lock, playerid, params[])
{
#pragma unused params
new engine, lights, alarm, doors, bonnet, boot, objective, string[128];
if(Player[playerid][PlayerCarModel] > 0)
{
if(IsPlayerInRangeOfVehicle(playerid, Player[playerid][CarLinkID], 10))
{
if(Player[playerid][CarLinkID] > 0)
{
if(Player[playerid][LockedCar] == 0)
{
Player[playerid][LockedCar] = 1;
format(string, sizeof(string), "%s has locked their vehicle", GetName(playerid));
NearByMessage(playerid, PURPLE, string);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(i != playerid)
{
GetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, 1, bonnet, boot, 0);
}
}
return 1;
}
else
{
Player[playerid][LockedCar] = 0;
format(string, sizeof(string),"%s has unlocked their vehicle", GetName(playerid));
NearByMessage(playerid, PURPLE, string);
for(new i = 0; i < MAX_PLAYERS; i++)
{
GetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(Player[playerid][CarLinkID], engine, lights, alarm, 0, bonnet, boot, 0);
}
}
}
else
{
SendClientMessage(playerid, WHITE, "You do not own a car");
}
}
else
{
SendClientMessage(playerid, WHITE, "You are not near any of your vehicles");
}
}
return 1;
}