• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[request] talkaction for kick.

GMNino

New Member
Joined
Jun 30, 2007
Messages
119
Reaction score
3
Hello!!

Need script for kick players of your accounts like !kick name.

requirements:

isPlayerPzLocked(cid) if players have pzlock say: "you cannot kick player pz locked",

getPlayerAccess(cid) if player is GM: say "you cannot kick any GM or GOD",

and this important..

getPlayerAccountId(cid) only can kick players of your account: say "sorry only can kick players of your account"

thanks.
 
Last edited:
It's for TFS 0.3 (not tested):

Code:
function onSay(cid, words, param)
    if(param == "") then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return TRUE
    end

    local pid = getPlayerByNameWildcard(param)
    if(pid == 0 or (isPlayerGhost(pid) == TRUE and getPlayerAccess(pid) > getPlayerAccess(cid))) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " is not currently online.")
        return TRUE
    end

    if(getPlayerAccess(pid) >= getPlayerAccess(cid)) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot kick this player.")
        return TRUE
    end

    if(getPlayerAccountId(cid) ~= getPlayerAccountId(pid)) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can only kick players of your account.")
        return TRUE
    end

    if(isPlayerPzLocked(pid) == TRUE) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot kick pz locked players.")
        return TRUE
    end

    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(pid) .. " has been kicked.")
    doRemoveCreature(pid)
    return TRUE
end
 
PHP:
function onSay(cid, words, param)
 player = getPlayerByName(param)
  if isPlayer(player)then
   if not(isPlayerPzLocked(player)) then
    if getPlayerAccess(cid) < 3 then
     if getPlayerAccountId(cid) == getPlayerAccountId(player)then
      doRemoveCreature(player)
      doPlayerSendCancel(cid, "Player Kicked succesfuly.") 
     else
      doPlayerSendCancel(cid, "sorry only can kick players of your account.")
     end
    else
     doPlayerSendCancel(cid, "you cannot kick any GM or GOD.")
    end
   else
    doPlayerSendCancel(cid, "you cannot kick player pz locked.")
   end
  else
   doPlayerSendCancel(cid, "This player is not online.")
  end
 return 1
end
easy for 0.2 : )
 
you try it(not tested):
Code:
function onSay(cid, words, param)
 player = getPlayerByName(param)
  if isPlayer(player)then
    if getPlayerAccess(cid) < 3 then
     if getPlayerAccountId(cid) == getPlayerAccountId(player)then
      doRemoveCreature(player)
      doPlayerSendCancel(cid, "Player Kicked succesfuly.") 
     else
      doPlayerSendCancel(cid, "sorry only can kick players of your account.")
     end
    else
     doPlayerSendCancel(cid, "you cannot kick any GM or GOD.")
    end
  else
   doPlayerSendCancel(cid, "This player is not online.")
  end
 return 1
end
 
ehh? it does exist o.o just check getPlayerCondition I guess xd

naooooooo is wrong. With condition you can only check if he is IN_FIGHT.

The isPzLocked() function is east to make for 0.2 :p

Take it from luascript.cpp & .h from TFS 0.3 and it should work :)
 
naooooooo is wrong. With condition you can only check if he is IN_FIGHT.

The isPzLocked() function is east to make for 0.2 :p

Take it from luascript.cpp & .h from TFS 0.3 and it should work :)

it like?:

luascript.cpp
Code:
			case PlayerInfoPzLock:
				value = player->isPzLocked();
				break;

luascript.h
Code:
		static int32_t luaIsPlayerPzLocked(lua_State* L);
 
Code:
function onSay(cid, words, param)
    if(param == "") then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return FALSE
    end

    local player = getPlayerByName(param)
    local self = getPlayerName(cid)
    if isPlayer(player) == FALSE then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " is not currently online.")
        return FALSE
    end

    if(getPlayerGroupId(player) > 1) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot kick this player.")
        return FALSE
    end

    if(getAccountNumberByPlayerName(param) ~= getAccountNumberByPlayerName(self)) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can only kick players of your account.")
        return FALSE
    end

    if (getCreatureCondition(player,CONDITION_INFIGHT) == TRUE) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot kick pz locked players.")
        return FALSE
    end

    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(player) .. " has been kicked.")
    doRemoveCreature(player)
    return FALSE
end

it checks for in battle, but imo its just as good as pz lock, it can always be changed to a different command tho

this works in 0.2 credits for the structure to nightmare
 
it like?:

luascript.cpp
Code:
			case PlayerInfoPzLock:
				value = player->isPzLocked();
				break;

luascript.h
Code:
		static int32_t luaIsPlayerPzLocked(lua_State* L);

the case PlayerInfoPzLock: is in the getplayerinfo function..you also need to add in luascript.cpp somewhere

Code:
int32_t LuaScriptInterface::luaIsPlayerPzLocked(lua_State* L)
{
	return internalGetPlayerInfo(L, PlayerInfoPzLock);
}

and then towards the top
Code:
	lua_register(m_luaState, "isPlayerPzLocked", LuaScriptInterface::luaIsPlayerPzLocked);

that is all along with what you already posted in your last post
 
Back
Top