02.11.2011, 11:39
I need help regarding mySQL structure well, the script is mySQL based and I registered in a free mySQL hosting as I've seen in a thread here in Sa-Mp forums well I just need to know how to put the tables, the data types and stuffs.. since integers in the tables only has a maximum of 255,
heres the code btw,
I just need to know how to set up the table and what kind of data types should I use for each, thanks in adv.
heres the code btw,
pawn Код:
if(strcmp(cmd, "/createveh", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] < 6) return SCM(playerid, COLOR_GREY, "You're not allowed to use this command.");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SCM(playerid, COLOR_WHITE, "Usage: /createveh [vehicle model]");
new model = ReturnVehicleModelID(tmp);
if(!model) return SCM(playerid, COLOR_GREY, "Invalid vehicle model.");
new Float:vPos[4], color[2];
GetPlayerPos(playerid, vPos[0], vPos[1], vPos[2]);
GetPlayerFacingAngle(playerid, vPos[3]);
color[0] = random(126);
color[1] = random(126);
new number, plate[12], platestring[32];
while(number < 100) { number = random(900) + random(99); }
new rand = random(15);
format(plate, sizeof(plate), "%s", GetRandomVehiclePlate(rand));
format(platestring, sizeof(platestring), "%s %d", plate, number);
new vehicle;
CarSys[vehicle] = CreateVehicle(model, vPos[0], vPos[1], vPos[2], vPos[3], color[0], color[1], 3600);
PutPlayerInVehicle(playerid, CarSys[vehicle], 0);
new veh = GetPlayerVehicleID(playerid);
new pstring[64];
format(pstring, sizeof(pstring), "LP: %s", platestring);
CarPlate[veh] = CreateDynamic3DTextLabel(pstring, 0xFFFFFFFF, vPos[0], vPos[1], vPos[2], 20.0, INVALID_PLAYER_ID, veh, 0, -1, -1, -1, 100.0);
ChangeVehicleColor(veh, color[0], color[1]);
new vQuery[1512];
format(vQuery, sizeof(vQuery), "INSERT INTO `vehicles`(`model`, `posx`, `posy`, `posz`, `angle`, `color1`, `color2`, `owner`, `licenseplate`, `vehicleplate`, `paintjob`) VALUES ('%d', '%f', '%f', '%f', '%f', '%d', '%d', 'None', '%d', '%s', '-1')",
model, vPos[0], vPos[1], vPos[2], vPos[3], color[0], color[1], veh, platestring);
mysql_query(vQuery);
LoadVeh(veh);
return 1;
}
return 1;
}