Jump to content

[Help] I can not run the command


hank

Recommended Posts

Posted

I'm having trouble, see if this code is right.

  
function kickPlayerHandler (kickedname) 
    if (kickedname ~= nil) then 
        local kicked = getPlayerFromName(kickedname) 
        kickPlayer (kicked) 
    else 
        outputChatBox("Error.: /kick ") 
    end 
    --end 
end 
addCommandHandler("kick",kickPlayerHandler) 
  

awaiting response.

Posted

just ur parameters are wrong, it should be:

function kickPlayerHandler (playerSource,commandName, kickedname) 

have a read: https://wiki.multitheftauto.com/wiki/AddCommandHandler for more info

also u should check the player 'kicked' exists after u get it from kickedname

or u will get an error if a player types /kick bob and bob doesnt exist.

ScoobySig.gif

[UVA]Scooby

Founder Of UVA - Ultimate Vice Assassins

http://www.uvaclan.com/

Posted
  
function kickPlayerHandler (player,cmd,kickedname) 
     if (kickedname) then 
          local kicked = getPlayerFromName(kickedname) 
          if (kicked) then 
               kickPlayer(kicked) 
          else 
               outputChatBox("Error.: Player name not exist",player) 
          end 
     else 
          outputChatBox("Error.: /kick ",player) 
     end 
end 
addCommandHandler("kick",kickPlayerHandler) 

CiTLh.png
Posted
      
    function kickPlayerHandler (player,cmd,kickedname) 
         if not (kickedname) then 
              local kicked = getPlayerFromName(kickedname) 
              if (kicked) then 
                   kickPlayer(kicked) 
              else 
                   outputChatBox("Error.: Player name not exist",player) 
              end 
         else 
              outputChatBox("Error.: /kick ",player) 
         end 
    end 
    addCommandHandler("kick",kickPlayerHandler) 

Posted
      
    function kickPlayerHandler (player,cmd,kickedname) 
         if not (kickedname) then 
              local kicked = getPlayerFromName(kickedname) 
              if (kicked) then 
                   kickPlayer(kicked) 
              else 
                   outputChatBox("Error.: Player name not exist",player) 
              end 
         else 
              outputChatBox("Error.: /kick ",player) 
         end 
    end 
    addCommandHandler("kick",kickPlayerHandler) 

  
    function kickPlayerHandler (player,cmd,kickedname) 
         if (kickedname) then 
              local kicked = getPlayerFromName(kickedname) 
              if (kicked) then 
                   kickPlayer(kicked) 
              else 
                   outputChatBox("Error.: Player name not exist",player) 
              end 
         else 
              outputChatBox("Error.: /kick ",player) 
         end 
    end 
    addCommandHandler("kick",kickPlayerHandler) 
  

Remove the not

Currently working on gamemodes :

  • Reallife Script 70%
  • Breakout Script 10%
Posted

MTA is very complicated. I want to kick player when he clicks a button.

It would be possible to do this?

How to set the ACL?

In the SAMP is so easy, using Kick (playerid).

Posted
MTA is very complicated. I want to kick/disconnect player when he clicks a button.

It would be possible to do this?

How to set the ACL?

In the SAMP is so easy, using Kick (playerid).

Anyone?

Posted

1 - Go to your mta directory: C:\Program Files\MTA San Andreas 1.3

2 - Search a folder server/mods/deathmatch

3 - There is a file named acl.xml

4 - Open it with notepad, recomendated notepad++

5 - You will see a big list of codes, look at line 18, you will see a group called admin

5 - Add the username you was register before in your server, your login account, add it before user.

"user.hank"/> 

6 - The final have to look something like this :

"Admin"> 
      "Moderator"/> 
      "SuperModerator"/> 
      "Admin"/> 
      "RPC"/> 
      "resource.admin"/> 
      "resource.webadmin"/> 
      "user.hank"/> 

Only add the last line to the admin group, with all that you will have admin on your server, press "p" to open admin panel, commands are always enabled to used, i hope this work.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...