donstrachi Posted February 17, 2016 Share Posted February 17, 2016 Greetings, I´m working on my roleplay server, using the Paradise Rp base. For some reason Im not able to create factions.(/createfaction and /setfaction arent working) When I try to type the commands, they just doesn´t work. (No error message) Link to comment
bebo1king Posted February 17, 2016 Share Posted February 17, 2016 Maybe there is argument for command? Post codes to help you Link to comment
donstrachi Posted February 17, 2016 Author Share Posted February 17, 2016 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now