[HELP]Make GetTriggerPlayer Work

General talk about editing, cheating, and deprotecting maps.

Moderator: Cheaters

zUsername
Forum Addict
Posts: 407
Joined: February 25th, 2011, 3:16 am
Location: Unknown

[HELP]Make GetTriggerPlayer Work

Post by zUsername »

Can anyone help me to find the way to make TriggerRegisterTimerEventPeriodic can be use with GetTriggerPlayer ?
Edit: One more thing, help me make a trigger or jass, when I type "-clear" it's will be clear text messages every seconds ( for triggerplayer ), and I type "-clearoff" it's will be normal again. ( for triggerplayer ).
Thanks you.
User avatar
haxorico
Super Moderator
Posts: 3196
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND
Been thanked: 1 time

Re: [HELP]Make GetTriggerPlayer Work

Post by haxorico »

I can give a code when I get home..
Can you post the natives in here? So ill see what parameters are needed for each native.
Also. Keep in mind that the cleae command will not work for the chat.
Image
Spoiler:
(02:24:09)

Code: Select all

ChatBot: FatherSpace logs into the Chat.
(02:24:28) Lanaya: Gtfo ken.
(02:24:33) ChatBot: FatherSpace logs out of the Chat.
(02:24:40) Lanaya: Thought so. bitch.
(02:24:44) ChatBot: FatherSpace logs into the Chat.
(02:24:48) FatherSpace: Can I come back yet?
(02:24:51) Lanaya: What'd i say earlier.
(02:24:51) Lanaya: No.
(02:24:58) FatherSpace: Let's try this...
(02:25:01) ChatBot: Lanaya has been logged out (Kicked).

Code: Select all


(14:33:51) 2Pac: Do you know what'S so funny?
(14:34:01) Lanaya: No, please show me.
(14:34:07) 2Pac: This.
(14:34:09) ChatBot: Lanaya has been logged out (Kicked).
(14:34:10) 2Pac: 

Code: Select all

(14:35:59) haxorico: No one will belive me if I say "I got this song from 2pac on MSN" lolz ^^
(14:36:02) Lanaya: lolz.
(14:36:16) 2Pac: I AIN'T DEAD FFS.
(14:36:26) 2Pac: I'm a living legend, y'now.
(14:37:17) haxorico: why is 2Pac a legend?
(14:37:28) Lanaya: He's the worse rapper evar.

Code: Select all

(15:42:51) Lanaya: can i suck , . . .

Code: Select all

(13:55:21) ChatBot: 2Pac rolls 1d100 and gets 1.
(13:55:21) ChatBot: haxorico rolls 1d2 and gets 2.
(13:55:27) haxorico: owned?

Code: Select all

GeorgeMots: xplain what happens in SP. Why cant you save?
dast.-:i need play with 2 players

Code: Select all

(21:53:08) (673237): plzplzplz, im sorry about before.
(21:53:26) FatherSpace: I'm sorry you were born.
(21:53:31) ChatBot: (673237) has been logged out (Kicked).

Code: Select all

(10:08:02) Bartimaeus: you do know run I youtube channel for my favorite music, right?
zUsername
Forum Addict
Posts: 407
Joined: February 25th, 2011, 3:16 am
Location: Unknown

Re: [HELP]Make GetTriggerPlayer Work

Post by zUsername »

Ok here my code
Spoiler:
globals
integer array udg_Check
trigger gg_trg_Untitled_Trigger_002 = null
trigger gg_trg_Untitled_Trigger_003 = null
trigger gg_trg_Untitled_Trigger_004 = null
endglobals
function Trig_Untitled_Trigger_002_Conditions takes nothing returns boolean
if ( not ( udg_Check[GetConvertedPlayerId(GetTriggerPlayer())] == 1 ) ) then
return false
endif
return true
endfunction

function Trig_Untitled_Trigger_002_Actions takes nothing returns nothing
call ClearTextMessagesBJ( GetForceOfPlayer(ConvertedPlayer(udg_Check[GetConvertedPlayerId(GetTriggerPlayer())])) )
endfunction

function InitTrig_Untitled_Trigger_002 takes nothing returns nothing
set gg_trg_Untitled_Trigger_002 = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Untitled_Trigger_002, 1.00 )
call TriggerAddCondition( gg_trg_Untitled_Trigger_002, Condition( function Trig_Untitled_Trigger_002_Conditions ) )
call TriggerAddAction( gg_trg_Untitled_Trigger_002, function Trig_Untitled_Trigger_002_Actions )
endfunction

