22.05.2011, 15:02
Can somebody please help me by creating a onplayerstatechange, that only allows the owner to drive the vehicle but anybody can be a passenger, (kick the player from the car if there not the owner and try to drive)
PHP код:
#pragma unused ret_memcpy
//==============================================================================
#include <a_samp>
#include <dini>
//#include <zcmd>
//==============================================================================
//FILEPATHS
#define VEHICLE_PATH "Vehicles/%s.ini"
//COLORS
#define WHITE 0xFFFDFDFF
//==============================================================================
enum car_info
{
Model,
Float:CarX,
Float:CarY,
Float:CarZ,
Float:CarRot,
Locked,
mod1,
mod2,
mod3,
mod4,
mod5,
mod6,
mod7,
mod8,
mod9,
mod10,
mod11,
mod12,
mod13,
mod14,
mod15,
mod16,
mod17,
paintjob,
colora,
colorb
};
new VehicleInfo[MAX_PLAYERS][car_info];
new Vehicle[MAX_PLAYERS];
new Float:X, Float:Y, Float:Z, Float:Rot, pInt;
new OwnerID[MAX_VEHICLES];
new VehOwned[MAX_VEHICLES];
new gVehLocked[MAX_VEHICLES];
new gPlayerHasCar[MAX_PLAYERS];
new bool:Destroyed[MAX_VEHICLES];
stock ini_GetKey(line[])
{
new keyRes[256];
keyRes[0] = 0;
if(strfind(line, "=", true) == -1) return keyRes;
strmid(keyRes, line, 0, strfind(line, "=", true), sizeof(keyRes));
return keyRes;
}
stock ini_GetValue(line[])
{
new valRes[256];
valRes[0] = 0;
if(strfind(line, "=", true) == -1) return valRes;
strmid(valRes, line, strfind(line, "=", true) + 1, strlen(line), sizeof(valRes));
return valRes;
}
new spoiler[20][0] = {
{1000},
{1001},
{1002},
{1003},
{1014},
{1015},
{1016},
{1023},
{1058},
{1060},
{1049},
{1050},
{1138},
{1139},
{1146},
{1147},
{1158},
{1162},
{1163},
{1164}
};
new nitro[3][0] = {
{1008},
{1009},
{1010}
};
new fbumper[23][0] = {
{1117},
{1152},
{1153},
{1155},
{1157},
{1160},
{1165},
{1167},
{1169},
{1170},
{1171},
{1172},
{1173},
{1174},
{1175},
{1179},
{1181},
{1182},
{1185},
{1188},
{1189},
{1192},
{1193}
};
new rbumper[22][0] = {
{1140},
{1141},
{1148},
{1149},
{1150},
{1151},
{1154},
{1156},
{1159},
{1161},
{1166},
{1168},
{1176},
{1177},
{1178},
{1180},
{1183},
{1184},
{1186},
{1187},
{1190},
{1191}
};
new exhaust[28][0] = {
{1018},
{1019},
{1020},
{1021},
{1022},
{1028},
{1029},
{1037},
{1043},
{1044},
{1045},
{1046},
{1059},
{1064},
{1065},
{1066},
{1089},
{1092},
{1104},
{1105},
{1113},
{1114},
{1126},
{1127},
{1129},
{1132},
{1135},
{1136}
};
new bventr[2][0] = {
{1042},
{1044}
};
new bventl[2][0] = {
{1043},
{1045}
};
new bscoop[4][0] = {
{1004},
{1005},
{1011},
{1012}
};
new rscoop[13][0] = {
{1006},
{1032},
{1033},
{1035},
{1038},
{1053},
{1054},
{1055},
{1061},
{1067},
{1068},
{1088},
{1091}
};
new lskirt[21][0] = {
{1007},
{1026},
{1031},
{1036},
{1039},
{1042},
{1047},
{1048},
{1056},
{1057},
{1069},
{1070},
{1090},
{1093},
{1106},
{1108},
{1118},
{1119},
{1133},
{1122},
{1134}
};
new rskirt[21][0] = {
{1017},
{1027},
{1030},
{1040},
{1041},
{1051},
{1052},
{1062},
{1063},
{1071},
{1072},
{1094},
{1095},
{1099},
{1101},
{1102},
{1107},
{1120},
{1121},
{1124},
{1137}
};
new hydraulics[1][0] = {
{1087}
};
new base[1][0] = {
{1086}
};
new rbbars[2][0] = {
{1109},
{1110}
};
new fbbars[2][0] = {
{1115},
{1116}
};
new wheels[17][0] = {
{1025},
{1073},
{1074},
{1075},
{1076},
{1077},
{1078},
{1079},
{1080},
{1081},
{1082},
{1083},
{1084},
{1085},
{1096},
{1097},
{1098}
};
new light[2][0] = {
{1013},
{1024}
};
InitComponents(componentid)
{
new i;
for(i=0; i<20; i++)
{
if(spoiler[i][0]==componentid) { return 1; }
}
for(i=0; i<3; i++)
{
if(nitro[i][0]==componentid) { return 2; }
}
for(i=0; i<23; i++)
{
if(fbumper[i][0]==componentid) { return 3; }
}
for(i=0; i<22; i++)
{
if(rbumper[i][0]==componentid) { return 4; }
}
for(i=0; i<28; i++)
{
if(exhaust[i][0]==componentid) { return 5; }
}
for(i=0; i<2; i++)
{
if(bventr[i][0]==componentid) { return 6; }
}
for(i=0; i<2; i++)
{
if(bventl[i][0]==componentid) { return 7; }
}
for(i=0; i<4; i++)
{
if(bscoop[i][0]==componentid) { return 8; }
}
for(i=0; i<13; i++)
{
if(rscoop[i][0]==componentid) { return 9; }
}
for(i=0; i<21; i++)
{
if(lskirt[i][0]==componentid) { return 10; }
}
for(i=0; i<21; i++)
{
if(rskirt[i][0]==componentid) { return 11; }
}
if(hydraulics[0][0]==componentid) { return 12; }
if(base[0][0]==componentid) { return 13; }
for(i=0; i<2; i++)
{
if(rbbars[i][0]==componentid) { return 14; }
}
for(i=0; i<2; i++)
{
if(fbbars[i][0]==componentid) { return 15; }
}
for(i=0; i<17; i++)
{
if(wheels[i][0]==componentid) { return 16; }
}
for(i=0; i<2; i++)
{
if(light[i][0]==componentid) { return 17; }
}
return 0;
}
stock GetVehicleNameFromID(vehicleid)
{
static const scVehicleNames[][18] = {
"Landstalker",
"Bravura",
"Buffalo",
"Linerunner",
"Perrenial",
"Sentinel",
"Dumper",
"Firetruck",
"Trashmaster",
"Stretch",
"Manana",
"Infernus",
"Voodoo",
"Pony",
"Mule",
"Cheetah",
"Ambulance",
"Leviathan",
"Moonbeam",
"Esperanto",
"Taxi",
"Washington",
"Bobcat",
"Mr Whoopee",
"BF Injection",
"Hunter",
"Premier",
"Enforcer",
"Securicar",
"Banshee",
"Predator",
"Bus",
"Rhino",
"Barracks",
"Hotknife",
"Trailer 1",
"Previon",
"Coach",
"Cabbie",
"Stallion",
"Rumpo",
"RC Bandit",
"Romero",
"Packer",
"Monster",
"Admiral",
"Squalo",
"Seasparrow",
"Pizzaboy",
"Tram",
"Trailer 2",
"Turismo",
"Speeder",
"Reefer",
"Tropic",
"Flatbed",
"Yankee",
"Caddy",
"Solair",
"Berkley's RC Van",
"Skimmer",
"PCJ-600",
"Faggio",
"Freeway",
"RC Baron",
"RC Raider",
"Glendale",
"Oceanic",
"Sanchez",
"Sparrow",
"Patriot",
"Quad",
"Coastguard",
"Dinghy",
"Hermes",
"Sabre",
"Rustler",
"ZR-350",
"Walton",
"Regina",
"Comet",
"BMX",
"Burrito",
"Camper",
"Marquis",
"Baggage",
"Dozer",
"Maverick",
"News Chopper",
"Rancher",
"FBI Rancher",
"Virgo",
"Greenwood",
"Jetmax",
"Hotring",
"Sandking",
"Blista Compact",
"Police Maverick",
"Boxville",
"Benson",
"Mesa",
"RC Goblin",
"Hotring Racer A",
"Hotring Racer B",
"Bloodring Banger",
"Rancher",
"Super GT",
"Elegant",
"Journey",
"Bike",
"Mountain Bike",
"Beagle",
"Cropdust",
"Stunt",
"Tanker",
"Roadtrain",
"Nebula",
"Majestic",
"Buccaneer",
"Shamal",
"Hydra",
"FCR-900",
"NRG-500",
"HPV1000",
"Cement Truck",
"Tow Truck",
"Fortune",
"Cadrona",
"FBI Truck",
"Willard",
"Forklift",
"Tractor",
"Combine",
"Feltzer",
"Remington",
"Slamvan",
"Blade",
"Freight",
"Streak",
"Vortex",
"Vincent",
"Bullet",
"Clover",
"Sadler",
"Firetruck LA",
"Hustler",
"Intruder",
"Primo",
"Cargobob",
"Tampa",
"Sunrise",
"Merit",
"Utility",
"Nevada",
"Yosemite",
"Windsor",
"Monster A",
"Monster B",
"Uranus",
"Jester",
"Sultan",
"Stratum",
"Elegy",
"Raindance",
"RC Tiger",
"Flash",
"Tahoma",
"Savanna",
"Bandito",
"Freight Flat",
"Streak Carriage",
"Kart",
"Mower",
"Duneride",
"Sweeper",
"Broadway",
"Tornado",
"AT-400",
"DFT-30",
"Huntley",
"Stafford",
"BF-400",
"Newsvan",
"Tug",
"Trailer 3",
"Emperor",
"Wayfarer",
"Euros",
"Hotdog",
"Club",
"Freight Carriage",
"Trailer 3",
"Andromada",
"Dodo",
"RC Cam",
"Launch",
"LS Police Car",
"SF Police Car",
"LV Police Car",
"Police Ranger",
"Picador",
"S.W.A.T. Van",
"Alpha",
"Phoenix",
"Glendale",
"Sadler",
"Luggage Trailer A",
"Luggage Trailer B",
"Stair Trailer",
"Boxville",
"Farm Plow",
"Utility Trailer"
},
scOnFoot[18] = "OnFoot";
if (vehicleid > 0) {
return scVehicleNames[GetVehicleModel(vehicleid) - 400];
}
else {
return scOnFoot;
}
}
//==============================================================================
public OnFilterScriptInit()
{
AddStaticPickup(1239,23,613.1563,-495.7778,16.3337); //Dillimore Car Dealer
return 1;
}
//==============================================================================
public OnFilterScriptExit()
{
return 1;
}
//==============================================================================
public OnPlayerConnect(playerid)
{
new file[256], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),VEHICLE_PATH,name);
if(dini_Exists(file))
{
VehicleInfo[playerid][Model] = dini_Int(file, "Model");
VehicleInfo[playerid][CarX] = dini_Float(file, "X");
VehicleInfo[playerid][CarY] = dini_Float(file, "Y");
VehicleInfo[playerid][CarZ] = dini_Float(file, "Z");
VehicleInfo[playerid][CarRot] = dini_Float(file, "Rot");
VehicleInfo[playerid][mod1] = dini_Int(file, "mod1");
VehicleInfo[playerid][mod2] = dini_Int(file, "mod2");
VehicleInfo[playerid][mod3] = dini_Int(file, "mod3");
VehicleInfo[playerid][mod4] = dini_Int(file, "mod4");
VehicleInfo[playerid][mod5] = dini_Int(file, "mod5");
VehicleInfo[playerid][mod6] = dini_Int(file, "mod6");
VehicleInfo[playerid][mod7] = dini_Int(file, "mod7");
VehicleInfo[playerid][mod8] = dini_Int(file, "mod8");
VehicleInfo[playerid][mod9] = dini_Int(file, "mod9");
VehicleInfo[playerid][mod10] = dini_Int(file, "mod10");
VehicleInfo[playerid][mod11] = dini_Int(file, "mod11");
VehicleInfo[playerid][mod12] = dini_Int(file, "mod12");
VehicleInfo[playerid][mod13] = dini_Int(file, "mod13");
VehicleInfo[playerid][mod14] = dini_Int(file, "mod14");
VehicleInfo[playerid][mod15] = dini_Int(file, "mod15");
VehicleInfo[playerid][mod16] = dini_Int(file, "mod16");
VehicleInfo[playerid][mod17] = dini_Int(file, "mod17");
VehicleInfo[playerid][paintjob] = dini_Int(file, "paintjob");
VehicleInfo[playerid][colora] = dini_Int(file, "color1");
VehicleInfo[playerid][colorb] = dini_Int(file, "color2");
Vehicle[playerid] = CreateVehicle(VehicleInfo[playerid][Model], VehicleInfo[playerid][CarX], VehicleInfo[playerid][CarY], VehicleInfo[playerid][CarZ], VehicleInfo[playerid][CarRot], -1, -1, 3600000);
if(VehicleInfo[playerid][mod1]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod1]); }
if(VehicleInfo[playerid][mod2]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod2]); }
if(VehicleInfo[playerid][mod3]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod3]); }
if(VehicleInfo[playerid][mod4]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod4]); }
if(VehicleInfo[playerid][mod5]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod5]); }
if(VehicleInfo[playerid][mod6]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod6]); }
if(VehicleInfo[playerid][mod7]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod7]); }
if(VehicleInfo[playerid][mod8]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod8]); }
if(VehicleInfo[playerid][mod9]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod9]); }
if(VehicleInfo[playerid][mod10]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod10]); }
if(VehicleInfo[playerid][mod11]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod11]); }
if(VehicleInfo[playerid][mod12]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod12]); }
if(VehicleInfo[playerid][mod13]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod13]); }
if(VehicleInfo[playerid][mod14]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod14]); }
if(VehicleInfo[playerid][mod15]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod15]); }
if(VehicleInfo[playerid][mod16]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod16]); }
if(VehicleInfo[playerid][mod17]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod17]); }
if(VehicleInfo[playerid][colora]!=0 || VehicleInfo[playerid][colorb]!=0)
{
ChangeVehicleColor(Vehicle[playerid],VehicleInfo[playerid][colora],VehicleInfo[playerid][colorb]);
}
if(VehicleInfo[playerid][paintjob]!=0)
{
ChangeVehiclePaintjob(Vehicle[playerid],VehicleInfo[playerid][paintjob]);
}
gPlayerHasCar[playerid] = 1;
VehOwned[Vehicle[playerid]] = 1;
OwnerID[Vehicle[playerid]] = playerid;
SetVehicleParamsForPlayer(Vehicle[playerid], playerid, 0, VehicleInfo[playerid][Locked]);
gVehLocked[Vehicle[playerid]] = VehicleInfo[playerid][Locked];
}
return 1;
}
//==============================================================================
public OnPlayerDisconnect(playerid)
{
new file[256], name[24];
GetPlayerName(playerid, name, 24);
format(file,sizeof(file),"Cars/%s.ini",name);
if(dini_Exists(file))
{
dini_IntSet(file, "Model", GetVehicleModel(Vehicle[playerid]));
dini_FloatSet(file, "X", VehicleInfo[playerid][CarX]);
dini_FloatSet(file, "Y", VehicleInfo[playerid][CarY]);
dini_FloatSet(file, "Z", VehicleInfo[playerid][CarZ]);
dini_FloatSet(file, "Rot", VehicleInfo[playerid][CarRot]);
dini_IntSet(file, "Locked", VehicleInfo[playerid][Locked]);
dini_IntSet(file, "mod1", VehicleInfo[playerid][mod1]);
dini_IntSet(file, "mod2", VehicleInfo[playerid][mod2]);
dini_IntSet(file, "mod3", VehicleInfo[playerid][mod3]);
dini_IntSet(file, "mod4", VehicleInfo[playerid][mod4]);
dini_IntSet(file, "mod5", VehicleInfo[playerid][mod5]);
dini_IntSet(file, "mod6", VehicleInfo[playerid][mod6]);
dini_IntSet(file, "mod7", VehicleInfo[playerid][mod7]);
dini_IntSet(file, "mod8", VehicleInfo[playerid][mod8]);
dini_IntSet(file, "mod9", VehicleInfo[playerid][mod9]);
dini_IntSet(file, "mod10", VehicleInfo[playerid][mod10]);
dini_IntSet(file, "mod11", VehicleInfo[playerid][mod11]);
dini_IntSet(file, "mod12", VehicleInfo[playerid][mod12]);
dini_IntSet(file, "mod13", VehicleInfo[playerid][mod13]);
dini_IntSet(file, "mod14", VehicleInfo[playerid][mod14]);
dini_IntSet(file, "mod15", VehicleInfo[playerid][mod15]);
dini_IntSet(file, "mod16", VehicleInfo[playerid][mod16]);
dini_IntSet(file, "mod17", VehicleInfo[playerid][mod17]);
dini_IntSet(file, "paintjob", VehicleInfo[playerid][paintjob]);
dini_IntSet(file, "color1", VehicleInfo[playerid][colora]);
dini_IntSet(file, "color2", VehicleInfo[playerid][colorb]);
DestroyVehicle(Vehicle[playerid]);
}
return 1;
}
//==============================================================================
public OnPlayerPickUpPickup(playerid, pickupid)
{
new file[256], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),VEHICLE_PATH,name);
if(dini_Exists(file))
{
ShowPlayerDialog( playerid, 1921, DIALOG_STYLE_MSGBOX, "English Roleplay - Vehicle System", "You Already Have A Vehicle", "Ok", "");
return 1;
}
ShowPlayerDialog( playerid, 1921, DIALOG_STYLE_LIST, "English Roleplay - Vehicle System", "Clover - $10,000\nElegy - $320,000", "Buy", "Cancel");
return 1;
}
//==============================================================================
//==============================================================================
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/park", true) == 0)
{
if(!IsPlayerInVehicle(playerid, Vehicle[playerid]))
{
SendClientMessage(playerid, 0xFFFFFFAA, "You are not in a car that you own.");
return 1;
}
new file[256], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),VEHICLE_PATH,name);
SendClientMessage(playerid, 0xFFFF00FF, "Car parked successfully, it'll respawn at your parked location.");
GetVehiclePos(Vehicle[playerid], X, Y, Z);
GetVehicleZAngle(Vehicle[playerid], Rot);
dini_IntSet(file, "Model", GetVehicleModel(Vehicle[playerid]));
dini_FloatSet(file, "X", X);
dini_FloatSet(file, "Y", Y);
dini_FloatSet(file, "Z", Z);
dini_FloatSet(file, "Rot", Rot);
dini_IntSet(file, "mod1", VehicleInfo[playerid][mod1]);
dini_IntSet(file, "mod2", VehicleInfo[playerid][mod2]);
dini_IntSet(file, "mod3", VehicleInfo[playerid][mod3]);
dini_IntSet(file, "mod4", VehicleInfo[playerid][mod4]);
dini_IntSet(file, "mod5", VehicleInfo[playerid][mod5]);
dini_IntSet(file, "mod6", VehicleInfo[playerid][mod6]);
dini_IntSet(file, "mod7", VehicleInfo[playerid][mod7]);
dini_IntSet(file, "mod8", VehicleInfo[playerid][mod8]);
dini_IntSet(file, "mod9", VehicleInfo[playerid][mod9]);
dini_IntSet(file, "mod10", VehicleInfo[playerid][mod10]);
dini_IntSet(file, "mod11", VehicleInfo[playerid][mod11]);
dini_IntSet(file, "mod12", VehicleInfo[playerid][mod12]);
dini_IntSet(file, "mod13", VehicleInfo[playerid][mod13]);
dini_IntSet(file, "mod14", VehicleInfo[playerid][mod14]);
dini_IntSet(file, "mod15", VehicleInfo[playerid][mod15]);
dini_IntSet(file, "mod16", VehicleInfo[playerid][mod16]);
dini_IntSet(file, "mod17", VehicleInfo[playerid][mod17]);
dini_IntSet(file, "paintjob", VehicleInfo[playerid][paintjob]);
dini_IntSet(file, "color1", VehicleInfo[playerid][colora]);
dini_IntSet(file, "color2", VehicleInfo[playerid][colorb]);
return 1;
}
if(strcmp(cmd, "/lock", true) == 0)
{
if(gPlayerHasCar[playerid] == 1)
{
new v, Float:vehx, Float:vehy, Float:vehz;
v = Vehicle[playerid];
GetVehiclePos(v, vehx, vehy, vehz);
if(IsPlayerInRangeOfPoint(playerid, 3.0, vehx, vehy, vehz))
{
if(VehicleInfo[playerid][Locked] == 0)
{
SetVehicleParamsForPlayer(v, playerid, 0, 1);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid, "~r~Car locked!", 3000, 6);
VehicleInfo[playerid][Locked] = 1;
gVehLocked[v] = 1;
return 1;
}
if(VehicleInfo[playerid][Locked] == 1)
{
SetVehicleParamsForPlayer(v, playerid, 0, 0);
PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
GameTextForPlayer(playerid, "~g~Car unlocked!", 3000, 6);
VehicleInfo[playerid][Locked] = 0;
gVehLocked[v] = 0;
return 1;
}
}
else
{
SendClientMessage(playerid, 0xAFAFAFAA, "You are too far away from your vehicle.");
return 1;
}
}
else
{
SendClientMessage(playerid, 0xAFAFAFAA, "You don't own a vehicle.");
}
return 1;
}
return 1;
}
//==============================================================================
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1921 )
{
if(response)
{
if(listitem == 0)
{
if(GetPlayerMoney(playerid) < 10000)
return SendClientMessage(playerid,WHITE,"You Don't Have Enough Money To Buy A Clover");
GivePlayerMoney(playerid,-10000);
GameTextForPlayer(playerid, " ~g~ Getting Car From Showroom", 5000,5);
Vehicle[playerid] = CreateVehicle(542, 624.8318, -493.9242, 16.3359, 355.9533, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
new file[256], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),VEHICLE_PATH,name);
dini_Create(file);
dini_IntSet(file, "Model", GetVehicleModel(Vehicle[playerid]));
dini_FloatSet(file, "X", 624.8318);
dini_FloatSet(file, "Y", -493.9242);
dini_FloatSet(file, "Z", 16.3359);
dini_FloatSet(file, "Rot", 355.9533);
dini_IntSet(file, "mod1", VehicleInfo[playerid][mod1]);
dini_IntSet(file, "mod2", VehicleInfo[playerid][mod2]);
dini_IntSet(file, "mod3", VehicleInfo[playerid][mod3]);
dini_IntSet(file, "mod4", VehicleInfo[playerid][mod4]);
dini_IntSet(file, "mod5", VehicleInfo[playerid][mod5]);
dini_IntSet(file, "mod6", VehicleInfo[playerid][mod6]);
dini_IntSet(file, "mod7", VehicleInfo[playerid][mod7]);
dini_IntSet(file, "mod8", VehicleInfo[playerid][mod8]);
dini_IntSet(file, "mod9", VehicleInfo[playerid][mod9]);
dini_IntSet(file, "mod10", VehicleInfo[playerid][mod10]);
dini_IntSet(file, "mod11", VehicleInfo[playerid][mod11]);
dini_IntSet(file, "mod12", VehicleInfo[playerid][mod12]);
dini_IntSet(file, "mod13", VehicleInfo[playerid][mod13]);
dini_IntSet(file, "mod14", VehicleInfo[playerid][mod14]);
dini_IntSet(file, "mod15", VehicleInfo[playerid][mod15]);
dini_IntSet(file, "mod16", VehicleInfo[playerid][mod16]);
dini_IntSet(file, "mod17", VehicleInfo[playerid][mod17]);
dini_IntSet(file, "paintjob", VehicleInfo[playerid][paintjob]);
dini_IntSet(file, "color1", VehicleInfo[playerid][colora]);
dini_IntSet(file, "color2", VehicleInfo[playerid][colorb]);
SendClientMessage(playerid,WHITE,"Congratulations You Have Bought A Clover");
if(VehicleInfo[playerid][mod1]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod1]); }
if(VehicleInfo[playerid][mod2]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod2]); }
if(VehicleInfo[playerid][mod3]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod3]); }
if(VehicleInfo[playerid][mod4]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod4]); }
if(VehicleInfo[playerid][mod5]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod5]); }
if(VehicleInfo[playerid][mod6]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod6]); }
if(VehicleInfo[playerid][mod7]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod7]); }
if(VehicleInfo[playerid][mod8]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod8]); }
if(VehicleInfo[playerid][mod9]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod9]); }
if(VehicleInfo[playerid][mod10]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod10]); }
if(VehicleInfo[playerid][mod11]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod11]); }
if(VehicleInfo[playerid][mod12]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod12]); }
if(VehicleInfo[playerid][mod13]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod13]); }
if(VehicleInfo[playerid][mod14]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod14]); }
if(VehicleInfo[playerid][mod15]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod15]); }
if(VehicleInfo[playerid][mod16]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod16]); }
if(VehicleInfo[playerid][mod17]!=0) { AddVehicleComponent(Vehicle[playerid],VehicleInfo[playerid][mod17]); }
if(VehicleInfo[playerid][colora]!=0 || VehicleInfo[playerid][colorb]!=0)
{
ChangeVehicleColor(Vehicle[playerid],VehicleInfo[playerid][colora],VehicleInfo[playerid][colorb]);
}
if(VehicleInfo[playerid][paintjob]!=0)
{
ChangeVehiclePaintjob(Vehicle[playerid],VehicleInfo[playerid][paintjob]);
}
SetVehicleParamsForPlayer(Vehicle[playerid], playerid, 0, VehicleInfo[playerid][Locked]);
gVehLocked[Vehicle[playerid]] = VehicleInfo[playerid][Locked];
return 1;
}
if(listitem == 1)
{
if(GetPlayerMoney(playerid) < 320000)
return SendClientMessage(playerid,WHITE,"You Don't Have Enough Money To Buy A Elegy");
GivePlayerMoney(playerid,-320000);
GameTextForPlayer(playerid, " ~g~ Getting Car From Showroom", 5000,5);
SetTimer("Tick", 30000, true);
Vehicle[playerid] = CreateVehicle(562, 624.8318, -493.9242, 16.3359, 355.9533, random(100), random(100), -1); LinkVehicleToInterior(GetPlayerVehicleID(playerid), pInt);
new file[256], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file,sizeof(file),VEHICLE_PATH,name);
dini_Create(file);
dini_IntSet(file, "Model", GetVehicleModel(Vehicle[playerid]));
dini_FloatSet(file, "X", 624.8318);
dini_FloatSet(file, "Y", -493.9242);
dini_FloatSet(file, "Z", 16.3359);
dini_FloatSet(file, "Rot", 355.9533);
dini_IntSet(file, "mod1", VehicleInfo[playerid][mod1]);
dini_IntSet(file, "mod2", VehicleInfo[playerid][mod2]);
dini_IntSet(file, "mod3", VehicleInfo[playerid][mod3]);
dini_IntSet(file, "mod4", VehicleInfo[playerid][mod4]);
dini_IntSet(file, "mod5", VehicleInfo[playerid][mod5]);
dini_IntSet(file, "mod6", VehicleInfo[playerid][mod6]);
dini_IntSet(file, "mod7", VehicleInfo[playerid][mod7]);
dini_IntSet(file, "mod8", VehicleInfo[playerid][mod8]);
dini_IntSet(file, "mod9", VehicleInfo[playerid][mod9]);
dini_IntSet(file, "mod10", VehicleInfo[playerid][mod10]);
dini_IntSet(file, "mod11", VehicleInfo[playerid][mod11]);
dini_IntSet(file, "mod12", VehicleInfo[playerid][mod12]);
dini_IntSet(file, "mod13", VehicleInfo[playerid][mod13]);
dini_IntSet(file, "mod14", VehicleInfo[playerid][mod14]);
dini_IntSet(file, "mod15", VehicleInfo[playerid][mod15]);
dini_IntSet(file, "mod16", VehicleInfo[playerid][mod16]);
dini_IntSet(file, "mod17", VehicleInfo[playerid][mod17]);
dini_IntSet(file, "paintjob", VehicleInfo[playerid][paintjob]);
dini_IntSet(file, "color1", VehicleInfo[playerid][colora]);
dini_IntSet(file, "color2", VehicleInfo[playerid][colorb]);
SendClientMessage(playerid,WHITE,"Congratulations You Have Bought A Elegy");
}
}
}
return 1;
}
//==============================================================================
public OnVehicleMod(playerid,vehicleid,componentid)
{
new mods = InitComponents(componentid);
if(IsPlayerInVehicle(playerid, Vehicle[playerid]))
{
switch(mods)
{
case 1: { VehicleInfo[playerid][mod1] = componentid; }
case 2: { VehicleInfo[playerid][mod2] = componentid; }
case 3: { VehicleInfo[playerid][mod3] = componentid; }
case 4: { VehicleInfo[playerid][mod4] = componentid; }
case 5: { VehicleInfo[playerid][mod5] = componentid; }
case 6: { VehicleInfo[playerid][mod6] = componentid; }
case 7: { VehicleInfo[playerid][mod7] = componentid; }
case 8: { VehicleInfo[playerid][mod8] = componentid; }
case 9: { VehicleInfo[playerid][mod9] = componentid; }
case 10: { VehicleInfo[playerid][mod10] = componentid; }
case 11: { VehicleInfo[playerid][mod11] = componentid; }
case 12: { VehicleInfo[playerid][mod12] = componentid; }
case 13: { VehicleInfo[playerid][mod13] = componentid; }
case 14: { VehicleInfo[playerid][mod14] = componentid; }
case 15: { VehicleInfo[playerid][mod15] = componentid; }
case 16: { VehicleInfo[playerid][mod16] = componentid; }
case 17: { VehicleInfo[playerid][mod17] = componentid; }
}
}
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
if(IsPlayerInVehicle(playerid, Vehicle[playerid]))
{
if(GetVehicleModel(Vehicle[playerid]) == 483)
{
switch(paintjobid)
{
case 0: VehicleInfo[playerid][paintjob] = 0;
}
}
if(GetVehicleModel(Vehicle[playerid]) == 534)
{
switch(paintjobid)
{
case 0: VehicleInfo[playerid][paintjob] = 0;
case 1: VehicleInfo[playerid][paintjob] = 1;
case 2: VehicleInfo[playerid][paintjob] = 2;
}
}
if(GetVehicleModel(Vehicle[playerid]) == 535)
{
switch(paintjobid)
{
case 0: VehicleInfo[playerid][paintjob] = 0;
case 1: VehicleInfo[playerid][paintjob] = 1;
case 2: VehicleInfo[playerid][paintjob] = 2;
}
}
if(GetVehicleModel(Vehicle[playerid]) == 536)
{
switch(paintjobid)
{
case 0: VehicleInfo[playerid][paintjob] = 0;
case 1: VehicleInfo[playerid][paintjob] = 1;
case 2: VehicleInfo[playerid][paintjob] = 2;
}
}
if(GetVehicleModel(Vehicle[playerid]) == 558)
{
switch(paintjobid)
{
case 0: VehicleInfo[playerid][paintjob] = 0;
case 1: VehicleInfo[playerid][paintjob] = 1;
case 2: VehicleInfo[playerid][paintjob] = 2;
}
}
if(GetVehicleModel(Vehicle[playerid]) == 559)
{
switch(paintjobid)
{
case 0: VehicleInfo[playerid][paintjob] = 0;
case 1: VehicleInfo[playerid][paintjob] = 1;
case 2: VehicleInfo[playerid][paintjob] = 2;
}
}
if(GetVehicleModel(Vehicle[playerid]) == 560)
{
switch(paintjobid)
{
case 0: VehicleInfo[playerid][paintjob] = 0;
case 1: VehicleInfo[playerid][paintjob] = 1;
case 2: VehicleInfo[playerid][paintjob] = 2;
}
}
if(GetVehicleModel(Vehicle[playerid]) == 561)
{
switch(paintjobid)
{
case 0: VehicleInfo[playerid][paintjob] = 0;
case 1: VehicleInfo[playerid][paintjob] = 1;
case 2: VehicleInfo[playerid][paintjob] = 2;
}
}
if(GetVehicleModel(Vehicle[playerid]) == 562)
{
switch(paintjobid)
{
case 0: VehicleInfo[playerid][paintjob] = 0;
case 1: VehicleInfo[playerid][paintjob] = 1;
case 2: VehicleInfo[playerid][paintjob] = 2;
}
}
if(GetVehicleModel(Vehicle[playerid]) == 565)
{
switch(paintjobid)
{
case 0: VehicleInfo[playerid][paintjob] = 0;
case 1: VehicleInfo[playerid][paintjob] = 1;
case 2: VehicleInfo[playerid][paintjob] = 2;
}
}
if(GetVehicleModel(Vehicle[playerid]) == 567)
{
switch(paintjobid)
{
case 0: VehicleInfo[playerid][paintjob] = 0;
case 1: VehicleInfo[playerid][paintjob] = 1;
case 2: VehicleInfo[playerid][paintjob] = 2;
}
}
if(GetVehicleModel(Vehicle[playerid]) == 575)
{
switch(paintjobid)
{
case 0: VehicleInfo[playerid][paintjob] = 0;
case 1: VehicleInfo[playerid][paintjob] = 1;
}
}
if(GetVehicleModel(Vehicle[playerid]) == 576)
{
switch(paintjobid)
{
case 0: VehicleInfo[playerid][paintjob] = 0;
case 1: VehicleInfo[playerid][paintjob] = 1;
case 2: VehicleInfo[playerid][paintjob] = 2;
}
}
}
return 1;
}
public OnVehicleRespray(playerid,vehicleid, color1, color2)
{
if(IsPlayerInVehicle(playerid, Vehicle[playerid]))
{
VehicleInfo[playerid][colora] = color1;
VehicleInfo[playerid][colorb] = color2;
}
return 1;
}
//==============================================================================
stock IsACar(vehicleid)
{
switch(GetVehicleModel(vehicleid))
{
case 400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,
418,419,420,421,422,423,424,426,427,428,429,431,432,433,434,435,436,437,438,
439,440,442,443,444,445,451,455,456,458,459,466,467,470,474,475,477,478,479,
480,482,483,486,489,490,491,492,494,495,496,498,499,500,502,503,504,505,506,
507,508,514,515,516,517,518,524,525,526,527,528,529,533,534,535,536,540,541,
542,543,544,545,546,547,549,550,551,552,554,555,556,557,558,559,560,561,562,
565,566,567,568,573,575,576,578,579,580,582,585,587,588, 589,596,597,598,599,
600,601,602,603,604,605,609: return 1;
}
return 1;
}
//==============================================================================