PHP код:
#include <a_samp>
#include <zcmd>
new VehicleName[212][0] = {
"Landstalker",
"Bravura",
"Buffalo",
"Linerunner",
"Pereniel",
"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", //artict1
"Previon",
"Coach",
"Cabbie",
"Stallion",
"Rumpo",
"RC Bandit",
"Romero",
"Packer",
"Monster Truck",
"Admiral",
"Squalo",
"Seasparrow",
"Pizzaboy",
"Tram",
"Trailer", //artict2
"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", //hotrina
"Hotring Racer", //hotrinb
"Bloodring Banger",
"Rancher",
"Super GT",
"Elegant",
"Journey",
"Bike",
"Mountain Bike",
"Beagle",
"Cropdust",
"Stunt",
"Tanker", //petro
"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", //firela
"Hustler",
"Intruder",
"Primo",
"Cargobob",
"Tampa",
"Sunrise",
"Merit",
"Utility",
"Nevada",
"Yosemite",
"Windsor",
"Monster Truck", //monstera
"Monster Truck", //monsterb
"Uranus",
"Jester",
"Sultan",
"Stratum",
"Elegy",
"Raindance",
"RC Tiger",
"Flash",
"Tahoma",
"Savanna",
"Bandito",
"Freight", //freiflat
"Trailer", //streakc
"Kart",
"Mower",
"Duneride",
"Sweeper",
"Broadway",
"Tornado",
"AT-400",
"DFT-30",
"Huntley",
"Stafford",
"BF-400",
"Newsvan",
"Tug",
"Trailer", //petrotr
"Emperor",
"Wayfarer",
"Euros",
"Hotdog",
"Club",
"Trailer", //freibox
"Trailer", //artict3
"Andromada",
"Dodo",
"RC Cam",
"Launch",
"Police Car (LSPD)",
"Police Car (SFPD)",
"Police Car (LVPD)",
"Police Ranger",
"Picador",
"S.W.A.T. Van",
"Alpha",
"Phoenix",
"Glendale",
"Sadler",
"Luggage Trailer", //bagboxa
"Luggage Trailer", //bagboxb
"Stair Trailer", //tugstair
"Boxville",
"Farm Plow", //farmtr1
"Utility Trailer" //utiltr1
};
enum vInfo
{
modding,
model,
Float:x_spawn,
Float:y_spawn,
Float:z_spawn,
Float:za_spawn,
Float:ox_spawn,
Float:oy_spawn,
Float:oz_spawn,
Float:oza_spawn,
color_1,
color_2,
owner[128],
vehiclecost,
bought,
secure,
asecure,
vused,
buybar,
name[128],
mod1,
mod2,
mod3,
mod4,
mod5,
mod6,
mod7,
mod8,
mod9,
mod10,
mod11,
mod12,
mod13,
mod14,
mod15,
mod16,
mod17,
paintjob,
Temp,
};
new VehicleInfo[MAX_VEHICLES][vInfo];
CMD:car(playerid,params[]) {
new tmp[128], tmp2[128], tmp3[128], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index); tmp3 = strtok(params,Index);
if(isnull(tmp)) return SendClientMessage(playerid, -1, "USAGE: /car [Modelid/Name] [colour1] [colour2]");
new car, colour1, colour2, string[128];
if(!IsNumeric(tmp)) car = GetVehicleModelIDFromName(tmp); else car = strval(tmp);
if(car < 400 || car > 611) return SendClientMessage(playerid, -1, "ERROR: Invalid Vehicle Model");
if(isnull(tmp2)) colour1 = random(126); else colour1 = strval(tmp2);
if(isnull(tmp3)) colour2 = random(126); else colour2 = strval(tmp3);
new LVehicleID,Float:X,Float:Y,Float:Z, Float:Angle,int1; GetPlayerPos(playerid, X,Y,Z); GetPlayerFacingAngle(playerid,Angle); int1 = GetPlayerInterior(playerid);
LVehicleID = CreateVehicle(car, X+3,Y,Z, Angle, colour1, colour2, -1); LinkVehicleToInterior(LVehicleID,int1);
format(string, sizeof(string), "You have spawned a \"%s\" (Model:%d) colour (%d, %d)", VehicleName[car-400], car, colour1, colour2);
PutPlayerInVehicle(playerid, LVehicleID, 0);
VehicleInfo[LVehicleID][Temp] = 1;
return SendClientMessage(playerid,-1, string);
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(VehicleInfo[vehicleid][Temp] == 1) SetTimerEx("DestroyVehicle1", 5000,0,"i",vehicleid);
return 1;
}
forward DestroyVehicle1(vehicleid);
public DestroyVehicle1(vehicleid)
{
if(VehicleInfo[vehicleid][Temp] == 1) {
DestroyVehicle(vehicleid);
VehicleInfo[vehicleid][Temp] = 0;
}
return 1;
}
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
stock IsNumeric(string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}
stock pName(playerid)
{
new plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
return plname;
}
GetVehicleModelIDFromName(vname[])
{
for(new i = 0; i < 211; i++)
{
if ( strfind(VehicleName[i], vname, true) != -1 )
return i + 400;
}
return -1;
}