function Trig_Untitled_Trigger_003_Actions takes nothing returns nothing
set udg_Check[GetConvertedPlayerId(GetTriggerPlayer())] = 1
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_003 takes nothing returns nothing
local integer zzz
set gg_trg_Untitled_Trigger_003 = CreateTrigger( )
set zzz=0
loop
exitwhen zzz>11
call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_003, Player(zzz), "-clear", true )
set zzz=zzz+1
endloop
call TriggerAddAction( gg_trg_Untitled_Trigger_003, function Trig_Untitled_Trigger_003_Actions )
endfunction

function Trig_Untitled_Trigger_004_Actions takes nothing returns nothing
set udg_Check[GetConvertedPlayerId(GetTriggerPlayer())] = 0
endfunction

function InitTrig_Untitled_Trigger_004 takes nothing returns nothing
local integer zzz
set gg_trg_Untitled_Trigger_004 = CreateTrigger( )
set zzz=0
loop
exitwhen zzz>11
call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_004, Player(zzz), "-clearoff", true )
set zzz=zzz+1
endloop
call TriggerAddAction( gg_trg_Untitled_Trigger_004, function Trig_Untitled_Trigger_004_Actions )
endfunction

function main takes nothing returns nothing
call InitTrig_Untitled_Trigger_002( )
call InitTrig_Untitled_Trigger_003( )
call InitTrig_Untitled_Trigger_004( )
endfunction
I don't know why it's don't work , I'm already tried if GetLocalPlayer()==GetTriggerPlayer() but still not work, so I make this code, but only work for player red, other players can't use.
Last edited by zUsername on June 6th, 2013, 5:38 pm, edited 1 time in total.
User avatar
haxorico
Super Moderator
Posts: 3196
Joined: February 24th, 2009, 1:31 pm
Location: JEW LAND
Been thanked: 1 time

Re: [HELP]Make GetTriggerPlayer Work

Post by haxorico »

Those aren't the natives. But I found them on my own.
Ill reply with a code but it will take some time as I code it own my mobile.
Image
Spoiler:
(02:24:09)

Code: Select all

ChatBot: FatherSpace logs into the Chat.
(02:24:28) Lanaya: Gtfo ken.
(02:24:33) ChatBot: FatherSpace logs out of the Chat.
(02:24:40) Lanaya: Thought so. bitch.
(02:24:44) ChatBot: FatherSpace logs into the Chat.
(02:24:48) FatherSpace: Can I come back yet?
(02:24:51) Lanaya: What'd i say earlier.
(02:24:51) Lanaya: No.
(02:24:58) FatherSpace: Let's try this...
(02:25:01) ChatBot: Lanaya has been logged out (Kicked).

Code: Select all


(14:33:51) 2Pac: Do you know what'S so funny?
(14:34:01) Lanaya: No, please show me.
(14:34:07) 2Pac: This.
(14:34:09) ChatBot: Lanaya has been logged out (Kicked).
(14:34:10) 2Pac: 

Code: Select all

(14:35:59) haxorico: No one will belive me if I say "I got this song from 2pac on MSN" lolz ^^
(14:36:02) Lanaya: lolz.
(14:36:16) 2Pac: I AIN'T DEAD FFS.
(14:36:26) 2Pac: I'm a living legend, y'now.
(14:37:17) haxorico: why is 2Pac a legend?
(14:37:28) Lanaya: He's the worse rapper evar.

Code: Select all

(15:42:51) Lanaya: can i suck , . . .

Code: Select all

(13:55:21) ChatBot: 2Pac rolls 1d100 and gets 1.
(13:55:21) ChatBot: haxorico rolls 1d2 and gets 2.
(13:55:27) haxorico: owned?

Code: Select all

GeorgeMots: xplain what happens in SP. Why cant you save?
dast.-:i need play with 2 players

Code: Select all

(21:53:08) (673237): plzplzplz, im sorry about before.
(21:53:26) FatherSpace: I'm sorry you were born.
(21:53:31) ChatBot: (673237) has been logged out (Kicked).

Code: Select all

(10:08:02) Bartimaeus: you do know run I youtube channel for my favorite music, right?
zUsername
Forum Addict
Posts: 407
Joined: February 25th, 2011, 3:16 am
Location: Unknown

