Код:
stock CreateNewGang(GangTitle[128], GangLeaderName[MAX_PLAYER_NAME], Float: GangBasePos_X, Float: GangBasePos_Y, Float: GangBasePos_Z)
{
for(new i = 1; i < MAX_GANGS_IN_SERVER; i ++)
{
if(GangsSystem[i][gIndeficationID] == 0)
{
GangsSystem[i][gIndeficationID] = i;
strdel(GangsSystem[i][gTitle], 0, 128);
strcat(GangsSystem[i][gTitle], GangTitle, 128);
strdel(GangsSystem[i][gLeaderName], 0, MAX_PLAYER_NAME);
strcat(GangsSystem[i][gLeaderName], GangLeaderName, MAX_PLAYER_NAME);
GangsSystem[i][gBasePos][0] = GangBasePos_X;
GangsSystem[i][gBasePos][1] = GangBasePos_Y;
GangsSystem[i][gBasePos][2] = GangBasePos_Z;
GangsSystem[i][gAllMoney] = 0;
GangsSystem[i][gKills] = 0;
GangsSystem[i][gDeaths] = 0;
GangsSystem[i][gangscore] = 10;
new Query[256];
format(Query, sizeof(Query), "SELECT * FROM `gaujuinfo` WHERE `gIndeficationID` = '%d'", i);
mysql_query(Query);
mysql_store_result();
if(mysql_num_rows())
{
format(Query, sizeof(Query), "UPDATE `gaujuinfo` SET `gTitle` = '%s', `gLeaderName` = '%s', `gAllMoney` = '%d', `gBasePos_X` = '%f', `gBasePos_Y` = '%f', `gBasePos_Z` = '%f', `gKills` = '%d', `gDeaths` = '%d' WHERE `gIndeficationID` = '%d'",
GangsSystem[i][gTitle], GangsSystem[i][gLeaderName], GangsSystem[i][gAllMoney], GangsSystem[i][gBasePos][0], GangsSystem[i][gBasePos][1], GangsSystem[i][gBasePos][2], GangsSystem[i][gKills], GangsSystem[i][gDeaths], i);
mysql_query(Query);
}
else
{
format(Query, sizeof(Query), "INSERT INTO `gaujuinfo` (`gIndeficationID`, `gTitle`, `gLeaderName`, `gAllMoney`, `gBasePos_X`, `gBasePos_Y`, `gBasePos_Z`, `gKills`, `gangscore`, `gDeaths`) VALUES ('%d', '%s', '%s', '%d', '%f', '%f', '%f', '%d', '%d', '%d')",
i, GangsSystem[i][gTitle], GangsSystem[i][gLeaderName], GangsSystem[i][gAllMoney], GangsSystem[i][gBasePos][0], GangsSystem[i][gBasePos][1], GangsSystem[i][gBasePos][2], GangsSystem[i][gKills], GangsSystem[i][gDeaths], GangsSystem[i][gangscore]);
mysql_query(Query);
}
mysql_free_result();
new String[500];
format(String, sizeof(String), "{FFFFFF}Gaujos {00bfff}%s{FFFFFF} bustinė\nGaujos įkurėjas {00bfff}%s{FFFFFF}\nGaujos ID: "COL_PRICE"%d{FFFFFF}\nGaujos XP: {00bfff}%d", GangTitle, GangLeaderName, i, gangscore);
GangsSystem[i][g3DLabel] = CreateDynamic3DTextLabel(String, -1, GangBasePos_X, GangBasePos_Y, GangBasePos_Z, 20.0);
GangsSystem[i][gPickupID] = CreatePickup(1254, 1, GangBasePos_X, GangBasePos_Y, GangBasePos_Z);
return i;
}
}
return 0;
}