jkub Posted November 11, 2008 Share Posted November 11, 2008 here is a scipt i made a while back that puts a message to the chatbox if anybody pulls out any illegal weapon and also disable fire for them. but i wanted to add another fucntion if the gun is a minigun i want it to kick the player. i have already tried that but it does not kick the player, in the debug it says access denied @ 'kickPlayer' how would i work around that? function minigun ( previousWeaponID, currentWeaponID ) --when a player switches his weapon if currentWeaponID == 38 or currentWeaponID == 35 or currentWeaponID == 36 or currentWeaponID == 37 then --if the weapon ID is minigun toggleControl ( source, "fire", false ) --disable the fire button toggleControl ( source, "action", false ) --disable the action button ( can also fire ) local name = getClientName ( source ) --get the noobs name local weapon = getWeaponNameFromID ( currentWeaponID ) outputChatBox ( name.. " has pulled out a " ..weapon, getRootElement(), 255, 100, 0 ) else --otherwise toggleControl ( source, "fire", true ) --enable it toggleControl ( source, "action", true ) --enable it end end --add an event handler for onPlayerWeaponSwitch addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), minigun ) function killMiniNoob ( previousWeaponID, currentWeaponID ) -- u know the drill if currentWeaponID == 38 then setElementHealth ( source, - 5 ) setTimer ( killMiniNoob, 200, 0, source, -5 ) kickPlayer ( source, source, "minigun" ) end end addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), killMiniNoob ) Link to comment
robhol Posted November 11, 2008 Share Posted November 11, 2008 Add the resource to the admin group in the ACL: and I suggest banning, rather than kicking, but of course, that's up to you. Link to comment
Phat Looser Posted November 11, 2008 Share Posted November 11, 2008 Is it clientside? For the case its clientside: addEventHandler ( "onPlayerWeaponSwitch", getLocalPlayer(), minigun ) setTimer ( killMiniNoob, 200, 0, source, -5 ) kickPlayer ( source, source, "minigun" ) doesn't make much sense. Link to comment
XetaQuake Posted November 11, 2008 Share Posted November 11, 2008 You should not add a message when anybody pulls out any illegal weapon, because now cheater are able to spam extremely - just roll your mouswheel up and down My tip: The Message should be visible only one time in 5minutes about the same cheater. Link to comment
eXo|Flobu Posted November 11, 2008 Share Posted November 11, 2008 kickPlayer http://development.mtasa.com/index.php?title=BanPlayer and banPlayer http://development.mtasa.com/index.php?title=KickPlayer are server-only functions. they don't work on a clientside script you must use triggerServerEvent http://development.mtasa.com/index.php? ... erverEvent on the clientside script and add this event with kickPlayer or banPlayer on the serverside Link to comment
Mr.Hankey Posted November 11, 2008 Share Posted November 11, 2008 erm... the script doesn't look like a client-side one and im pretty sure it isn't supposed to be one. jkub to solve the warning you are getting you need to grant the resource admin rights. You can simply do that by opening the acl.xml and adding <object name="resource.(name of the resource that needs admin access)" /> to the admin group. And well looking at your killMiniNoob function it really doesnt make sense to set a timer to call the same function 200ms later again. Link to comment
jkub Posted November 11, 2008 Author Share Posted November 11, 2008 aw ok im gonna try this when i get home. and about the settimer on the killmininoob function i think i was gonna make that into somthin but i never got to it and I was just lazy and never took it out of the script before i posted it here lol. but I will try that though and ill get back at ya Link to comment
jkub Posted November 12, 2008 Author Share Posted November 12, 2008 thanks ma. i added the resource to the admin section in the acl like u said and it worked fine 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