Re: [HELP]Make GetTriggerPlayer Work

Post by zUsername »

Ok I'm waiting for you. thanks .
User avatar
KangTooJee
Old Wrinkly Member
Posts: 202
Joined: September 15th, 2010, 5:09 am
Title: Legenda

Re: [HELP]Make GetTriggerPlayer Work

Post by KangTooJee »

change call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_003, Player(0), "-clear", true ) become call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_003, Player(zzz), "-clear", true )
zUsername
Forum Addict
Posts: 407
Joined: February 25th, 2011, 3:16 am
Location: Unknown

Re: [HELP]Make GetTriggerPlayer Work

Post by zUsername »

KangTooJee wrote:change call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_003, Player(0), "-clear", true ) become call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_003, Player(zzz), "-clear", true )
still not work Kang. Only work for red player. The other not work.
User avatar
Fukki
Old Wrinkly Member
Posts: 226
Joined: April 19th, 2010, 1:48 pm
Location: In The World

Re: [HELP]Make GetTriggerPlayer Work

Post by Fukki »

EDIT: Remove...it not work
Last edited by Fukki on June 8th, 2013, 12:15 pm, edited 2 times in total.
Image
zUsername
Forum Addict
Posts: 407
Joined: February 25th, 2011, 3:16 am
Location: Unknown

Re: [HELP]Make GetTriggerPlayer Work

Post by zUsername »

Thanks Fukki, but ur code not work. When I type -clear or clearoff nothing happen.
User avatar
Fukki
Old Wrinkly Member
Posts: 226
Joined: April 19th, 2010, 1:48 pm
Location: In The World

Re: [HELP]Make GetTriggerPlayer Work

Post by Fukki »

write in 3 minute ...
this code has been tested

Code: Select all

globals
hashtable HASH_MessagesClear=InitHashtable()
real AutoMessagesClear_Timer=1.
endglobals

function GetTimer_MessagesClear takes integer Clear_Int1 returns timer
local timer Clear_Timer=CreateTimer()
local integer Clear_Int2=GetHandleId(Clear_Timer)
call SaveInteger(HASH_MessagesClear,0,Clear_Int2,Clear_Int1)
call SaveBoolean(HASH_MessagesClear,0,Clear_Int1,true)
return Clear_Timer
endfunction

function Auto_ClearMessages takes nothing returns nothing
local timer Clear_Timer=GetExpiredTimer()
local integer Clear_Int1=GetHandleId(Clear_Timer)
local integer Clear_Int2=LoadInteger(HASH_MessagesClear,0,Clear_Int1)
if LoadBoolean(HASH_MessagesClear,0,Clear_Int2)then
if GetLocalPlayer()==Player(Clear_Int2)then
call ClearTextMessages()
endif
else
call DestroyTimer(Clear_Timer)
endif
set Clear_Timer=null
set Clear_Int1=0
set Clear_Int2=0
endfunction

function MessagesClear_Enable takes nothing returns nothing
local player Clear_Player=GetTriggerPlayer()
local integer Clear_Int1=GetPlayerId(Clear_Player)
if not LoadBoolean(HASH_MessagesClear,0,Clear_Int1)then
call TimerStart(GetTimer_MessagesClear(Clear_Int1),AutoMessagesClear_Timer,true,function Auto_ClearMessages)
endif
set Clear_Player=null
set Clear_Int1=0
endfunction

function MessagesClear_Disable takes nothing returns nothing
local player Clear_Player=GetTriggerPlayer()
local integer Clear_Int1=GetPlayerId(Clear_Player)
call SaveBoolean(HASH_MessagesClear,0,Clear_Int1,false)
set Clear_Player=null
set Clear_Int1=0
endfunction

function AutoClearMessages_Install takes nothing returns nothing
local trigger Clear_Trigger1=CreateTrigger()
local trigger Clear_Trigger2=CreateTrigger()
local integer Loop_Player=0
call TriggerAddAction(Clear_Trigger1,function MessagesClear_Enable)
call TriggerAddAction(Clear_Trigger2,function MessagesClear_Disable)
loop
call TriggerRegisterPlayerChatEvent(Clear_Trigger1,Player(Loop_Player),"-clear",true)
call TriggerRegisterPlayerChatEvent(Clear_Trigger2,Player(Loop_Player),"-clearoff",true)
exitwhen Loop_Player>10
set Loop_Player=Loop_Player+1
endloop
endfunction
Image