pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new string[256];
new plname[MAX_PLAYER_NAME];
if(newstate == PLAYER_STATE_DRIVER)
{
new veh = GetPlayerVehicleID(playerid);
if(Engine[veh] == 0)
{
TogglePlayerControllable(playerid, 1);
SendClientMessage(playerid, COLOR_GREY, "The engine is off, use /engine or press SHIFT to start it.");
if(VehicleInfo[veh][vRentPrice] > 0)
{
GetPlayerName(playerid, plname, sizeof(plname));
if(strcmp(plname, VehicleInfo[veh][vOwner], true) == 0 || vRented[veh] == playerid)
{
format(string, sizeof(string), "--|Welcome to a %s|--", VehicleNames[GetVehicleModel(veh)-400]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
return 1;
}
else
{
if(vRented[veh] != 255)
{
TogglePlayerControllable(playerid, );
format(string, sizeof(string), "~w~This %s if for rent ~n~Price: ~b~$%d ~n~~w~Owner: ~b~%s ~n~~w~use /rent vehicle to rent it.", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vRentPrice], VehicleInfo[veh][vOwner]);
GameTextForPlayer(playerid, string, 12000, 5);
return 1;
}
}
else
{
if(VehicleInfo[veh][vAlarm] > 0)
{
format(string, sizeof(string), "WARNING: This %s is for %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: the alarm is enabled.");
PlayAlarmSound(veh, VehicleInfo[veh][vAlarm]*10, VehicleInfo[veh][vAlarm]*10000);
return 1;
}
else
{
format(string, sizeof(string), "WARNING: This %s is for %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
return 1;
}
}
}
if(VehicleInfo[veh][vOwned] == 1)
{
GetPlayerName(playerid, plname, sizeof(plname));
if(strcmp(plname, VehicleInfo[veh][vOwner], true) == 0 || vRented[veh] == playerid)
{
format(string, sizeof(string), "--|Welcome back to your %s|--", VehicleNames[GetVehicleModel(veh)-400]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
return 1;
}
else
{
if(VehicleInfo[veh][vAlarm] > 0)
{
format(string, sizeof(string), "Info: This %s belongs to %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
SendClientMessage(playerid, COLOR_LIGHTRED, "Info: The Alarm Is On.");
PlayAlarmSound(veh, VehicleInfo[veh][vAlarm]*10, VehicleInfo[veh][vAlarm]*10000);
return 1;
}
else
{
format(string, sizeof(string), "Info: This %s belongs to %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
return 1;
}
}
}
}
else
{
if(VehicleInfo[veh][vOwned] == 1)
{
GetPlayerName(playerid, plname, sizeof(plname));
if(strcmp(plname, VehicleInfo[veh][vOwner], true) == 0)
{
format(string, sizeof(string), "WARNING: This %s belongs to %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
return 1;
}
else
{
if(VehicleInfo[veh][vAlarm] > 0)
{
format(string, sizeof(string), "WARNING: This %s belongs to %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: the alarm is enabled.");
PlayAlarmSound(veh, VehicleInfo[veh][vAlarm]*10, VehicleInfo[veh][vAlarm]*10000);
return 1;
}
else
{
format(string, sizeof(string), "WARNING: This %s belongs to %s", VehicleNames[GetVehicleModel(veh)-400], VehicleInfo[veh][vOwner]);
SendClientMessage(playerid, COLOR_LIGHTRED, string);
return 1;
}
}
}
}
}
return 1;
}