Nitride Posted November 20, 2011 Posted November 20, 2011 i can't get this script to kick anyone function weaponSwitchDisableMinigun ( previousWeaponID, currentWeaponID ) if currentWeaponID == 38 or currentWeaponID == 36 or currentWeaponID == 35 or currentWeaponID == 37 then outputChatBox ( getClientName (source) .. " was kicked for spawning a " .. getWeaponNameFromID ( currentWeaponID ), getRootElement(), 255,0,0 ) kickPlayer(source) end end addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), weaponSwitchDisableMinigun )
unknooooown Posted November 20, 2011 Posted November 20, 2011 (edited) function weaponSwitchDisableMinigun ( previousWeaponID, currentWeaponID ) if currentWeaponID == 38 or 36 or 35 or 37 then kickPlayer(source) outputChatBox ( getPlayerName(source) .. " was kicked for spawning a " .. getWeaponNameFromID ( currentWeaponID ), getRootElement(), 255,0,0 ) end end addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), weaponSwitchDisableMinigun ) That should work. I changed getClientName -> getPlayerName Also made a change in your if statement: if currentWeaponID == 38 or currentWeaponID == 36 or currentWeaponID == 35 or currentWeaponID == 37 then Changed to this: if currentWeaponID == 38 or 36 or 35 or 37 then Edited November 20, 2011 by Guest
Charlie_Jefferson Posted November 20, 2011 Posted November 20, 2011 function weaponSwitchDisableMinigun ( previousWeaponID, currentWeaponID ) if currentWeaponID == 38 or 36 or 35 or 37 then outputChatBox ( getPlayerName (source) .. " was kicked for spawning a " .. getWeaponNameFromID ( currentWeaponID ), getRootElement(), 255,0,0 ) kickPlayer(source) end end addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), weaponSwitchDisableMinigun )
Nitride Posted November 20, 2011 Author Posted November 20, 2011 function weaponSwitchDisableMinigun ( previousWeaponID, currentWeaponID ) if currentWeaponID == 38 or 36 or 35 or 37 then kickPlayer(source) outputChatBox ( getPlayerName(source) .. " was kicked for spawning a " .. getWeaponNameFromID ( currentWeaponID ), getRootElement(), 255,0,0 ) end end addEventHandler ( "onPlayerWeaponSwitch", getRootElement(), weaponSwitchDisableMinigun ) That should work. I changed getClientName -> getPlayerName Also made a change in your if statement: if currentWeaponID == 38 or currentWeaponID == 36 or currentWeaponID == 35 or currentWeaponID == 37 then Changed to this: if currentWeaponID == 38 or 36 or 35 or 37 then i tried yours and now every weapon that spawns makes that announcement and it still doesn't kick
unknooooown Posted November 20, 2011 Posted November 20, 2011 Oh yeah Thats because you have to include the file in the acl.xml file It needs to have admin rights to use the kickPlayer() function. Open your acl.xml in C:\Program Files (x86)\MTA San Andreas 1.1\server\mods\deathmatch Replace "NAME-OF-THE-RESOURCE" with your resource name Another thing. When you are scripting, try to use /debugscript 3 - It can help you detect a lot of different problems. If you had used it to test this resource, you would have noticed the error: Access denied @ 'kickPlayer'
Nitride Posted November 20, 2011 Author Posted November 20, 2011 Oh yeah Thats because you have to include the file in the acl.xml file It needs to have admin rights to use the kickPlayer() function. Open your acl.xml in C:\Program Files (x86)\MTA San Andreas 1.1\server\mods\deathmatch Replace "NAME-OF-THE-RESOURCE" with your resource name Another thing. When you are scripting, try to use /debugscript 3 - It can help you detect a lot of different problems. If you had used it to test this resource, you would have noticed the error: Access denied @ 'kickPlayer' thanks man. it worked after i added it into the admin group and change it back to vehicleid
Nitride Posted November 20, 2011 Author Posted November 20, 2011 im busy making a non-admin base with auto doors but none of them want to open Front gate co-ords Front gate NM local theMarker = createMarker ( -1530.3000488281, 482.20001220703, 9.6999998092651, "cylinder", 0, 0, 255, 0) local gate = createObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 255, 0 ) -- create Marker and Gate function openGate ( hitElement ) if (getElementType(hitElement) == "player" ) then if hasObjectPermissionTo( hitElement, "function.kickPlayer" ) then moveObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 0, 0 ) end if (getElementType(hitElement) == "vehicle" ) then moveObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 0, 0 ) end addEventHandler( "onMarkerHit", theMarker, openGate ) -- Open Gate function closeGate ( leftElement ) if (getElementType(leftElement) == "player" ) then moveObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 0, 0 ) end end addEventHandler( "onMarkerLeave", theMarker, closeGate ) -- Close Gate back gate co-ords Back Gate NM local theMarker = createMarker ( -1250.1999511719, 463.89999389648, 9.60000014697, "cylinder", 10, 0, 0, 255, 0 ) local subwaygate = createObject (-1250.1999511719, 463.89999389648, 9.60000014697, 0, 0, 0 ) -- Make Marker and Gate function openGate ( hitElement ) if (getElementType(hitElement) == "player" ) then if hasObjectPermissionTo( hitElement, "function.kickPlayer" ) then moveObject ( gate, 1500, -1701.7937011719, 689.03674316406, 24.037502288818, 0, 0, 0 ) end end addEventHandler( "onMarkerHit", theMarker, openGate ) -- Open Gate function closeGate ( leftElement ) if (getElementType(leftElement) == "player" ) then moveObject ( subwaygate, -1250.1999511719, 463.89999389648, 9.60000014697, 0, 0, 0 ) end end addEventHandler( "onMarkerLeave", theMarker, closeGate ) -- Close Gate
Charlie_Jefferson Posted November 20, 2011 Posted November 20, 2011 That's because you have to add the gates by scripting them. addObject or something.
unknooooown Posted November 20, 2011 Posted November 20, 2011 @charly-man What is up with this line? if hasObjectPermissionTo( hitElement, "function.kickPlayer" ) then That could cause some problems
Nitride Posted November 20, 2011 Author Posted November 20, 2011 @Charlie_Jefferson i did at the top of the script. @Wafamde I took it out and still nothing
unknooooown Posted November 20, 2011 Posted November 20, 2011 @charly-man Try posting the entire script. Something looks wrong in the scripts you posted earlier, but I have to see the entire script to figure it out.
Nitride Posted November 20, 2011 Author Posted November 20, 2011 Backgate local theMarker = createMarker ( -1250.1999511719, 463.89999389648, 9.60000014697, "cylinder", 10, 0, 0, 255, 0 ) local subwaygate = createObject (-1250.1999511719, 463.89999389648, 9.60000014697, 0, 0, 0 ) -- Make Marker and Gate function openGate ( hitElement ) if (getElementType(hitElement) == "player" ) then moveObject ( gate, 1500, -1701.7937011719, 689.03674316406, 24.037502288818, 0, 0, 0 ) end end addEventHandler( "onMarkerHit", theMarker, openGate ) -- Open Gate function closeGate ( leftElement ) if (getElementType(leftElement) == "player" ) then moveObject ( subwaygate, -1250.1999511719, 463.89999389648, 9.60000014697, 0, 0, 0 ) end end addEventHandler( "onMarkerLeave", theMarker, closeGate ) -- Close Gate front gate local theMarker = createMarker ( -1530.3000488281, 482.20001220703, 9.6999998092651, "cylinder", 0, 0, 255, 0) local gate = createObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 255, 0 ) -- Define Marker and Gate function openGate ( hitElement ) if (getElementType(hitElement) == "player" ) then moveObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 0, 0 ) end if (getElementType(hitElement) == "vehicle" ) then moveObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 0, 0 ) end addEventHandler( "onMarkerHit", theMarker, openGate ) -- Open Gate function closeGate ( leftElement ) if (getElementType(leftElement) == "player" ) then moveObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 0, 0 ) end end addEventHandler( "onMarkerLeave", theMarker, closeGate ) -- Close Gate
unknooooown Posted November 20, 2011 Posted November 20, 2011 local theMarker = createMarker ( -1250.1999511719, 463.89999389648, 9.60000014697, "cylinder", 10, 0, 0, 255, 0 ) local subwaygate = createObject (-1250.1999511719, 463.89999389648, 9.60000014697, 0, 0, 0 ) -- Make Marker and Gate function openGate ( hitElement ) if (getElementType(hitElement) == "player" ) then moveObject ( subwaygate , 1500, -1701.7937011719, 689.03674316406, 24.037502288818, 0, 0, 0 ) -- Changed 'gate' to 'subwaygate' end end addEventHandler( "onMarkerHit", theMarker, openGate ) -- Open Gate function closeGate ( leftElement ) if (getElementType(leftElement) == "player" ) then moveObject ( subwaygate, -1250.1999511719, 463.89999389648, 9.60000014697, 0, 0, 0 ) end end addEventHandler( "onMarkerLeave", theMarker, closeGate ) -- Close Gate local theMarker = createMarker ( -1530.3000488281, 482.20001220703, 9.6999998092651, "cylinder", 0, 0, 255, 0) local subwaygate = createObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 255, 0 ) -- Changed 'gate' to 'subwaygate' -- Define Marker and Gate function openGate ( hitElement ) if (getElementType(hitElement) == "player" ) then moveObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 0, 0 ) end if (getElementType(hitElement) == "vehicle" ) then moveObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 0, 0 ) end addEventHandler( "onMarkerHit", theMarker, openGate ) -- Open Gate function closeGate ( leftElement ) if (getElementType(leftElement) == "player" ) then moveObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 0, 0 ) end end addEventHandler( "onMarkerLeave", theMarker, closeGate ) -- Close Gate Try that.. Think it works not. I have commented the changed in the scripts.
unknooooown Posted November 20, 2011 Posted November 20, 2011 I will see what I can do about it tonight. Can't test it right now. I have to take care of some RL stuff, but I will update this post when I have an answer for you. If you figure it out by yourself during the night, please let me know so I don't waste my time
CapY Posted November 24, 2011 Posted November 24, 2011 can somebody please help me Charly-man is that your script ?
Charlie_Jefferson Posted November 24, 2011 Posted November 24, 2011 Charly-man post the script you've got and I'll try fixing it.
Nitride Posted November 25, 2011 Author Posted November 25, 2011 @Charlie_Jefferson Thanks a lot man Front gate: local theMarker = createMarker ( -1530.3000488281, 482.20001220703, 9.6999998092651, "cylinder", 0, 0, 255, 0) local subwaygate = createObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 255, 0 ) -- Changed 'gate' to 'subwaygate' -- Define Marker and Gate function openGate ( hitElement ) if (getElementType(hitElement) == "player" ) then moveObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 0, 0 ) end if (getElementType(hitElement) == "vehicle" ) then moveObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 0, 0 ) end addEventHandler( "onMarkerHit", theMarker, openGate ) -- Open Gate function closeGate ( leftElement ) if (getElementType(leftElement) == "player" ) then moveObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 0, 0 ) end end addEventHandler( "onMarkerLeave", theMarker, closeGate ) -- Close Gate Back Gate: local theMarker = createMarker ( -1250.1999511719, 463.89999389648, 9.60000014697, "cylinder", 10, 0, 0, 255, 0 ) local subwaygate = createObject (-1250.1999511719, 463.89999389648, 9.60000014697, 0, 0, 0 ) -- Make Marker and Gate function openGate ( hitElement ) if (getElementType(hitElement) == "player" ) then moveObject ( subwaygate , 1500, -1701.7937011719, 689.03674316406, 24.037502288818, 0, 0, 0 ) -- Changed 'gate' to 'subwaygate' end end addEventHandler( "onMarkerHit", theMarker, openGate ) -- Open Gate function closeGate ( leftElement ) if (getElementType(leftElement) == "player" ) then moveObject ( subwaygate, -1250.1999511719, 463.89999389648, 9.60000014697, 0, 0, 0 ) end end addEventHandler( "onMarkerLeave", theMarker, closeGate ) -- Close Gate
Nitride Posted November 25, 2011 Author Posted November 25, 2011 Wafamde is the person who tried to help me fix it but it still didn't work
CapY Posted November 25, 2011 Posted November 25, 2011 Charly-man this is not your script. im busy making a non-admin base with auto doors but none of them want to open Front gate co-ords Front gate NM local theMarker = createMarker ( -1530.3000488281, 482.20001220703, 9.6999998092651, "cylinder", 0, 0, 255, 0) local gate = createObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 255, 0 ) -- create Marker and Gate function openGate ( hitElement ) if (getElementType(hitElement) == "player" ) then if hasObjectPermissionTo( hitElement, "function.kickPlayer" ) then moveObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 0, 0 ) end if (getElementType(hitElement) == "vehicle" ) then moveObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 0, 0 ) end addEventHandler( "onMarkerHit", theMarker, openGate ) -- Open Gate function closeGate ( leftElement ) if (getElementType(leftElement) == "player" ) then moveObject ( subwaygate, -1530.3000488281, 482.20001220703, 9.6999998092651, 0, 0, 0, 0 ) end end addEventHandler( "onMarkerLeave", theMarker, closeGate ) -- Close Gate back gate co-ords Back Gate NM local theMarker = createMarker ( -1250.1999511719, 463.89999389648, 9.60000014697, "cylinder", 10, 0, 0, 255, 0 ) local subwaygate = createObject (-1250.1999511719, 463.89999389648, 9.60000014697, 0, 0, 0 ) -- Make Marker and Gate function openGate ( hitElement ) if (getElementType(hitElement) == "player" ) then if hasObjectPermissionTo( hitElement, "function.kickPlayer" ) then moveObject ( gate, 1500, -1701.7937011719, 689.03674316406, 24.037502288818, 0, 0, 0 ) end end addEventHandler( "onMarkerHit", theMarker, openGate ) -- Open Gate function closeGate ( leftElement ) if (getElementType(leftElement) == "player" ) then moveObject ( subwaygate, -1250.1999511719, 463.89999389648, 9.60000014697, 0, 0, 0 ) end end addEventHandler( "onMarkerLeave", theMarker, closeGate ) -- Close Gate https://community.multitheftauto.com/index.php?p= ... ils&id=707 Stealer, aren't you ?
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