Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
passenger[playerid] = ispassenger;
if (GetPlayerSurfingVehicleID(playerid) == vehicleid)
{
ClearAnimations(playerid);
}
if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 592 && ispassenger == 1)
{
SetPlayerInterior(playerid,9);
SetPlayerFacingAngle(playerid,0.0);
SetPlayerPos(playerid, 315.856170,1024.496459,1949.797363);
SetCameraBehindPlayer(playerid);
InAndrom[playerid]=vehicleid;
}
if (GetVehicleModel(GetPlayerVehicleID(playerid)) == 519 && ispassenger)
{
if (!ShamalExists(vehicleid))
{
CreateShamalInt(vehicleid, float(randomEx(3000)), float(randomEx(3000)), float(random(100)+800));
}
SetPlayerPosInShamal(playerid, vehicleid);
InShamal[playerid] = vehicleid;
}
#if defined ENABLE_SPEC
for(new xp=0; xp<MAX_PLAYERS; xp++) {
if(GetPlayerState(xp) == PLAYER_STATE_SPECTATING && PlayerInfo[xp][SpecID] == playerid) {
TogglePlayerSpectating(xp, 1);
PlayerSpectateVehicle(xp, vehicleid);
PlayerInfo[xp][SpecType] = ADMIN_SPEC_TYPE_VEHICLE;
}
}
#endif
if(onsys[vehicleid] == 1) {
if(passenger[playerid] == 0) {
if(PlayerInfo[playerid][LoggedIn] == 1) {
if (strcmp(VehicleInfo[vehicleid][owner],PlayerInfo[playerid][name],false) == 0) {
new string[128];
format(string, sizeof(string), "~n~~n~~n~~w~Welcome to your ~g~%s ~r~%s, ~w~please drive carefully!", VehicleInfo[vehicleid][name], PlayerInfo[playerid][name]);
GameTextForPlayer(playerid, string, 5000, 5);
format(string,sizeof(string),"=====================================================================");
SendClientMessage(playerid, COLOR_WHITE, string);
format(string,sizeof(string),"Welcome to your {3CE01B}%s {FA0C24}%s, {ffffff}please drive carefully", VehicleInfo[vehicleid][name], PlayerInfo[playerid][name]);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string,sizeof(string),"=====================================================================");
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
if (strcmp(VehicleInfo[vehicleid][owner],DEFAULT_OWNER,false) == 0) {
if(VehicleInfo[vehicleid][buybar] == 1) {
new string[128];
format(string,sizeof(string),"~n~~n~~n~~r~This %s has been set as non-buyable by server administration!", VehicleInfo[vehicleid][name]);
GameTextForPlayer(playerid, string, 5000, 5);
format(string,sizeof(string),"=====================================================================");
SendClientMessage(playerid, COLOR_WHITE, string);
format(string,sizeof(string),"{FA0C24}This %s has been set as non-buyable by server administration!", VehicleInfo[vehicleid][name]);
SendClientMessage(playerid, COLOR_PINK, string);
format(string,sizeof(string),"=====================================================================");
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
new string[128];
format(string, sizeof(string), "~n~~n~~n~~w~This ~g~%s ~w~is for sale and costs ~g~$%d, ~w~type ~r~/vbuy ~w~to Buy vehicle .",VehicleInfo[vehicleid][name], VehicleInfo[vehicleid][vehiclecost]);
GameTextForPlayer(playerid, string, 5000, 5);
format(string,sizeof(string),"=====================================================================");
SendClientMessage(playerid, COLOR_WHITE, string);
format(string,sizeof(string),"This {3CE01B}%s {ffffff}is for sale and costs {3CE01B}$%d, {ffffff}type {FA0C24}/vbuy {ffffff}to Buy vehicle .", VehicleInfo[vehicleid][name], VehicleInfo[vehicleid][vehiclecost]);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string,sizeof(string),"=====================================================================");
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
else {
new string[128];
format(string, sizeof(string), "~n~~n~~n~~r~This %s belongs to %s, ~r~and cannot be purchased.", VehicleInfo[vehicleid][name], VehicleInfo[vehicleid][owner]);
GameTextForPlayer(playerid, string, 5000, 5);
format(string,sizeof(string),"=====================================================================");
SendClientMessage(playerid, COLOR_WHITE, string);
format(string,sizeof(string),"{FA0C24}This %s belongs to %s, and cannot be purchased.", VehicleInfo[vehicleid][name], VehicleInfo[vehicleid][owner]);
SendClientMessage(playerid, COLOR_PINK, string);
format(string,sizeof(string),"=====================================================================");
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
}
else {
new playername[128];
GetPlayerName(playerid,playername,sizeof(playername));
if (strcmp(VehicleInfo[vehicleid][owner],playername,false) == 0) {
new string[128];
format(string, sizeof(string), "~n~~n~~n~~w~Welcome to your ~g~%s ~r~%s, ~w~please drive carefully! ~n~Remember, you must be logged in to acces vehicle controls.", VehicleInfo[vehicleid][name], playername);
return GameTextForPlayer(playerid, string, 5000, 5);
format(string,sizeof(string),"=====================================================================");
SendClientMessage(playerid, COLOR_WHITE, string);
format(string,sizeof(string),"Welcome to your {3CE01B}%s {FA0C24}%s, {ffffff}please drive carefully !Remember, you must be logged in to acces vehicle controls", VehicleInfo[vehicleid][name], playername);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string,sizeof(string),"=====================================================================");
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
if (strcmp(VehicleInfo[vehicleid][owner],DEFAULT_OWNER,false) == 0) {
if(VehicleInfo[vehicleid][buybar] == 1) {
new string[128];
format(string,sizeof(string),"~n~~n~~n~~r~This %s has been set as non-buyable by server administration!", VehicleInfo[vehicleid][name]);
return GameTextForPlayer(playerid, string, 5000, 5);
format(string,sizeof(string),"=====================================================================");
SendClientMessage(playerid, COLOR_WHITE, string);
format(string,sizeof(string),"{FA0C24}This %s has been set as non-buyable by server administration!", VehicleInfo[vehicleid][name]);
SendClientMessage(playerid, COLOR_RED, string);
format(string,sizeof(string),"=====================================================================");
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
new string[128];
format(string, sizeof(string), "~n~~n~~n~~w~This ~r~%s ~w~is for sale and costs ~g~$%d, ~w~You must be ~r~logged ~w~in to purchase a vehicle.",VehicleInfo[vehicleid][name], VehicleInfo[vehicleid][vehiclecost]);
return GameTextForPlayer(playerid, string, 5000, 5);
format(string,sizeof(string),"=====================================================================");
SendClientMessage(playerid, COLOR_WHITE, string);
format(string,sizeof(string),"This {3CE01B}%s {ffffff}is for sale and costs {3CE01B}$%d, {ffffff}type {FA0C24}/vbuy {ffffff}to Buy vehicle.",VehicleInfo[vehicleid][name], VehicleInfo[vehicleid][vehiclecost]);
SendClientMessage(playerid, COLOR_WHITE, string);
return 1;
}
else {
new string[128];
format(string, sizeof(string), "~n~~n~~n~~r~This %s belongs to %s, and cannot be purchased.", VehicleInfo[vehicleid][name], VehicleInfo[vehicleid][owner]);
return GameTextForPlayer(playerid, string, 5000, 5);
format(string,sizeof(string),"{FA0C24}This %s belongs to %s, and cannot be purchased", VehicleInfo[vehicleid][name], VehicleInfo[vehicleid][owner]);
SendClientMessage(playerid, COLOR_PINK, string);
format(string,sizeof(string),"=====================================================================");
SendClientMessage(playerid, COLOR_WHITE, string);
}
}
}
}
return 1;
}