toxicsmoke11 Posted April 11, 2014 Share Posted April 11, 2014 So,i've started doing one system,something like a ban system but not exactly "ban" system,more like keep-away system anyway, i am getting 2 errors,and i do not understand what have i done wrongly. here's my code function dimensionSystem(commandName,thePlayer,theTarget) if hasObjectPermissionTo(theTarget, "function.banPlayer",true) then showPlayerHudComponent ( theTarget, "ammo", false ) showPlayerHudComponent ( theTarget, "area_name", false ) showPlayerHudComponent ( theTarget, "armour", false ) showPlayerHudComponent ( theTarget, "breath", false ) showPlayerHudComponent ( theTarget, "clock", false ) showPlayerHudComponent ( theTarget, "health", false ) showPlayerHudComponent ( theTarget, "money", false ) showPlayerHudComponent ( theTarget, "vehicle_name", false ) showPlayerHudComponent ( theTarget, "weapon", false ) showPlayerHudComponent ( theTarget, "radar", false ) showChat( theTarget, false ) else kickPlayer(thePlayer,"Don't abuse the Admin system!") end end addCommandHandler("pban",dimensionSystem) i get these two errors: [22:12:39] WARNING: ban-system\script.lua:2: Bad argument @ 'hasObjectPermissionTo'[22:12:39] WARNING: ban-system\script.lua:15: Bad argument @ 'kickPlayer' I've readed both hasObjectPermissionTo and kickPlayer function pages,and i don't see what am i doing wrong as my syntax is correct as far as i see. Please help me. I'm new to this. Link to comment
Moderators Citizen Posted April 11, 2014 Moderators Share Posted April 11, 2014 the problem is the value of theTarget, show us how you defined that variable. Link to comment
toxicsmoke11 Posted April 11, 2014 Author Share Posted April 11, 2014 the problem is the value of theTarget, show us how you defined that variable. I Don't understand the meaning of word 'define' so i don't know what to answer,i was just looking at some other script examples and looked into function thing and there was theTarget,and the only place where it was mentioned was in function *name*(*here*) and it worked fine,so i guess that i forgot to define it or something because it's clearly not working. Sorry for my english and my bad lua skills and my not clear understanding of word 'define' Link to comment
Baseplate Posted April 11, 2014 Share Posted April 11, 2014 function dimensionSystem(thePlayer,commandName,theTarget) if hasObjectPermissionTo(theTarget, "function.banPlayer",true) then showPlayerHudComponent ( theTarget, "ammo", false ) showPlayerHudComponent ( theTarget, "area_name", false ) showPlayerHudComponent ( theTarget, "armour", false ) showPlayerHudComponent ( theTarget, "breath", false ) showPlayerHudComponent ( theTarget, "clock", false ) showPlayerHudComponent ( theTarget, "health", false ) showPlayerHudComponent ( theTarget, "money", false ) showPlayerHudComponent ( theTarget, "vehicle_name", false ) showPlayerHudComponent ( theTarget, "weapon", false ) showPlayerHudComponent ( theTarget, "radar", false ) showChat( theTarget, false ) else kickPlayer(thePlayer,"Don't abuse the Admin system!") end end addCommandHandler("pban",dimensionSystem) You messed up with the commandName and thePlayer I guess, have a look. Link to comment
toxicsmoke11 Posted April 11, 2014 Author Share Posted April 11, 2014 tried your code,and it kicks me no matter if im admin or not edit:just noticed,in your code you changed thePlayer with theTarget(2nd line),so it messes it up totally i guess. thePlayer is suppost to be a person who uses command theTarget is like this /pban *name* *name* is theTarget Link to comment
Castillo Posted April 12, 2014 Share Posted April 12, 2014 You want that only players with access to "function.banPlayer" are able to use the command? or you want so that anybody can use the command, but they can't use it against admins? If it's the second, then use this: function dimensionSystem ( thePlayer, commandName, theTarget ) local theTarget = getPlayerFromName ( theTarget ) if ( theTarget ) then if hasObjectPermissionTo ( theTarget, "function.banPlayer", true ) then kickPlayer ( thePlayer, "Don't abuse the Admin system!" ) else showPlayerHudComponent ( theTarget, "ammo", false ) showPlayerHudComponent ( theTarget, "area_name", false ) showPlayerHudComponent ( theTarget, "armour", false ) showPlayerHudComponent ( theTarget, "breath", false ) showPlayerHudComponent ( theTarget, "clock", false ) showPlayerHudComponent ( theTarget, "health", false ) showPlayerHudComponent ( theTarget, "money", false ) showPlayerHudComponent ( theTarget, "vehicle_name", false ) showPlayerHudComponent ( theTarget, "weapon", false ) showPlayerHudComponent ( theTarget, "radar", false ) showChat ( theTarget, false ) end else outputChatBox ( "The player was not found!", thePlayer, 255, 0, 0 ) end end addCommandHandler ( "pban", dimensionSystem ) Link to comment
toxicsmoke11 Posted April 12, 2014 Author Share Posted April 12, 2014 You want that only players with access to "function.banPlayer" are able to use the command? or you want so that anybody can use the command, but they can't use it against admins?If it's the second, then use this: function dimensionSystem ( thePlayer, commandName, theTarget ) local theTarget = getPlayerFromName ( theTarget ) if ( theTarget ) then if hasObjectPermissionTo ( theTarget, "function.banPlayer", true ) then kickPlayer ( thePlayer, "Don't abuse the Admin system!" ) else showPlayerHudComponent ( theTarget, "ammo", false ) showPlayerHudComponent ( theTarget, "area_name", false ) showPlayerHudComponent ( theTarget, "armour", false ) showPlayerHudComponent ( theTarget, "breath", false ) showPlayerHudComponent ( theTarget, "clock", false ) showPlayerHudComponent ( theTarget, "health", false ) showPlayerHudComponent ( theTarget, "money", false ) showPlayerHudComponent ( theTarget, "vehicle_name", false ) showPlayerHudComponent ( theTarget, "weapon", false ) showPlayerHudComponent ( theTarget, "radar", false ) showChat ( theTarget, false ) end else outputChatBox ( "The player was not found!", thePlayer, 255, 0, 0 ) end end addCommandHandler ( "pban", dimensionSystem ) Why would i let everybody to use this command?it can be used for trolling other people. i just want to make it like what u first said, only people with "function.banPlayer" can use pban command,if they dont have that function it kicks them out with that message "dont abuse admin system". but i've tried switching theTarget with thePlayer in few lines and it works anyway, thank you Solidsnake for helping me with this script 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