Make Characters Talk

Go down

Make Characters Talk

Post  Admin on Sun Oct 23, 2011 8:28 pm

function LocalChat(role,target,text)
local pkt = GetPacket()
local tid = GetCharID( target )
WriteCmd( pkt, 501 );
WriteDword( pkt, tid );
WriteString( pkt, text);
SendPacket( role, pkt );
end

function Say(character,text)
local map_copy = GetChaMapCopy ( character )
local ply_num = GetMapCopyPlayerNum(map_copy)
local ps={}
local i = 1

BeginGetMapCopyPlayerCha ( map_copy )
for i = 1 ,ply_num , 1 do
ps[i]=GetMapCopyNextPlayerCha ( map_copy )
end

for i=1,ply_num,1 do
if(ps[i]~=0 and ps[i]~=nil)then
LocalChat( ps[i], character, text )
end
end
end



I hope you can learn from this code Wink

it makes the Character talk to all characters around without any need of storing some info in some variables Wink

Usage:
Say(character,"Hallo World")
avatar
Admin
Admin

Posts : 23
Join date : 2011-10-23

View user profile http://bloodyserverguide.forumotion.com

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum