Lineage 2 Tower Forum

Full Version: Help with a script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
some knows what is wrong?????(im new on this)

function Chat(chatType, nick, msg)
if ((chatType == 1) or (chatType == 2) or (chatType == 6) or (chatType == 7)) then
ShowToClient("Alarm","Someone may just petitioned you.");
PlaySound(GetDir() .. "alarm.wav");
Command("/useshortcut 10 1"); --> this is a macro
end;
end;
(01-31-2015 13:21 PM)kaicer666 Wrote: [ -> ]some knows what is wrong?????(im new on this)

function Chat(chatType, nick, msg)
if ((chatType == 1) or (chatType == 2) or (chatType == 6) or (chatType == 7)) then
ShowToClient("Alarm","Someone may just petitioned you.");
PlaySound(GetDir() .. "alarm.wav");
Command("/useshortcut 10 1"); --> this is a macro
end;
end;
need vip for it Smile
no need VIP..

    LUA Programming
AlarmStatus = false;
 
function OnCreate()
	this:RegisterCommand("alarm", CommandChatType.CHAT_ALLY, CommandAccessLevel.ACCESS_ME );
end;
 
function OnCommand_alarm(vCommandChatType, vNick, vCommandParam)
	AlarmStatus = not AlarmStatus;
 	local state = AlarmStatus and "Activated" or "Deactivated";
 	ShowToClient( "Alarm Status", "Is " .. state );
end;
 
function OnChatUserMessage(chatType, nick, msg)
	if ((chatType == 1) or (chatType == 2) or (chatType == 6) or (chatType == 7)) and AlarmStatus then 
		PlaySound(GetDir() .. "alarm.wav");
		ShowToClient("Alarm","Someone may just petitioned you.");
		Command("/useshortcut 10 1"); --> this is a macro
	end;
end;



this is plugin save as filename.lua and save to l2tower "plugin" folder
copy file "alarm.wav" on root folder of L2tower
thx a lot, i fixed yesterday xD and its pretty the same code.. this is

Code:
alarm = false;

function OnCreate()
    this:RegisterCommand("alarm", CommandChatType.CHAT_ALLY, CommandAccessLevel.ACCESS_ME);
end;

function OnCommand_alarm(vCommandChatType, vNick, vCommandParam)
    
    if (alarm == false) then
alarm = true;
ShowToClient("Alarm","Alarma Activada");
    else
alarm = false;
ShowToClient("Alarm","Alarma Desactivada");    
    end;
    
end;


function OnChatUserMessage(chatType, nick, msg)
    if (((chatType == 2) or (chatType == 6) or (chatType == 7))) then
ShowToClient("Alarm","Someone may just petitioned you.");
PlaySound(GetDir() .. "alarm.wav");
Command("#Urrakataca!");
end;
end;

function OnLTick1s()
if (GetMe():IsAlikeDeath() == false ) then
    
playerlist = GetPlayerList();
playerid = nil;

for player in playerlist.list do
    
if (player:IsMyPartyMember() == false) and (player:IsEnemy()) and (player:GetReputation() < 0) and (player:GetDistance() < 1600) and (player:IsFriend() == false) and (player:IsAlikeDeath() == false) then
playertarget = GetUserById(player:GetTarget());
if (playertarget ~= nil) then
if (playertarget:IsMyPartyMember()) or (playertarget:IsMe()) then
playerid = player:GetId();
name=player:GetName();
end;
end;
end;
    
if (player:IsMyPartyMember() == false) and (player:IsPvPFlag()) and not (player:IsPvPFlagBlink()) and (player:GetDistance() < 1600) and (player:IsAlikeDeath() == false) then --and (player:IsFriend() == false) and (player:IsEnemy())
playertarget = GetUserById(player:GetTarget());
if (playertarget ~= nil) then
if (playertarget:IsMyPartyMember()) or (playertarget:IsMe()) then
playerid = player:GetId();
name=player:GetName();
end;
end;
end;
    
end;

    end;
    
    if ( playerid ~= nil and GetMe():IsAlikeDeath() == false ) then

PlaySound(GetDir() .. "alarm.wav");

ShowToClient("Alarm"," - " .. tostring(name) .. " attacked you!!");


end;

end;

and the last question: what is ChatType for general chat i mean white chat?
maybe >> 0 <<

L2TowerHelp.exe for more info.. Smile

[Image: 2v307wo.png]
Reference URL's