L2Tower Discord Let's keep the community alive with discord. Discussions about plugins and scripts L2Tower Discord

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with a script
Author Message
kaicer666 Offline
Gremlin
*

Posts: 5
Joined: Jul 2013
Reputation: 0
Version: 1.4.3.143
Post: #1
Help with a script

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
Find all posts by this user Quote this message in a reply
benbt91 Offline
VIP Member
***

Posts: 694
Joined: Mar 2012
Reputation: 47
Version: 1.4.3.143
Post: #2
RE: Help with a script

(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
01-31-2015 15:23 PM
Find all posts by this user Quote this message in a reply
Pelukis Offline
MaboX
**

Posts: 50
Joined: Oct 2014
Reputation: 21
Version: 1.4.2.138
Post: #3
RE: Help with a script

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
02-01-2015 11:05 AM
Find all posts by this user Quote this message in a reply
 Reputed by : kaicer666(+1)
kaicer666 Offline
Gremlin
*

Posts: 5
Joined: Jul 2013
Reputation: 0
Version: 1.4.3.143
Post: #4
RE: Help with a script

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?
(This post was last modified: 02-02-2015 09:28 AM by kaicer666.)
02-02-2015 08:57 AM
Find all posts by this user Quote this message in a reply
Pelukis Offline
MaboX
**

Posts: 50
Joined: Oct 2014
Reputation: 21
Version: 1.4.2.138
Post: #5
RE: Help with a script

maybe >> 0 <<

L2TowerHelp.exe for more info.. Smile

[Image: 2v307wo.png]
02-02-2015 10:03 AM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: