kietla Posted February 15, 2011 Share Posted February 15, 2011 policeSkins = { [280]=true,[281]=true,[282]=true,[283]=true,[284]=true,[285]=true,[286]=true } function kick (commandName, playerSource, playerName, opis) local player = getPlayerFromName (playerName) if policeSkins[getElementModel(playerSource)] then if ( hasObjectPermissionTo ( sourcePlayer, "function.kickPlayer" ) ) then -- Kick the player kickPlayer ( kicked, sourcePlayer, reason ) end end end addCommandHandler ("wyrzuc", kick) [22:32:28] WARNING: dodatki/kick.lua:5: Bad argument @ 'getElementModel' [22:32:48] WARNING: dodatki/kick.lua:5: Bad argument @ 'getElementModel' [22:33:00] WARNING: dodatki/kick.lua:5: Bad argument @ 'getElementModel' Please help command does not work Link to comment
Aibo Posted February 15, 2011 Share Posted February 15, 2011 https://wiki.multitheftauto.com/wiki/AddCommandHandler player playerSource, string commandName, [string arg1, string arg2, ...] your variables are a mess, playerSource, then sourcePlayer, then kicked (what?). Link to comment
kietla Posted February 15, 2011 Author Share Posted February 15, 2011 could you improve the code too much because I do not know what's going on Poland: mógł byś poprawić kod bo za bardzo nie wiem o co chodzi Link to comment
Aibo Posted February 15, 2011 Share Posted February 15, 2011 policeSkins = { [280]=true,[281]=true,[282]=true,[283]=true,[284]=true,[285]=true,[286]=true } function kick(playerSource, commandName, playerName, opis) if policeSkins[getElementModel(playerSource)] then local player = getPlayerFromName(playerName) if player and hasObjectPermissionTo(playerSource, "function.kickPlayer") then -- Kick the player kickPlayer(player, playerSource, opis) end end end addCommandHandler("wyrzuc", kick) Link to comment
kietla Posted February 15, 2011 Author Share Posted February 15, 2011 still not working: ( Link to comment
Aibo Posted February 15, 2011 Share Posted February 15, 2011 with your script you have to write eXAcT full name, including case. your script must be in meta.xml, server type you must have police skin you must be allowed to use kickPlayer function you resource must be allowed to use kickPlayer function etc. as you see there are too many factors with your "not working". use /debugscript 3 Link to comment
kietla Posted February 15, 2011 Author Share Posted February 15, 2011 policeSkins = { [280]=true,[281]=true,[282]=true,[283]=true,[284]=true,[285]=true,[286]=true } function kick (commandName, playerSource, playerName, opis) local player = getPlayerFromName (playerName) if policeSkins[getElementModel(playerSource)] then if isElement(player) then if opis then kickPlayer (player) outputChatBox ("Gracz " .. tostring(playerName) .. " został wyrzucony przez " .. tostring(getPlayerName(playerSource)) .. ", powów: " .. tostring(opis) .. ".") end else outputChatBox ("Nie ma takiego gracza", playerSource) end end end addCommandHandler ("wyrzuc", kick) --/wyrzuc gracz dlaczego also in this script are errors or you can correct it? Polish: w tym skrypcie tez są błędy czy byś mógł go poprawić?? Link to comment
Aibo Posted February 15, 2011 Share Posted February 15, 2011 same thing, change function kick (commandName, playerSource, playerName, opis) to function kick (playerSource, commandName, playerName, opis) Link to comment
kietla Posted February 23, 2011 Author Share Posted February 23, 2011 WARNING: ttt/team.lua:4: Bad argument @ 'getPlayerFromName' Acl Admin: OK policeSkins = { [280]=true,[281]=true,[282]=true,[283]=true,[284]=true,[285]=true,[286]=true } function kick (playerSource, commandName, playerName, opis) local player = getPlayerFromName (playerName) if policeSkins[getElementModel(playerSource)] then if isElement(player) then outputChatBox ("Nie ma takiego gracza", playerSource) end end end addCommandHandler ("ttest", kick) --/wyrzuc gracz dlaczego 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