SA-MP Forums Archive
Gang System MYSQL into SQL - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Gang System MYSQL into SQL (/showthread.php?tid=328857)



Gang System MYSQL into SQL - Please Help!!! - nGen.SoNNy - 26.03.2012

Hi guys! Please help me to transform this gang system from MySQL into SQL! I just made the database on "OnGameModeInit" but i have some functions from MySQL and i don't know how to replace with SQL...Please help me! I attach the gamemode into this post


One example: PlayerInfo[playerid][Gang] = mysql_insert_id();
pawn Code:
command(creategang, playerid,  params[])
{
    new string[128], gName[100], Query[200];
    if(PlayerInfo[playerid][Gang] != 0) return SendClientMessage(playerid, COLOR_YELLOW, "You are already an member of an gang, please quit that gang before creating a new one.");
    if(sscanf(params, "s[100]", gName)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /creategang [ Gang-name ].");
    if(CheckGangByName(gName)) return SendClientMessage(playerid, COLOR_YELLOW, "An gang with this name already exists.");
    format(Query, sizeof(Query), "INSERT INTO gangs (id, name, owner) VALUES (NULL, '%s', '%s');", gName, PlayerName(playerid));
    format(string, sizeof(string), "You created an gang with name : %s, you were sat as owner of the gang.", gName);
    SendClientMessage(playerid, COLOR_GREEN, string);
    db_query( Database, Query );
    PlayerInfo[playerid][Gang] = mysql_insert_id();
    format(Query, sizeof(Query), "UPDATE users SET gang = %d WHERE username = '%s';", PlayerInfo[playerid][Gang], PlayerName(playerid));
    db_query( Database, Query );
    return 1;
}