23.02.2011, 14:11
pawn Код:
CMD:vcreate(playerid, vehicleid, params[])
{
new
Float:Pos[4],
ivModel,
ivPrice,
ivColors[2],
Query[256],
iMsg[148];
GetVehiclePos(vehicleid, Pos[0], Pos[1], Pos[2]);
GetVehicleZAngle(vehicleid, Pos[3]);
ivModel = GetPlayerVehicleID(playerid);
//if(sscanf(params, "iiii", ivModel, ivPrice, ivColors[0], ivColors[1])) return SendClientMessage(playerid, -1, ""#CRED"Usage: "#CORANGE"/VCreate < Vehicle Model > < Price > < Color 1 > < Color 2 >");
Created++;
vInfo[Created][vModel] = ivModel;
vInfo[Created][vColor1] = 2;
vInfo[Created][vColor2] = 2;
vInfo[Created][vPrice] = 1000;
vInfo[Created][vPosX] = Pos[0];
vInfo[Created][vPosY] = Pos[1];
vInfo[Created][vPosZ] = Pos[2];
vInfo[Created][vPosA] = Pos[3];
strmid(vInfo[Created][vOwner], "Unbought", 0, 20, 20);
strmid(vInfo[Created][vPlate], "ChangeME", 0, 32, 32);
format(Query, sizeof(Query), "INSERT INTO `privateveh` (`vID`, `vModel`, `vColor1`, `vColor2`, `vPrice`, `vOwner`, `vPosX`, `vPosY`, `vPosZ`, `vPosA`, `vPlate`) VALUES (%d, %d, %d, %d, %d, 'Unbought', %f, %f, %f, %f, 'ChangeME')",
Created,
ivModel,
ivColors[0],
ivColors[1],
ivPrice,
Pos[0],
Pos[1],
Pos[2],
Pos[3]);
mysql_query(Query);
new
cCar = CreateVehicle(ivModel, Pos[0], Pos[1], Pos[2], Pos[3], ivColors[0], ivColors[1], 500000);
SetVehicleNumberPlate(cCar, "ChangeME");
ivCreated[cCar] = Created;
SavePrivVeh(Created);
format(iMsg, sizeof(iMsg), ""#CYELLOW"Vehicle: "#CBLUE"%i (VID: %i) "#CYELLOW"has been created. Price: "#CBLUE"$%i "#CYELLOW"Plate: "#CBLUE"ChangeME", ivModel, Created, ivPrice);
SendClientMessage(playerid, -1, iMsg);
return 1;
}