Код:
if(strcmp(cmd,"/cmasina",true)==0)
{
if(EsteManager(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "{FFFFFF}[{F81414}DevilStrike{FFFFFF}]: /cmasina [model] [valoare]");
return 1;
}
new model;
model = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "{FFFFFF}[{F81414}DevilStrike{FFFFFF}]: /cmasina [model] [valoare]");
return 1;
}
new val;
val = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "{FFFFFF}[{F81414}DevilStrike{FFFFFF}]: /cmasina [model] [valoare]");
return 1;
}
if(CreatedCar != 0)
{
SendClientMessage(playerid, COLOR_GRAD1, "Nu poti creea o masina personala inainte de restart (motiv /veh)");
return 1;
}
new Float:cx, Float:cy, Float:cz;
GetPlayerPos(playerid, cx, cy, cz);
new masina = AddStaticVehicleEx(model,cx,cy,cz+1.0,0,0,0,60000);
new string2[256];
new randnumber = 1 + random(98);
format(string2,256,"AF %d NEW",randnumber);
SetVehicleNumberPlate(masina,string2);
strmid(CarInfo[masina-PreVehicle][cNum],string2,0,strlen(string2),999);
CarInfo[masina-PreVehicle][cExploded] = 0;
CarInfo[masina-PreVehicle][cLicense] = 0;
CarInfo[masina-PreVehicle][cLocationx] = cx;
CarInfo[masina-PreVehicle][cLocationy] = cy;
CarInfo[masina-PreVehicle][cLocationz] = cz;
CarInfo[masina-PreVehicle][cValue] = val;
CarInfo[masina-PreVehicle][cModel] = model;
CarInfo[masina-PreVehicle][cOwned] = 0;
CarInfo[masina-PreVehicle][cColorOne] = 0;
CarInfo[masina-PreVehicle][cColorTwo] = 0;
CarInfo[masina-PreVehicle][cAngle] = 1;
CarInfo[masina-PreVehicle][cLockk] = 0;
CarInfo[masina-PreVehicle][cGaraj] = 0;
CarInfo[masina-PreVehicle][cComponent00] = 0;
CarInfo[masina-PreVehicle][cComponent01] = 0;
CarInfo[masina-PreVehicle][cComponent02] = 0;
CarInfo[masina-PreVehicle][cComponent03] = 0;
CarInfo[masina-PreVehicle][cComponent04] = 0;
CarInfo[masina-PreVehicle][cComponent05] = 0;
CarInfo[masina-PreVehicle][cComponent06] = 0;
CarInfo[masina-PreVehicle][cComponent07] = 0;
CarInfo[masina-PreVehicle][cComponent08] = 0;
CarInfo[masina-PreVehicle][cComponent09] = 0;
CarInfo[masina-PreVehicle][cComponent10] = 0;
CarInfo[masina-PreVehicle][cComponent11] = 0;
CarInfo[masina-PreVehicle][cComponent12] = 0;
CarInfo[masina-PreVehicle][cComponent13] = 0;
strmid(CarInfo[masina-PreVehicle][cOwner], "No-One", 0, strlen("No-One"), 999);
PutPlayerInVehicle(playerid,masina,0);
format(CarInfo[masina-PreVehicle][cDescription], 32, "%s",vehName[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
new str[999];
format(str,999,"INSERT INTO `cars` (`id`,`Model`,`Locationx`,`Locationy`,`Locationz`,`Angle`,`ColorOne`,`ColorTwo`,`Owner`,`Description`,`Value`,`License`,`Num`,`Owned`,`Lockk`,`Garaj`,`Component00`,`Component01`,`Component02`,`Component03`,`Component04`,`Component05`,`Component06`,`Component07`,`Component08`,`Component09`,`Component10`,`Component11`,`Component12`,`Component13`,`Exploded`) VALUES (%d,%d,%f,%f,%f,1,0,0,'No-One','%s','%d',0,'%s',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)",
GetPlayerVehicleID(playerid),
model,
cx,
cy,
cz,
vehName[GetVehicleModel(GetPlayerVehicleID(playerid))-400],
val,
string2);
mysql_query(str);
format(string, sizeof(string), "Ai creeat masina %d,model %d si pret $%d.Felicitari",masina,model,val);
SendClientMessage(playerid,COLOR_WHITE,string);
new y,m,d;
new h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 256, "AdmWarning:{FFFFFF}%s a creeat masina %d,model %d,pret $%d.(%d/%d/%d)[%d:%d:%d]", sendername,masina,model,val,y,m,d,h,mi,s);
CarLog(string);
}
else
{
SendClientMessage(playerid,COLOR_LIGHTRED,"{FFFFFF}[{F81414}DevilStrike{FFFFFF}]: Aceasta comanda este restrictionata pe nume!");
return 1;
}
}
Код:
CREATE TABLE IF NOT EXISTS `cars` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`Model` varchar(50) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
`Locationx` varchar(16) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '0',
`Locationy` varchar(16) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '0',
`Locationz` varchar(16) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '0',
`Angle` varchar(16) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '0',
`SaLocationx` varchar(16) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '0',
`SaLocationy` varchar(16) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '0',
`SaLocationz` varchar(16) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '0',
`SaAngle` varchar(16) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '0',
`ColorOne` varchar(50) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
`ColorTwo` varchar(50) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
`Owner` varchar(50) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'Dealership',
`Description` varchar(50) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'No-one',
`Value` varchar(50) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
`License` varchar(50) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
`Owned` varchar(50) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL,
`Lockk` int(11) NOT NULL DEFAULT '0',
`Exploded` varchar(50) DEFAULT NULL,
`Num` varchar(50) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT 'AF-SCHOOL',
`Component00` varchar(16) DEFAULT NULL,
`Component01` varchar(16) DEFAULT NULL,
`Component02` varchar(16) DEFAULT NULL,
`Component03` varchar(16) DEFAULT NULL,
`Component04` varchar(16) DEFAULT NULL,
`Component05` varchar(16) DEFAULT NULL,
`Component06` varchar(16) DEFAULT NULL,
`Component07` varchar(16) DEFAULT NULL,
`Component08` varchar(16) DEFAULT NULL,
`Component09` varchar(16) DEFAULT NULL,
`Component10` varchar(16) DEFAULT NULL,
`Component11` varchar(16) DEFAULT NULL,
`Component12` varchar(16) DEFAULT NULL,
`Component13` varchar(16) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=117 ;