Help about mysql function
#3

When player uses /makefaction [name][type]

PHP код:
stock CreateFaction(fname[], Float:PlayerPosXFloat:PlayerPosYFloat:PlayerPosZftype)
{
    
DB::CreateRow(FactionTable"FactionName"fname);
 
    new 
yearmonthday;
 
    
getdate(yearmonthday);
 
    new 
fcID GetAvailableFactionID();
 
    
FactionInfo[fcID][dbID] = ReturnLastKey();
    
FactionInfo[fcID][fID] = fcID;
 
    
FactionInfo[fcID][fType] = ftype;
    
FactionInfo[fcID][fX] = PlayerPosX;
    
FactionInfo[fcID][fY] = PlayerPosY;
    
FactionInfo[fcID][fZ] = PlayerPosZ;
 
    new 
cdate[30];
    
format(cdatesizeof cdate"%02d/%02d/%d"daymonthyear);
 
    
DB::SetLastIntEntry(FactionTable"fType"ftype"Reference");
    
DB::SetLastFloatEntry(FactionTable"LockerX"PlayerPosX"Reference");
    
DB::SetLastFloatEntry(FactionTable"LockerY"PlayerPosY"Reference");
    
DB::SetLastFloatEntry(FactionTable"LockerZ"PlayerPosZ"Reference");
    
DB::SetLastStringEntry(FactionTable"CreationDate"cdate"Reference");
 
    
LoadFactions();
 
    
#if defined DEBUG_MODE
        
printf("[FACTION CREATION] %s has been created today (%s). [IG ID: %d | SQL ID: %d]"fnamecdatefcIDFactionInfo[fcID][dbID]);
    
#endif
    
return 1;

GetAvailableFactionID(); from stock above

PHP код:
stock GetAvailableFactionID()
{
    new 
id;
    for(new 
iMAX_FACTIONSi++)
    {
        if(
FactionInfo[i][dbID] == 0)
        {
            
id i;
            break;
        }
    }
    return 
id;

and returnlastkey

PHP код:
stock ReturnLastKey()
{
    return 
DB::GetRowsPoolSize(FactionTable);

I need this to be converted to BlueG's Mysql plugin 40+
Reply


Messages In This Thread
Help about mysql function - by masuzaron - 22.04.2018, 10:46
Re: Help about mysql function - by TitoRayne - 22.04.2018, 10:50
Re: Help about mysql function - by masuzaron - 22.04.2018, 10:56
Re: Help about mysql function - by jasperschellekens - 22.04.2018, 11:57
Re: Help about mysql function - by masuzaron - 22.04.2018, 14:02

Forum Jump:


Users browsing this thread: 1 Guest(s)