micheal1230 Posted June 23, 2012 Posted June 23, 2012 well here is my script And acl, There are no errors -- server function makeadmin(thePlayer, commandName, targetPlayer) if ( hasObjectPermissionTo ( thePlayer, "command.makeadmin", true ) ) then local targetPlayerAcc = getPlayerAccount(targetPlayer) local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick(thePlayer, targetPlayer) if not ( targetPlayer ) then outputChatBox("SYNTAX: "..commandName" [PlayerName]", thePlayer) else if ( targetPlayerAcc ) then aclGroupAddObject (aclGetGroup("Admin"), "user."..targetPlayerAcc) end end end end addCommandHandler("makeadmin", makeadmin) <acl name="Owner"> <right name="command.makeadmin" access="true"></right> <right name="general.ModifyOtherObjects" access="true"></right> <right name="general.http" access="true"></right> <right name="command.shutdown" access="true"></right> <right name="command.install" access="true"></right> <right name="command.aexec" access="true"></right> <right name="command.debugscript" access="true"></right> <right name="command.refresh" access="true"></right> <right name="function.executeCommandHandler" access="true"></right> <right name="function.setServerPassword" access="true"></right> <right name="function.getServerPassword" access="true"></right> <right name="function.createResource" access="true"></right> <right name="function.copyResource" access="true"></right> <right name="function.addResourceMap" access="true"></right> <right name="function.addResourceConfig" access="true"></right> <right name="function.removeResourceFile" access="true"></right> <right name="function.setResourceDefaultSetting" access="true"></right> <right name="function.removeResourceDefaultSetting" access="true"></right> <right name="function.aclReload" access="true"></right> <right name="function.aclSave" access="true"></right> <right name="function.aclCreate" access="true"></right> <right name="function.aclDestroy" access="true"></right> <right name="function.aclSetRight" access="true"></right> <right name="function.aclRemoveRight" access="true"></right> <right name="function.aclCreateGroup" access="true"></right> <right name="function.aclDestroyGroup" access="true"></right> <right name="function.aclGroupAddACL" access="true"></right> <right name="function.aclGroupRemoveACL" access="true"></right> <right name="function.aclGroupAddObject" access="true"></right> <right name="function.aclGroupRemoveObject" access="true"></right> <right name="general.adminpanel" access="true"></right> <right name="general.tab_players" access="true"></right> <right name="general.tab_resources" access="true"></right> <right name="general.tab_server" access="true"></right> <right name="general.tab_maps" access="true"></right> <right name="general.tab_bans" access="true"></right> <right name="general.tab_adminchat" access="true"></right> <right name="command.kick" access="true"></right> <right name="command.freeze" access="true"></right> <right name="command.mute" access="true"></right> <right name="command.setnick" access="true"></right> <right name="command.shout" access="true"></right> <right name="command.spectate" access="true"></right> <right name="command.slap" access="true"></right> <right name="command.setgroup" access="true"></right> <right name="command.sethealth" access="true"></right> <right name="command.setarmour" access="true"></right> <right name="command.setmoney" access="true"></right> <right name="command.setskin" access="true"></right> <right name="command.setteam" access="true"></right> <right name="command.giveweapon" access="true"></right> <right name="command.setstat" access="true"></right> <right name="command.jetpack" access="true"></right> <right name="command.warp" access="true"></right> <right name="command.setdimension" access="true"></right> <right name="command.setinterior" access="true"></right> <right name="command.createteam" access="true"></right> <right name="command.destroyteam" access="true"></right> <right name="command.givevehicle" access="true"></right> <right name="command.repair" access="true"></right> <right name="command.blowvehicle" access="true"></right> <right name="command.destroyvehicle" access="true"></right> <right name="command.customize" access="true"></right> <right name="command.setcolor" access="true"></right> <right name="command.setpaintjob" access="true"></right> <right name="command.listmessages" access="true"></right> <right name="command.readmessage" access="true"></right> <right name="command.listresources" access="true"></right> <right name="command.start" access="true"></right> <right name="command.stop" access="true"></right> <right name="command.stopall" access="false"></right> <right name="command.restart" access="true"></right> <right name="command.execute" access="true"></right> <right name="command.setpassword" access="true"></right> <right name="command.setwelcome" access="true"></right> <right name="command.setgame" access="true"></right> <right name="command.setmap" access="true"></right> <right name="command.setweather" access="true"></right> <right name="command.blendweather" access="true"></right> <right name="command.setblurlevel" access="true"></right> <right name="command.setwaveheight" access="true"></right> <right name="command.setskygradient" access="true"></right> <right name="command.setgamespeed" access="true"></right> <right name="command.setgravity" access="true"></right> <right name="command.settime" access="true"></right> <right name="function.setServerConfigSetting" access="true"></right> <right name="function.updateResourceACLRequest" access="true"></right> <right name="command.aclrequest" access="true"></right> <right name="command.ban" access="true"></right> <right name="command.unban" access="true"></right> <right name="command.banip" access="true"></right> <right name="command.unbanip" access="true"></right> <right name="command.banserial" access="true"></right> <right name="command.unbanserial" access="true"></right> <right name="command.listbans" access="true"></right> <right name="function.makeadmin" access="true"></right> </acl>
Guest Guest4401 Posted June 23, 2012 Posted June 23, 2012 In line 5: targetPlayer is not a player element. It's still a string or nil which depends. In line 8: You forgot ".." after "commandName" In line 11: You are adding account element, not string. use getAccountName
micheal1230 Posted June 23, 2012 Author Posted June 23, 2012 In line 5: targetPlayer is not a player element. It's still a string or nil which depends.In line 8: You forgot ".." after "commandName" In line 11: You are adding account element, not string. use getAccountName How can i make target player a element And all that stuff above is not really useful because i cant even execute the command and debugscript doesnt show any errors
Guest Guest4401 Posted June 23, 2012 Posted June 23, 2012 In line 5: targetPlayer is not a player element. It's still a string or nil which depends.In line 8: You forgot ".." after "commandName" In line 11: You are adding account element, not string. use getAccountName How can i make target player a element And all that stuff above is not really useful because i cant even execute the command and debugscript doesnt show any errors You need better explanation? function makeadmin(thePlayer, commandName, targetPlayer) --targetPlayer is initially NOT a player element. end addCommandHandler("makeadmin", makeadmin) If you type /makeadmin targetPlayer will be nil. If you type /makeadmin blabla targetPlayer will be a string. It will be blabla For more detailed information on how commands work: https://wiki.multitheftauto.com/wiki/addCommandHandler To get player element, you use that getPlayerFromNamePart function. What it does is checks if a player has "blabla" in his nickname or not. Then it returns the player element. So you should first use this function for that and get the player element.` https://wiki.multitheftauto.com/wiki/getPlayerAccount : First argument required is a PLAYER ELEMENT. If you don't know what player element means: https://wiki.multitheftauto.com/wiki/Player https://wiki.multitheftauto.com/wiki/Element
Castillo Posted June 23, 2012 Posted June 23, 2012 -- server function makeadmin ( thePlayer, commandName, targetPlayer ) if ( hasObjectPermissionTo ( thePlayer, "command.makeadmin", true ) ) then local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick ( thePlayer, targetPlayer ) if ( not targetPlayer ) then outputChatBox ( "SYNTAX: ".. commandName ..": [PlayerName]", thePlayer ) else local targetPlayerAcc = getAccountName ( getPlayerAccount ( targetPlayer ) ) if ( targetPlayerAcc ) then aclGroupAddObject ( aclGetGroup ( "Admin" ), "user.".. targetPlayerAcc ) end end end end addCommandHandler ( "makeadmin", makeadmin ) Problems: 1: getPlayerAccount ( targetPlayer ) should have been after the "else". 2: You forgot to get the account name of the player with: getAccountName ( theAccount ).
micheal1230 Posted June 23, 2012 Author Posted June 23, 2012 (edited) -- server function makeadmin ( thePlayer, commandName, targetPlayer ) if ( hasObjectPermissionTo ( thePlayer, "command.makeadmin", true ) ) then local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick ( thePlayer, targetPlayer ) if ( not targetPlayer ) then outputChatBox ( "SYNTAX: "..commandName" [PlayerName]", thePlayer ) else local targetPlayerAcc = getAccountName ( getPlayerAccount ( targetPlayer ) ) if ( targetPlayerAcc ) then aclGroupAddObject ( aclGetGroup ( "Admin" ), "user.".. targetPlayerAcc ) end end end end addCommandHandler ( "makeadmin", makeadmin ) Problems: 1: getPlayerAccount ( targetPlayer ) should have been after the "else". 2: You forgot to get the account name of the player with: getAccountName ( theAccount ). Thanks SoildSnake14 But It Still Does'nt Explain Why I Cant Use The Command When Im in The ACL The Group: [code=text]"Owner"> "Moderator"> "SuperModerator"> "Admin"> "RPC"> "resource.login-system"> "resource.vgscoreboard"> "resource.shop-system"> "resource.pool"> "resource.id-system"> "resource.global"> "resource.anticheat-system"> "resource.save-system"> "user.haws1290"> "resource.house-system"> [/code] The Acl [code=text]"Owner"> "command.makeadmin" access="true"> "general.ModifyOtherObjects" access="true"> "general.http" access="true"> "command.shutdown" access="true"> "command.install" access="true"> "command.aexec" access="true"> "command.debugscript" access="true"> "command.refresh" access="true"> "function.executeCommandHandler" access="true"> "function.setServerPassword" access="true"> "function.getServerPassword" access="true"> "function.createResource" access="true"> "function.copyResource" access="true"> "function.addResourceMap" access="true"> "function.addResourceConfig" access="true"> "function.removeResourceFile" access="true"> "function.setResourceDefaultSetting" access="true"> "function.removeResourceDefaultSetting" access="true"> "function.aclReload" access="true"> "function.aclSave" access="true"> "function.aclCreate" access="true"> "function.aclDestroy" access="true"> "function.aclSetRight" access="true"> "function.aclRemoveRight" access="true"> "function.aclCreateGroup" access="true"> "function.aclDestroyGroup" access="true"> "function.aclGroupAddACL" access="true"> "function.aclGroupRemoveACL" access="true"> "function.aclGroupAddObject" access="true"> "function.aclGroupRemoveObject" access="true"> "general.adminpanel" access="true"> "general.tab_players" access="true"> "general.tab_resources" access="true"> "general.tab_server" access="true"> "general.tab_maps" access="true"> "general.tab_bans" access="true"> "general.tab_adminchat" access="true"> "command.kick" access="true"> "command.freeze" access="true"> "command.mute" access="true"> "command.setnick" access="true"> "command.shout" access="true"> "command.spectate" access="true"> "command.slap" access="true"> "command.setgroup" access="true"> "command.sethealth" access="true"> "command.setarmour" access="true"> "command.setmoney" access="true"> "command.setskin" access="true"> "command.setteam" access="true"> "command.giveweapon" access="true"> "command.setstat" access="true"> "command.jetpack" access="true"> "command.warp" access="true"> "command.setdimension" access="true"> "command.setinterior" access="true"> "command.createteam" access="true"> "command.destroyteam" access="true"> "command.givevehicle" access="true"> "command.repair" access="true"> "command.blowvehicle" access="true"> "command.destroyvehicle" access="true"> "command.customize" access="true"> "command.setcolor" access="true"> "command.setpaintjob" access="true"> "command.listmessages" access="true"> "command.readmessage" access="true"> "command.listresources" access="true"> "command.start" access="true"> "command.stop" access="true"> "command.stopall" access="false"> "command.restart" access="true"> "command.execute" access="true"> "command.setpassword" access="true"> "command.setwelcome" access="true"> "command.setgame" access="true"> "command.setmap" access="true"> "command.setweather" access="true"> "command.blendweather" access="true"> "command.setblurlevel" access="true"> "command.setwaveheight" access="true"> "command.setskygradient" access="true"> "command.setgamespeed" access="true"> "command.setgravity" access="true"> "command.settime" access="true"> "function.setServerConfigSetting" access="true"> "function.updateResourceACLRequest" access="true"> "command.aclrequest" access="true"> "command.ban" access="true"> "command.unban" access="true"> "command.banip" access="true"> "command.unbanip" access="true"> "command.banserial" access="true"> "command.unbanserial" access="true"> "command.listbans" access="true"> "function.makeadmin" access="true"> [/code] The Whole ACL And Groups [code=text] "Everyone"> "Default"> "user.*"> "resource.*"> "resource.ucp"> "Moderator"> "Moderator"> "resource.mapcycler"> "resource.mapmanager"> "resource.resourcemanager"> "resource.votemanager"> "SuperModerator"> "Moderator"> "SuperModerator"> "Admin"> "Moderator"> "SuperModerator"> "Admin"> "RPC"> "resource.login-system"> "resource.vgscoreboard"> "resource.shop-system"> "resource.pool"> "resource.id-system"> "resource.global"> "resource.anticheat-system"> "resource.save-system"> "resource.freecam"> "resource.house-system"> "resource.int-system"> "resource.driveby"> "Owner"> "Moderator"> "SuperModerator"> "Admin"> "RPC"> "resource.login-system"> "resource.vgscoreboard"> "resource.shop-system"> "resource.pool"> "resource.id-system"> "resource.global"> "resource.anticheat-system"> "resource.save-system"> "user.haws1290"> "resource.house-system"> "Console"> "Moderator"> "SuperModerator"> "Admin"> "RPC"> "user.Console"> "user.haws1290"> "RPC"> "RPC"> "MapEditor"> "MapEditor"> "resource.editor_main"> "resource.edf"> "raceACLGroup"> "raceACL"> "resource.race"> "Default"> "general.ModifyOtherObjects" access="false"> "general.http" access="false"> "command.start" access="false"> "command.stop" access="false"> "command.stopall" access="false"> "command.gamemode" access="false"> "command.changemode" access="false"> "command.changemap" access="false"> "command.stopmode" access="false"> "command.stopmap" access="false"> "command.skipmap" access="false"> "command.restart" access="false"> "command.refresh" access="false"> "command.addaccount" access="false"> "command.delaccount" access="false"> "command.debugscript" access="true"> "command.chgpass" access="false"> "command.mute" access="false"> "command.unmute" access="false"> "command.kick" access="false"> "command.ban" access="false"> "command.banip" access="false"> "command.unbanip" access="false"> "command.shutdown" access="false"> "command.install" access="false"> "command.aexec" access="false"> "command.makeadmin" access="false"> "command.whois" access="false"> "command.whowas" access="false"> "function.executeCommandHandler" access="false"> "function.setPlayerMuted" access="false"> "function.addAccount" access="false"> "function.removeAccount" access="false"> "function.setAccountPassword" access="false"> "function.kickPlayer" access="false"> "function.banIP" access="false"> "function.banPlayer" access="false"> "function.banSerial" access="false"> "function.getBansXML" access="false"> "function.unbanIP" access="false"> "function.unbanSerial" access="false"> "function.getClientIP" access="false"> "function.setServerPassword" access="false"> "function.getServerPassword" access="false"> "function.callRemote" access="false"> "function.startResource" access="false"> "function.stopResource" access="false"> "function.restartResource" access="false"> "function.createResource" access="false"> "function.copyResource" access="false"> "function.addResourceMap" access="false"> "function.addResourceConfig" access="false"> "function.removeResourceFile" access="false"> "function.setResourceDefaultSetting" access="false"> "function.removeResourceDefaultSetting" access="false"> "function.aclReload" access="false"> "function.aclSave" access="false"> "function.aclCreate" access="false"> "function.aclDestroy" access="false"> "function.aclSetRight" access="false"> "function.aclRemoveRight" access="false"> "function.aclCreateGroup" access="false"> "function.aclDestroyGroup" access="false"> "function.aclGroupAddACL" access="false"> "function.aclGroupRemoveACL" access="false"> "function.aclGroupAddObject" access="false"> "function.aclGroupRemoveObject" access="false"> "general.adminpanel" access="false"> "general.tab_players" access="false"> "general.tab_resources" access="false"> "general.tab_maps" access="false"> "general.tab_server" access="false"> "general.tab_bans" access="false"> "general.tab_adminchat" access="false"> "command.freeze" access="false"> "command.setnick" access="false"> "command.shout" access="false"> "command.spectate" access="false"> "command.slap" access="false"> "command.setgroup" access="false"> "command.sethealth" access="false"> "command.setarmour" access="false"> "command.setmoney" access="false"> "command.setskin" access="false"> "command.setteam" access="false"> "command.giveweapon" access="false"> "command.setstat" access="false"> "command.jetpack" access="false"> "command.warp" access="false"> "command.setdimension" access="false"> "command.setinterior" access="false"> "command.givevehicle" access="false"> "command.repair" access="false"> "command.blow" access="false"> "command.destroy" access="false"> "command.customize" access="false"> "command.setcolor" access="false"> "command.setpaintjob" access="false"> "command.listmessages" access="false"> "command.readmessage" access="false"> "command.listresources" access="false"> "command.execute" access="false"> "command.setpassword" access="false"> "command.setwelcome" access="false"> "command.setgame" access="false"> "command.setmap" access="false"> "command.setweather" access="false"> "command.blendweather" access="false"> "command.setblurlevel" access="false"> "command.setwaveheight" access="false"> "command.setskygradient" access="false"> "command.setgamespeed" access="false"> "command.setgravity" access="false"> "command.settime" access="false"> "command.unban" access="false"> "command.banserial" access="false"> "command.unbanserial" access="false"> "command.listbans" access="false"> "Moderator"> "general.ModifyOtherObjects" access="false"> "command.makeadmin" access="false"> "command.start" access="true"> "command.stop" access="true"> "command.stopall" access="true"> "command.gamemode" access="true"> "command.changemode" access="true"> "command.changemap" access="true"> "command.stopmode" access="true"> "command.stopmap" access="true"> "command.skipmap" access="true"> "command.restart" access="true"> "command.mute" access="true"> "command.unmute" access="true"> "command.kick" access="true"> "command.ban" access="true"> "command.banip" access="true"> "command.unbanip" access="true"> "command.whois" access="true"> "command.whowas" access="true"> "function.setPlayerMuted" access="true"> "function.kickPlayer" access="true"> "function.banIP" access="true"> "function.banPlayer" access="true"> "function.banSerial" access="true"> "function.getBansXML" access="true"> "function.unbanIP" access="true"> "function.unbanSerial" access="true"> "function.getClientIP" access="true"> "function.startResource" access="true"> "function.stopResource" access="true"> "function.restartResource" access="true"> "general.adminpanel" access="true"> "general.tab_players" access="true"> "general.tab_resources" access="false"> "general.tab_maps" access="false"> "general.tab_server" access="true"> "general.tab_bans" access="false"> "general.tab_adminchat" access="true"> "command.freeze" access="true"> "command.setnick" access="true"> "command.shout" access="true"> "command.spectate" access="true"> "command.slap" access="true"> "command.setgroup" access="false"> "command.sethealth" access="true"> "command.setarmour" access="true"> "command.setmoney" access="false"> "command.setskin" access="true"> "command.setteam" access="true"> "command.giveweapon" access="true"> "command.setstat" access="true"> "command.jetpack" access="true"> "command.warp" access="true"> "command.setdimension" access="true"> "command.setinterior" access="true"> "command.createteam" access="false"> "command.destroyteam" access="false"> "command.givevehicle" access="true"> "command.repair" access="true"> "command.blowvehicle" access="true"> "command.destroyvehicle" access="true"> "command.customize" access="true"> "command.setcolor" access="true"> "command.setpaintjob" access="true"> "command.listmessages" access="true"> "command.readmessage" access="true"> "command.listresources" access="true"> "command.execute" access="false"> "command.setpassword" access="false"> "command.setwelcome" access="false"> "command.setgame" access="false"> "command.setmap" access="false"> "command.setweather" access="true"> "command.blendweather" access="true"> "command.setblurlevel" access="true"> "command.setwaveheight" access="true"> "command.setskygradient" access="true"> "command.setgamespeed" access="true"> "command.setgravity" access="true"> "command.settime" access="true"> "command.unban" access="false"> "command.banserial" access="false"> "command.unbanserial" access="false"> "command.listbans" access="false"> "SuperModerator"> "general.ModifyOtherObjects" access="false"> "command.makeadmin" access="false"> "command.refresh" access="true"> "command.addaccount" access="true"> "command.delaccount" access="true"> "command.chgpass" access="true"> "function.addAccount" access="true"> "function.removeAccount" access="true"> "function.setAccountPassword" access="true"> "general.adminpanel" access="true"> "general.tab_players" access="true"> "general.tab_resources" access="true"> "general.tab_maps" access="true"> "general.tab_server" access="true"> "general.tab_bans" access="true"> "general.tab_adminchat" access="true"> "command.kick" access="true"> "command.freeze" access="true"> "command.mute" access="true"> "command.setnick" access="true"> "command.shout" access="true"> "command.spectate" access="true"> "command.slap" access="true"> "command.setgroup" access="false"> "command.sethealth" access="true"> "command.setarmour" access="true"> "command.setmoney" access="true"> "command.setskin" access="true"> "command.setteam" access="true"> "command.giveweapon" access="true"> "command.setstat" access="true"> "command.jetpack" access="true"> "command.warp" access="true"> "command.setdimension" access="true"> "command.setinterior" access="true"> "command.createteam" access="true"> "command.destroyteam" access="true"> "command.givevehicle" access="true"> "command.repair" access="true"> "command.blowvehicle" access="true"> "command.destroyvehicle" access="true"> "command.customize" access="true"> "command.setcolor" access="true"> "command.setpaintjob" access="true"> "command.listmessages" access="true"> "command.readmessage" access="true"> "command.listresources" access="true"> "command.start" access="false"> "command.stop" access="false"> "command.stopall" access="false"> "command.restart" access="true"> "command.execute" access="false"> "command.setpassword" access="true"> "command.setwelcome" access="true"> "command.setgame" access="true"> "command.setmap" access="true"> "command.setweather" access="true"> "command.blendweather" access="true"> "command.setblurlevel" access="true"> "command.setwaveheight" access="true"> "command.setskygradient" access="true"> "command.setgamespeed" access="true"> "command.setgravity" access="true"> "command.settime" access="true"> "command.ban" access="true"> "command.unban" access="true"> "command.banip" access="true"> "command.unbanip" access="true"> "command.banserial" access="true"> "command.unbanserial" access="true"> "command.listbans" access="true"> "Admin"> "general.ModifyOtherObjects" access="true"> "general.http" access="true"> "command.shutdown" access="false"> "command.install" access="true"> "command.makeadmin" access="false"> "command.aexec" access="true"> "command.debugscript" access="true"> "command.refresh" access="true"> "function.executeCommandHandler" access="true"> "function.setServerPassword" access="true"> "function.getServerPassword" access="true"> "function.createResource" access="true"> "function.copyResource" access="true"> "function.addResourceMap" access="true"> "function.addResourceConfig" access="true"> "function.removeResourceFile" access="true"> "function.setResourceDefaultSetting" access="true"> "function.removeResourceDefaultSetting" access="true"> "function.aclReload" access="true"> "function.aclSave" access="true"> "function.aclCreate" access="true"> "function.aclDestroy" access="true"> "function.aclSetRight" access="true"> "function.aclRemoveRight" access="true"> "function.aclCreateGroup" access="true"> "function.aclDestroyGroup" access="true"> "function.aclGroupAddACL" access="true"> "function.aclGroupRemoveACL" access="true"> "function.aclGroupAddObject" access="true"> "function.aclGroupRemoveObject" access="true"> "general.adminpanel" access="true"> "general.tab_players" access="true"> "general.tab_resources" access="true"> "general.tab_server" access="true"> "general.tab_maps" access="true"> "general.tab_bans" access="true"> "general.tab_adminchat" access="true"> "command.kick" access="true"> "command.freeze" access="true"> "command.mute" access="true"> "command.setnick" access="true"> "command.shout" access="true"> "command.spectate" access="true"> "command.slap" access="true"> "command.setgroup" access="true"> "command.sethealth" access="true"> "command.setarmour" access="true"> "command.setmoney" access="true"> "command.setskin" access="true"> "command.setteam" access="true"> "command.giveweapon" access="true"> "command.setstat" access="true"> "command.jetpack" access="true"> "command.warp" access="true"> "command.setdimension" access="true"> "command.setinterior" access="true"> "command.createteam" access="true"> "command.destroyteam" access="true"> "command.givevehicle" access="true"> "command.repair" access="true"> "command.blowvehicle" access="true"> "command.destroyvehicle" access="true"> "command.customize" access="true"> "command.setcolor" access="true"> "command.setpaintjob" access="true"> "command.listmessages" access="true"> "command.readmessage" access="true"> "command.listresources" access="true"> "command.start" access="false"> "command.stop" access="false"> "command.stopall" access="false"> "command.restart" access="true"> "command.execute" access="true"> "command.setpassword" access="true"> "command.setwelcome" access="true"> "command.setgame" access="true"> "command.setmap" access="true"> "command.setweather" access="true"> "command.blendweather" access="true"> "command.setblurlevel" access="true"> "command.setwaveheight" access="true"> "command.setskygradient" access="true"> "command.setgamespeed" access="true"> "command.setgravity" access="true"> "command.settime" access="true"> "function.setServerConfigSetting" access="true"> "function.updateResourceACLRequest" access="true"> "command.aclrequest" access="true"> "command.ban" access="true"> "command.unban" access="true"> "command.banip" access="true"> "command.unbanip" access="true"> "command.banserial" access="true"> "command.unbanserial" access="true"> "command.listbans" access="true"> "Owner"> "command.makeadmin" access="true"> "general.ModifyOtherObjects" access="true"> "general.http" access="true"> "command.shutdown" access="true"> "command.install" access="true"> "command.aexec" access="true"> "command.debugscript" access="true"> "command.refresh" access="true"> "function.executeCommandHandler" access="true"> "function.setServerPassword" access="true"> "function.getServerPassword" access="true"> "function.createResource" access="true"> "function.copyResource" access="true"> "function.addResourceMap" access="true"> "function.addResourceConfig" access="true"> "function.removeResourceFile" access="true"> "function.setResourceDefaultSetting" access="true"> "function.removeResourceDefaultSetting" access="true"> "function.aclReload" access="true"> "function.aclSave" access="true"> "function.aclCreate" access="true"> "function.aclDestroy" access="true"> "function.aclSetRight" access="true"> "function.aclRemoveRight" access="true"> "function.aclCreateGroup" access="true"> "function.aclDestroyGroup" access="true"> "function.aclGroupAddACL" access="true"> "function.aclGroupRemoveACL" access="true"> "function.aclGroupAddObject" access="true"> "function.aclGroupRemoveObject" access="true"> "general.adminpanel" access="true"> "general.tab_players" access="true"> "general.tab_resources" access="true"> "general.tab_server" access="true"> "general.tab_maps" access="true"> "general.tab_bans" access="true"> "general.tab_adminchat" access="true"> "command.kick" access="true"> "command.freeze" access="true"> "command.mute" access="true"> "command.setnick" access="true"> "command.shout" access="true"> "command.spectate" access="true"> "command.slap" access="true"> "command.setgroup" access="true"> "command.sethealth" access="true"> "command.setarmour" access="true"> "command.setmoney" access="true"> "command.setskin" access="true"> "command.setteam" access="true"> "command.giveweapon" access="true"> "command.setstat" access="true"> "command.jetpack" access="true"> "command.warp" access="true"> "command.setdimension" access="true"> "command.setinterior" access="true"> "command.createteam" access="true"> "command.destroyteam" access="true"> "command.givevehicle" access="true"> "command.repair" access="true"> "command.blowvehicle" access="true"> "command.destroyvehicle" access="true"> "command.customize" access="true"> "command.setcolor" access="true"> "command.setpaintjob" access="true"> "command.listmessages" access="true"> "command.readmessage" access="true"> "command.listresources" access="true"> "command.start" access="true"> "command.stop" access="true"> "command.stopall" access="false"> "command.restart" access="true"> "command.execute" access="true"> "command.setpassword" access="true"> "command.setwelcome" access="true"> "command.setgame" access="true"> "command.setmap" access="true"> "command.setweather" access="true"> "command.blendweather" access="true"> "command.setblurlevel" access="true"> "command.setwaveheight" access="true"> "command.setskygradient" access="true"> "command.setgamespeed" access="true"> "command.setgravity" access="true"> "command.settime" access="true"> "function.setServerConfigSetting" access="true"> "function.updateResourceACLRequest" access="true"> "command.aclrequest" access="true"> "command.ban" access="true"> "command.unban" access="true"> "command.banip" access="true"> "command.unbanip" access="true"> "command.banserial" access="true"> "command.unbanserial" access="true"> "command.listbans" access="true"> "function.makeadmin" access="true"> "RPC"> "function.callRemote" access="true"> "general.adminpanel" access="false"> "general.tab_players" access="false"> "general.tab_resources" access="false"> "general.tab_maps" access="false"> "general.tab_server" access="false"> "general.tab_bans" access="false"> "general.tab_adminchat" access="false"> "command.kick" access="false"> "command.freeze" access="false"> "command.mute" access="false"> "command.setnick" access="false"> "command.shout" access="false"> "command.spectate" access="false"> "command.slap" access="false"> "command.setgroup" access="false"> "command.sethealth" access="false"> "command.setarmour" access="false"> "command.setmoney" access="false"> "command.setskin" access="false"> "command.setteam" access="false"> "command.giveweapon" access="false"> "command.setstat" access="false"> "command.jetpack" access="false"> "command.warp" access="false"> "command.setdimension" access="false"> "command.setinterior" access="false"> "command.givevehicle" access="false"> "command.repair" access="false"> "command.blow" access="false"> "command.destroy" access="false"> "command.customize" access="false"> "command.setcolor" access="false"> "command.setpaintjob" access="false"> "command.listmessages" access="false"> "command.readmessage" access="false"> "command.listresources" access="false"> "command.start" access="false"> "command.stop" access="false"> "command.stopall" access="false"> "command.restart" access="false"> "command.execute" access="false"> "command.setpassword" access="false"> "command.setwelcome" access="false"> "command.setgame" access="false"> "command.setmap" access="false"> "command.setweather" access="false"> "command.blendweather" access="false"> "command.setblurlevel" access="false"> "command.setwaveheight" access="false"> "command.setskygradient" access="false"> "command.setgamespeed" access="false"> "command.setgravity" access="false"> "command.settime" access="false"> "command.ban" access="false"> "command.unban" access="false"> "command.banip" access="false"> "command.unbanip" access="false"> "command.banserial" access="false"> "command.unbanserial" access="false"> "command.listbans" access="false"> "MapEditor"> "general.ModifyOtherObjects" access="true"> "function.startResource" access="true"> "function.stopResource" access="true"> "function.restartResource" access="true"> "function.createResource" access="true"> "function.copyResource" access="true"> "function.addResourceMap" access="true"> "function.addResourceConfig" access="true"> "function.removeResourceFile" access="true"> "function.setResourceDefaultSetting" access="true"> "function.removeResourceDefaultSetting" access="true"> "function.xmlLoadFile" access="true"> "general.adminpanel" access="false"> "general.tab_players" access="false"> "general.tab_resources" access="false"> "general.tab_maps" access="false"> "general.tab_server" access="false"> "general.tab_bans" access="false"> "general.tab_adminchat" access="false"> "command.kick" access="false"> "command.freeze" access="false"> "command.mute" access="false"> "command.setnick" access="false"> "command.shout" access="false"> "command.spectate" access="false"> "command.slap" access="false"> "command.setgroup" access="false"> "command.sethealth" access="false"> "command.setarmour" access="false"> "command.setmoney" access="false"> "command.setskin" access="false"> "command.setteam" access="false"> "command.giveweapon" access="false"> "command.setstat" access="false"> "command.jetpack" access="false"> "command.warp" access="false"> "command.setdimension" access="false"> "command.setinterior" access="false"> "command.givevehicle" access="false"> "command.repair" access="false"> "command.blow" access="false"> "command.destroy" access="false"> "command.customize" access="false"> "command.setcolor" access="false"> "command.setpaintjob" access="false"> "command.listmessages" access="false"> "command.readmessage" access="false"> "command.listresources" access="false"> "command.start" access="false"> "command.stop" access="false"> "command.stopall" access="false"> "command.restart" access="false"> "command.execute" access="false"> "command.setpassword" access="false"> "command.setwelcome" access="false"> "command.setgame" access="false"> "command.setmap" access="false"> "command.setweather" access="false"> "command.blendweather" access="false"> "command.setblurlevel" access="false"> "command.setwaveheight" access="false"> "command.setskygradient" access="false"> "command.setgamespeed" access="false"> "command.setgravity" access="false"> "command.settime" access="false"> "command.ban" access="false"> "command.unban" access="false"> "command.banip" access="false"> "command.unbanip" access="false"> "command.banserial" access="false"> "command.unbanserial" access="false"> "command.listbans" access="false"> "raceACL"> "general.ModifyOtherObjects" access="true"> "function.xmlLoadFile" access="true"> "general.adminpanel" access="false"> "general.tab_players" access="false"> "general.tab_resources" access="false"> "general.tab_maps" access="false"> "general.tab_server" access="false"> "general.tab_bans" access="false"> "general.tab_adminchat" access="false"> "command.kick" access="false"> "command.freeze" access="false"> "command.mute" access="false"> "command.setnick" access="false"> "command.shout" access="false"> "command.spectate" access="false"> "command.slap" access="false"> "command.setgroup" access="false"> "command.sethealth" access="false"> "command.setarmour" access="false"> "command.setmoney" access="false"> "command.setskin" access="false"> "command.setteam" access="false"> "command.giveweapon" access="false"> "command.setstat" access="false"> "command.jetpack" access="false"> "command.warp" access="false"> "command.setdimension" access="false"> "command.setinterior" access="false"> "command.givevehicle" access="false"> "command.repair" access="false"> "command.blow" access="false"> "command.destroy" access="false"> "command.customize" access="false"> "command.setcolor" access="false"> "command.setpaintjob" access="false"> "command.listmessages" access="false"> "command.readmessage" access="false"> "command.listresources" access="false"> "command.start" access="false"> "command.stop" access="false"> "command.stopall" access="false"> "command.restart" access="false"> "command.execute" access="false"> "command.setpassword" access="false"> "command.setwelcome" access="false"> "command.setgame" access="false"> "command.setmap" access="false"> "command.setweather" access="false"> "command.blendweather" access="false"> "command.setblurlevel" access="false"> "command.setwaveheight" access="false"> "command.setskygradient" access="false"> "command.setgamespeed" access="false"> "command.setgravity" access="false"> "command.settime" access="false"> "command.ban" access="false"> "command.unban" access="false"> "command.banip" access="false"> "command.unbanip" access="false"> "command.banserial" access="false"> "command.unbanserial" access="false"> "command.listbans" access="false"> [/code] Edited June 23, 2012 by Guest
Anderl Posted June 23, 2012 Posted June 23, 2012 -- server function makeadmin ( thePlayer, commandName, targetPlayer ) if ( hasObjectPermissionTo ( thePlayer, "command.makeadmin", true ) ) then local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick ( thePlayer, targetPlayer ) if ( not targetPlayer ) then outputChatBox ( "SYNTAX: "..commandName" [PlayerName]", thePlayer ) else local targetPlayerAcc = getAccountName ( getPlayerAccount ( targetPlayer ) ) if ( targetPlayerAcc ) then aclGroupAddObject ( aclGetGroup ( "Admin" ), "user.".. targetPlayerAcc ) end end end end addCommandHandler ( "makeadmin", makeadmin ) Problems: 1: getPlayerAccount ( targetPlayer ) should have been after the "else". 2: You forgot to get the account name of the player with: getAccountName ( theAccount ). "SYNTAX: "..commandName" [PlayerName]" "SYNTAX: "..commandName.." [PlayerName]"
micheal1230 Posted June 23, 2012 Author Posted June 23, 2012 Yep, I miss that , fixed. Why Doesnt It Work Here Is MY ACL I posted It Here Befoere bUt It Bugged, The Command Is Set TO Be Only For The Owner Category http://pastebin.com/MrLtn9hP
Castillo Posted June 23, 2012 Posted June 23, 2012 Your ACL seems to be fine, you set the script as server side, right?
micheal1230 Posted June 23, 2012 Author Posted June 23, 2012 Your ACL seems to be fine, you set the script as server side, right? Yes The Script Is Serverside <meta> <info author="haws1290" type="gangster-rp" name="Admin System" /> <script src="server.lua" type="server"/> </meta> Everything else in the script works just not the one set to owner only
Anderl Posted June 23, 2012 Posted June 23, 2012 Did you try checking if player is in the group "Owner" and not if he has permission to use command 'makeadmin'?
TAPL Posted June 24, 2012 Posted June 24, 2012 Try change 'true to 'false' if ( hasObjectPermissionTo ( thePlayer, "command.makeadmin", true ) ) then if ( hasObjectPermissionTo ( thePlayer, "command.makeadmin", false) ) then Not sure if this will work, but just try.
X-SHADOW Posted June 24, 2012 Posted June 24, 2012 Try This and tell us what happend , function makeadmin ( thePlayer, commandName, targetPlayer ) local targetPlayerAcc = getAccountName ( getPlayerAccount ( targetPlayer ) ) local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick ( thePlayer, targetPlayer ) if ( targetPlayerAcc ) then if isObjectInACLGroup ("user."..targetPlayerAcc, aclGetGroup ( 'Owner' ) ) then if hasObjectPermissionTo(thePlayer, 'command.makeadmin') then aclGroupAddObject ( aclGetGroup ( "Admin" ), "user.".. targetPlayerAcc ) else outputChatBox ( "SYNTAX: ".. commandName ..": [PlayerName]", thePlayer ) end end end end addCommandHandler ( 'giveadmin', makeadmin )
Anderl Posted June 24, 2012 Posted June 24, 2012 Try This and tell us what happend , function makeadmin ( thePlayer, commandName, targetPlayer ) local targetPlayerAcc = getAccountName ( getPlayerAccount ( targetPlayer ) ) local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick ( thePlayer, targetPlayer ) if ( targetPlayerAcc ) then if isObjectInACLGroup ("user."..targetPlayerAcc, aclGetGroup ( 'Owner' ) ) then if hasObjectPermissionTo(thePlayer, 'command.makeadmin') then aclGroupAddObject ( aclGetGroup ( "Admin" ), "user.".. targetPlayerAcc ) else outputChatBox ( "SYNTAX: ".. commandName ..": [PlayerName]", thePlayer ) end end end end addCommandHandler ( 'giveadmin', makeadmin ) function makeadmin( player, command, target ) local targetAcc = getAccountName( getPlayerAccount( getPlayerFromNamePart( tostring( target ) ) ) ) if( targetAcc ) then if( isObjectInACLGroup( 'user.' .. targetAcc, aclGetGroup( 'Owner' ) ) ) then aclGroupAddObject( aclGetGroup( 'Admin' ), 'user.' .. targetAcc ); else outputChatBox( 'You do not have permission to use this command!', player, 255, 0, 0, false ); end else outputChatBox( 'Unable to find player!', player, 255, 0, 0 ); end end addCommandHandler( 'makeadmin', makeadmin ); function getPlayerFromNamePart( string ) if( string and type( string ) == 'string' ) then local matches = { } for k,v in ipairs( getElementsByType 'player' ) do if( string.find( getPlayerName( v ), tostring( string ), 0 ) ) then table.insert( matches, v ); end end if ( #matches == 1 ) then return matches[1]; end end return false; end
micheal1230 Posted June 24, 2012 Author Posted June 24, 2012 Did you try checking if player is in the group "Owner" and not if he has permission to use command 'makeadmin'? Yep Some Object stuff command.makeadmin object stuff
micheal1230 Posted June 24, 2012 Author Posted June 24, 2012 Try This and tell us what happend , function makeadmin ( thePlayer, commandName, targetPlayer ) local targetPlayerAcc = getAccountName ( getPlayerAccount ( targetPlayer ) ) local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick ( thePlayer, targetPlayer ) if ( targetPlayerAcc ) then if isObjectInACLGroup ("user."..targetPlayerAcc, aclGetGroup ( 'Owner' ) ) then if hasObjectPermissionTo(thePlayer, 'command.makeadmin') then aclGroupAddObject ( aclGetGroup ( "Admin" ), "user.".. targetPlayerAcc ) else outputChatBox ( "SYNTAX: ".. commandName ..": [PlayerName]", thePlayer ) end end end end addCommandHandler ( 'giveadmin', makeadmin ) Wont that check if the target player is in the owner group? if isObjectInACLGroup ("user."..targetPlayerAcc, aclGetGroup ( 'Owner' ) ) then
Guest Guest4401 Posted June 24, 2012 Posted June 24, 2012 Wont that check if the target player is in the owner group? if isObjectInACLGroup ("user."..targetPlayerAcc, aclGetGroup ( 'Owner' ) ) then Yes, it will do so.
Anderl Posted June 24, 2012 Posted June 24, 2012 function makeadmin( player, command, target ) local targetAcc = getAccountName( getPlayerAccount( getPlayerFromNamePart( tostring( target ) ) ) ) if( targetAcc ) then if( isObjectInACLGroup( 'user.' .. targetAcc, aclGetGroup( 'Owner' ) ) ) then aclGroupAddObject( aclGetGroup( 'Admin' ), 'user.' .. targetAcc ); else outputChatBox( 'You do not have permission to use this command!', player, 255, 0, 0, false ); end else outputChatBox( 'Unable to find player!', player, 255, 0, 0 ); end end addCommandHandler( 'makeadmin', makeadmin ); function getPlayerFromNamePart( string ) if( string and type( string ) == 'string' ) then local matches = { } for k,v in ipairs( getElementsByType 'player' ) do if( string.find( getPlayerName( v ), tostring( string ), 0 ) ) then table.insert( matches, v ); end end if ( #matches == 1 ) then return matches[1]; end end return false; end Try mine.
micheal1230 Posted June 24, 2012 Author Posted June 24, 2012 Try This and tell us what happend , function makeadmin ( thePlayer, commandName, targetPlayer ) local targetPlayerAcc = getAccountName ( getPlayerAccount ( targetPlayer ) ) local targetPlayer, targetPlayerName = exports.global:findPlayerByPartialNick ( thePlayer, targetPlayer ) if ( targetPlayerAcc ) then if isObjectInACLGroup ("user."..targetPlayerAcc, aclGetGroup ( 'Owner' ) ) then if hasObjectPermissionTo(thePlayer, 'command.makeadmin') then aclGroupAddObject ( aclGetGroup ( "Admin" ), "user.".. targetPlayerAcc ) else outputChatBox ( "SYNTAX: ".. commandName ..": [PlayerName]", thePlayer ) end end end end addCommandHandler ( 'giveadmin', makeadmin ) function makeadmin( player, command, target ) local targetAcc = getAccountName( getPlayerAccount( getPlayerFromNamePart( tostring( target ) ) ) ) if( targetAcc ) then if( isObjectInACLGroup( 'user.' .. targetAcc, aclGetGroup( 'Owner' ) ) ) then aclGroupAddObject( aclGetGroup( 'Admin' ), 'user.' .. targetAcc ); else outputChatBox( 'You do not have permission to use this command!', player, 255, 0, 0, false ); end else outputChatBox( 'Unable to find player!', player, 255, 0, 0 ); end end addCommandHandler( 'makeadmin', makeadmin ); function getPlayerFromNamePart( string ) if( string and type( string ) == 'string' ) then local matches = { } for k,v in ipairs( getElementsByType 'player' ) do if( string.find( getPlayerName( v ), tostring( string ), 0 ) ) then table.insert( matches, v ); end end if ( #matches == 1 ) then return matches[1]; end end return false; end Still doesnt work i cant use the command but im in the acl
Guest Guest4401 Posted June 24, 2012 Posted June 24, 2012 if( isObjectInACLGroup( 'user.' .. targetAcc, aclGetGroup( 'Owner' ) ) ) You are checking if the target player's account is in Owner or not. I guess you are trying to check the own player's account? Change it to: if( isObjectInACLGroup( 'user.' .. getAccountName(getPlayerAccount(player)), aclGetGroup( 'Owner' ) ) )
Anderl Posted June 24, 2012 Posted June 24, 2012 if( isObjectInACLGroup( 'user.' .. targetAcc, aclGetGroup( 'Owner' ) ) ) You are checking if the target player's account is in Owner or not. I guess you are trying to check the own player's account? Change it to: if( isObjectInACLGroup( 'user.' .. getAccountName(getPlayerAccount(player)), aclGetGroup( 'Owner' ) ) ) Yeah, you're right I didn't understand that was that lol
micheal1230 Posted June 24, 2012 Author Posted June 24, 2012 if( isObjectInACLGroup( 'user.' .. targetAcc, aclGetGroup( 'Owner' ) ) ) You are checking if the target player's account is in Owner or not. I guess you are trying to check the own player's account? Change it to: if( isObjectInACLGroup( 'user.' .. getAccountName(getPlayerAccount(player)), aclGetGroup( 'Owner' ) ) ) Yeah, you're right I didn't understand that was that lol Nope no errors, nothing not even a outputChatBox Saying That I cant use the command its like the script aint loading but it is because every other command works
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