pawn Код:
if(response)
{
new id, rand = random(sizeof(RandomMotoSpawn));
SpawnedMotora++;
id = SpawnedMotora;
switch(listitem)
{
case 0:
{
if(PI[playerid][Novac] < 125000) return SCM(playerid, ERRORCOLOR, "[ERROR]: Nemate dovoljno novca za kupovinu ovog motora.");
strmid(MoInfo[id][Vlasnik], ImeIgraca(playerid), 0, strlen(ImeIgraca(playerid)), 255);
MoInfo[id][Model] = 461;
MoInfo[id][PozX] = RandomMotoSpawn[rand][0];
MoInfo[id][PozY] = RandomMotoSpawn[rand][1];
MoInfo[id][PozZ] = RandomMotoSpawn[rand][2];
MoInfo[id][PozA] = RandomMotoSpawn[rand][3];
MoInfo[id][Boja1] = 1;
MoInfo[id][Boja2] = 1;
MoInfo[id][Zakljucan] = 0;
MoInfo[id][Cena] = 125000;
MoInfo[id][ImaVlasnika] = 1;
MoInfo[id][VW] = 0;
MoInfo[id][Interior] = 0;
NovacMinus(playerid, 125000);
MoInfo[id][mOwned] = CreateVehicle(MoInfo[id][Model], MoInfo[id][PozX], MoInfo[id][PozY], MoInfo[id][PozZ]+0.2, MoInfo[id][PozA], MoInfo[id][Boja1], MoInfo[id][Boja2], 300);
SetVehicleToRespawn(MoInfo[id][mOwned]);
c_SetPlayerCheckpoint(playerid, MoInfo[id][PozX], MoInfo[id][PozY], MoInfo[id][PozZ], 10.0);
SCM(playerid, YELLOW, "Cestitamo kupili ste motor, njegova lokacija je oznacena na mapi !");
GPSOn[playerid] = 1;
PI[playerid][Motor] = id;
}
}
mysql_format(konekt, gQuery, sizeof(gQuery), "INSERT INTO `Motori` (`ID`, `Model`, `PozX`, `PozY`, `PozZ`, `PozA`, `Zakljucan`, `Boja1`, `Boja2`, `Vlasnik`, `Cena`, `ImaVlasnika`) VALUES ('%d', \
'%d', '%f', '%f', '%f', '%f', '0', '1', '1', '%e', '%d', '1')", id, MoInfo[id][Model], MoInfo[id][PozX], MoInfo[id][PozY], MoInfo[id][PozZ], MoInfo[id][PozA], MoInfo[id][Vlasnik], MoInfo[id][Cena]);
mysql_tquery(konekt, gQuery);
SacuvajIgraca(playerid);
pawn Код:
case THREAD_UCITAJMOTORE:
{
if(szRows)
{
new temp[64], id;
for(new i = 0; i < szRows; i++)
{
id = cache_get_field_content_int(i, "ID");
cache_get_field_content(i, "Vlasnik", temp);
format(MoInfo[id][Vlasnik], 50, "%s", temp);
MoInfo[id][PozX] = cache_get_field_content_float(i, "PozX");
MoInfo[id][PozY] = cache_get_field_content_float(i, "PozY");
MoInfo[id][PozZ] = cache_get_field_content_float(i, "PozZ");
MoInfo[id][PozA] = cache_get_field_content_float(i, "PozA");
MoInfo[id][Model] = cache_get_field_content_int(i, "Model");
MoInfo[id][Cena] = cache_get_field_content_int(i, "Cena");
MoInfo[id][VW] = cache_get_field_content_int(i, "VW");
MoInfo[id][Interior] = cache_get_field_content_int(i, "Interior");
MoInfo[id][Zakljucan] = cache_get_field_content_int(i, "Zakljucan");
MoInfo[id][Boja1] = cache_get_field_content_int(i, "Boja1");
MoInfo[id][Boja2] = cache_get_field_content_int(i, "Boja2");
MoInfo[id][ImaVlasnika] = cache_get_field_content_int(i, "ImaVlasnika");
MoInfo[id][mOwned] = CreateVehicle(MoInfo[id][Model], MoInfo[id][PozX], MoInfo[id][PozY], MoInfo[id][PozZ]+0.2, MoInfo[id][PozA], MoInfo[id][Boja1], MoInfo[id][Boja2], 300);
}
}
printf("Loaded vehicles %S", szRows);
SpawnedMotora = szRows;
}