PHP код:
CMD:car(playerid, params[])
{
new car[50],color1,color2,message[75], Float:pPos[4],VehicleID;
if(DM[playerid] == 1) return SendClientMessage(playerid, -1,""red"[ ERROR ]: "yellow"You can't use this command while deathmatch!");
if(DUEL[playerid] == 1) return SendClientMessage(playerid, -1,""red"[ ERROR]: "yellow"You can't use this command while duel!");
if(AccInfo[playerid][Cars] != 0) DestroyVehicle(AccInfo[playerid][Cars]);
if(sscanf(params,"s[50]D(6)D(0)",car,color1,color2)) SendClientMessage(playerid, -1, ""red"[ USAGE ]: "yellow"/car [ ID/CARNAME ] [Color 1] [Color 2]");
else{
VehicleID = GetVehicleModelIDFromName(car);
if(VehicleID == -1)
{
VehicleID = strval(car);
if(VehicleID < 400 || VehicleID > 611) return SendClientMessage(playerid, -1, ""red"[ ERROR ]: "yellow"You entered an invalid vehiclename!");
}
new Model = ReturnVehicleID(params);
if(AccInfo[playerid][LesenKereta] == 0)
{
if(Model == INVALID_VEHICLE_ID)
{
if(strlen(params) > 8) params[8] = EOS;
Model = strval(params);
if(!(400 <= Model <= 611))
return SendClientMessage(playerid, -1, ""red"[ ERROR ]: "yellow"You entered an invalid vehiclename!");
GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
GetPlayerFacingAngle(playerid, pPos[3]);
AccInfo[playerid][Cars] = CreateVehicle(Model, pPos[0], pPos[1], pPos[2] + 1, pPos[3], 0, 1, 60);
PutPlayerInVehicle(playerid, AccInfo[playerid][Cars], 0);
format(message, sizeof(message), ""red"[ UFM ]: "yellow"You have spawned %s[%d]!", GetVehicleNames(AccInfo[playerid][Cars]),VehicleID);
SendClientMessage(playerid, -1, message);
}
} else{
GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
GetPlayerFacingAngle(playerid, pPos[3]);
AccInfo[playerid][Cars] = CreateVehicle(Model, pPos[0], pPos[1], pPos[2] + 1, pPos[3], 0, 1, 60);
PutPlayerInVehicle(playerid, AccInfo[playerid][Cars], 0);
format(message, sizeof(message), ""red"[ UFM ]: "yellow"You have spawned %s[%d]!", GetVehicleNames(AccInfo[playerid][Cars]),VehicleID);
SendClientMessage(playerid, -1, message);
}
}
return 1;
}