Jump to content

Createfaction


traider

Recommended Posts

Welcome all, I'm problem my MTA Paradise is Polonized, and command createfaction is bad please Help my.

I use /createfaction police police in game, and nothing happens.

This is code command:

addCommandHandler( "createfaction", 
    function( player, commandName, type, ... ) 
        if type and (...) then 
            if factionTypes[ type ] then 
                local name = table.concat( { ... }, " " ) 
                local group = exports.sql:query_assoc_single( "SELECT groupID FROM wcf1_group WHERE groupName = '%s'", name ) 
                if group then 
                    -- we need no duplicates 
                    for key, value in pairs( factions ) do 
                        if value.group == group.groupID then 
                            outputChatBox( "Ta grupa jest już frakcji.", player, 255, 0, 0 ) 
                            return 
                        end 
                    end 
                     
                    -- go ahead 
                    local faction = exports.sql:query_insertid( "INSERT INTO factions (groupID, factionType, factionTag) VALUES (" .. group.groupID .. ", " .. factionTypes[ type ] .. ", '')" ) 
                    if faction then 
                        -- add a default rank 
                        exports.sql:query_free( "INSERT INTO faction_ranks (factionID, factionRankID, factionRankName) VALUES (" .. faction .. ", 1, 'Default Rank')" ) 
                         
                        -- load the faction 
                        loadFaction( faction, name, factionTypes[ type ], nil, group.groupID ) 
                         
                        -- show a message 
                        outputChatBox( "Stworzono Frakcje " .. name .. " (" .. faction .. ").", player, 0, 255, 153 ) 
                    else 
                        outputChatBox( "MySQL-Error.", player, 255, 0, 0 ) 
                    end 
                end 
            else 
                local list = { } 
                for type in pairs( factionTypes ) do 
                    list[ #list + 1 ] = type 
                end 
                outputChatBox( "Typ frakcji musi być jeden z następujących:", player, 255, 255, 255 ) 
                outputChatBox( "  " .. table.concat( list, ", " ), player, 255, 255, 255 ) 
            end 
        else 
            outputChatBox( "Użyj: /" .. commandName .. " [typ] [nazwa]", player, 255, 255, 255 ) 
        end 
    end, 
    true 
) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...