24.02.2019, 19:40
(
Последний раз редактировалось JasonRiggs; 24.02.2019 в 21:18.
)
Why are you using y_iterate already??
Why not just simply..
i believe that would do enough, no need for the y_iterate.
Why not just simply..
PHP код:
CMD:creategarage(playerid, params[])
{
if(Player[playerid][AdminLevel] < 5) return 0;
new price, size;
if(sscanf(params, "dd(0)", price, size))
{
SCM(playerid, COLOR_BELGREEN, "» [USAGE]: /creategarage [price] [size(default 0)]");
return SCM(playerid, COLOR_BELGREEN, "» Size: 0 - Small Garage , 1 - Medium Garage, 2 - Big Garage.");
}
if((size < 0) || (size > 2)) return SCM(playerid, COLOR_ERROR, "» Size must be from 0 to 2.");
if((price < 1) || (price > 999999)) return SCM(playerid, COLOR_ERROR, "» Invalid price.");
for(new i = 1; i < MAX_GARAGES; i++)
{
if(!GarageInfo[i][garageExists])
{
GarageInfo[i][garageID] = i;
new query[300];
mysql_format(g_SQL, query, sizeof query, "INSERT INTO `garages` (`garagePrice`, `garageSize`) VALUES ('%d', '%d')", price, size);
mysql_tquery(g_SQL, query, "OnGarageCreated", "d", i);
GarageInfo[i][garageExists] = true;
GetPlayerPos(playerid, GarageInfo[i][garagePos][0], GarageInfo[i][garagePos][1], GarageInfo[i][garagePos][2]);
GetPlayerFacingAngle(playerid, GarageInfo[i][garagePos][3]);
GarageInfo[i][garagePos][0] = GarageInfo[i][garagePos][0] + (1.5 * floatsin(-GarageInfo[i][garagePos][3], degrees));
GarageInfo[i][garagePos][1] = GarageInfo[i][garagePos][1] + (1.5 * floatcos(-GarageInfo[i][garagePos][3], degrees));
GarageInfo[i][garageVW] = GetPlayerVirtualWorld(playerid);
GarageInfo[i][garagePrice] = price;
GarageInfo[i][garageSize] = size;
RefreshGarage(i);
SCMEX(playerid, COLOR_YELLOW, "» You have successfully created a garage. ID: %d - Price: %s - Size: %d", i, formatInt(price), size);
printf("Garage is saved for i: %d", i);
if(i == -1) return SCM(playerid, COLOR_ERROR, "» The server has reached the limit for garages.");
return 1;
}
}
}
PHP код:
function OnQueryFinished(extraid, threadid)
{
switch(threadid)
{
case THREAD_CREATE_GARAGE:
{
GarageInfo[extraid][garageID] = extraid;
SaveGarage(extraid);
}
}
return 1;
}