Код:
dcmd_car(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
if(strlen(params) > 24) return SendClientMessage(playerid, COLOR_RED, "CHYBA: /car [IDauta] [Barva1] [Barva 2]");
new pos,string[1024];
if(adminlvl[playerid] < 2) SendClientMessage(playerid, COLOR_RED, "Nedostatečnэ administrбtorskэ level!");
else if(!params[0]||!(pos=chrfind(' ',params)+1)||!(pos=chrfind(' ',params)+2)||!params[pos])
{
SendClientMessage(playerid, COLOR_RED, "CHYBA: /car [IDauta] [Barva1] [Barva 2]");
}
else if(ServerCFG[Car] == 10) SendClientMessage(playerid, COLOR_RED, "[10/10] Vozidlo nebylo vytvořeno, nejdřнve znič předchozн /destroy");
else
{
new car = strval(params[0]);
if(car < 400 || car > 611) return SendClientMessage(playerid, COLOR_RED, "Rozmezн aut je 400 - 611");
new color1 = strval(params[pos]);
new color2 = strval(params[pos+1]);
if(color1 > 126 || color1 < 0 || color2 > 126 || color2 < 0) return SendClientMessage(playerid, COLOR_YELLOW, "Rozmezн barev je 0 - 126");
if(ServerCFG[Car] < 10)
{
new Float:Uhel,Float:X,Float:Y,Float:Z;
GetPlayerFacingAngle(playerid,Uhel);
GetPlayerPos(playerid, X,Y,Z);
new link = GetPlayerInterior(playerid);
InfrontOf(playerid, X, Y, 4.0);
Ecar[ServerCFG[Car]] = CreateVehicle(car, X,Y,Z, Uhel+90, color1, color2, 600000);
if(link > 0) LinkVehicleToInterior(Ecar[ServerCFG[Car]],link);
format(string, sizeof(string), "[%d/10] Vozidlo bylo ъspěљně spawnuto, pro zničenн napiљ /destroy", ServerCFG[Car]+1);
SendClientMessage(playerid, COLOR_BLUE, string);
ServerCFG[Car]++;
}
}
}
return 1;
}