Jump to content

Resource Factions (Paradise RP) Not Working.


donstrachi

Recommended Posts

Maybe there is argument for command?

Post codes to help you

Here is it.

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( "This group is already a faction.", 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( "Created Faction " .. 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( "Faction type must be one of the following:", player, 255, 255, 255 )

outputChatBox( " " .. table.concat( list, ", " ), player, 255, 255, 255 )

end

else

outputChatBox( "Syntax: /" .. commandName .. " [type] [name]", 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...