02.01.2011, 22:15
pawn Код:
command(engine, playerid, params[])
{
new engine,lights,alarm,doors,bonnet,boot,objective;
new vehicle, seat;
vehicle = GetPlayerVehicleID(playerid);
seat = GetPlayerVehicleSeat(playerid);
GetVehicleParamsEx(vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
if(seat == 0) {
if(engine == 0) {
if(GetPlayerVehicleID(playerid) == Player[playerid][CarLinkID] || GetPlayerVehicleID(playerid) == Player[playerid][Car2LinkID] || GetPlayerVehicleID(playerid) == Player[playerid][Car3LinkID])
{
SetVehicleParamsEx(vehicle,1,lights,alarm,doors,bonnet,boot,objective);
} else {
SendClientMessage(playerid, WHITE, "You don't have the keys to this vehicle.");
}
}
if(engine == 1) {
if(GetPlayerVehicleID(playerid) == Player[playerid][CarLinkID] || GetPlayerVehicleID(playerid) == Player[playerid][Car2LinkID] || GetPlayerVehicleID(playerid) == Player[playerid][Car3LinkID])
{
SetVehicleParamsEx(vehicle,0,lights,alarm,doors,bonnet,boot,objective);
} else {
SendClientMessage(playerid, WHITE, "You don't have the keys to this vehicle.");
}
}
} else {
SendClientMessage(playerid, WHITE, "You must be in the driver's seat to start the engine.");
}
return 1;
}
pawn Код:
command(lock, playerid, params[])
{
new engine,lights,alarm,doors,bonnet,boot,objective;
new vehslot;
if(sscanf(params, "d", vehslot))
{
SendClientMessage(playerid, WHITE, "SYNTAX: /lock [1-3]");
}
else
{
switch(vehslot)
{
case 1:
{
if(Player[playerid][PlayerCarModel] > 0)
{
if(IsPlayerInRangeOfVehicle(playerid, Player[playerid][CarLinkID], 10))
{
if(Player[playerid][CarLinkID] > 0)
{
GetVehicleParamsEx(Player[playerid][CarLinkID],engine,lights,alarm,doors,bonnet,boot,objective);
if(doors == 0)
{
SendClientMessage(playerid, WHITE, "You have locked your vehicle.");
SetVehicleParamsEx(Player[playerid][CarLinkID],engine,lights,alarm,1,bonnet,boot,objective);
return 1;
}
else
{
SetVehicleParamsEx(Player[playerid][CarLinkID],engine,lights,alarm,0,bonnet,boot,objective);
SendClientMessage(playerid, WHITE, "You have un-locked your vehicle.");
return 1;
}
}
}
else
{
SendClientMessage(playerid, WHITE, "You're too far away.");
}
}
}
case 2:
{
if(Player[playerid][PlayerCarModel2] > 0)
{
if(IsPlayerInRangeOfVehicle(playerid, Player[playerid][Car2LinkID], 10))
{
if(Player[playerid][Car2LinkID] > 0)
{
GetVehicleParamsEx(Player[playerid][Car2LinkID],engine,lights,alarm,doors,bonnet,boot,objective);
if(doors == 0)
{
SendClientMessage(playerid, WHITE, "You have locked your vehicle.");
SetVehicleParamsEx(Player[playerid][Car2LinkID],engine,lights,alarm,1,bonnet,boot,objective);
return 1;
}
else
{
SetVehicleParamsEx(Player[playerid][Car2LinkID],engine,lights,alarm,0,bonnet,boot,objective);
SendClientMessage(playerid, WHITE, "You have un-locked your vehicle.");
return 1;
}
}
}
else
{
SendClientMessage(playerid, WHITE, "You're too far away.");
}
}
}
case 3:
{
if(Player[playerid][PlayerCarModel3] > 0)
{
if(IsPlayerInRangeOfVehicle(playerid, Player[playerid][Car3LinkID], 10))
{
if(Player[playerid][Car3LinkID] > 0)
{
GetVehicleParamsEx(Player[playerid][Car3LinkID],engine,lights,alarm,doors,bonnet,boot,objective);
if(doors == 0)
{
SendClientMessage(playerid, WHITE, "You have locked your vehicle.");
SetVehicleParamsEx(Player[playerid][Car3LinkID],engine,lights,alarm,1,bonnet,boot,objective);
return 1;
}
else
{
SetVehicleParamsEx(Player[playerid][Car3LinkID],engine,lights,alarm,0,bonnet,boot,objective);
SendClientMessage(playerid, WHITE, "You have un-locked your vehicle.");
return 1;
}
}
}
else
{
SendClientMessage(playerid, WHITE, "You're too far away.");
}
}
}
}
}
return 1;
}
But, I type /engine outside of the car and it says "You must be in the driver's seat to start the engine.", so I get in and type it and nothing happens. Help please?