For everything NOT server specific support. Do NOT ask for connectivity help here! .
Moderator: Moderators
Unknown6996
Human
Posts: 24 Joined: 07 Oct 2011, 11:21
Noob?: No
#1
Post
by Unknown6996 » 07 Oct 2011, 21:02
I'am creating a Plugin to recognizes a player !
And as hook i use this :
Code: Select all
Plugins::addHook('player', \&onPlayer);
sub onPlayer {
Commands::run("pm $player Give me my money");
}
1;
How i do to recognizes the player ? In plugin,no macro.I Try :
Code: Select all
my (player) => $actor;
Commands::run ("pm $actor Give me my money);
Code: Select all
my ($player) = @_;
Commands::run ("pm $actor Give me my money);
Its very easy i put so :
Code: Select all
my ($player) = "Player Name";
Commands::run ("pm $actor Give me my money);
But no.I'm learning and don't want very easy
.
Understand my ask ? Thanks very much,thanks for attention and for your availability
1;
4epT
Developers
Posts: 627 Joined: 30 Apr 2008, 14:17
Noob?: No
Discord: ya4ept#8494
Location: Moskow (Russia)
#2
Post
by 4epT » 08 Oct 2011, 09:48
try:
Code: Select all
sub onPlayer {
my (undef, $args) = @_;
my $player = $args->{player};
Commands::run("pm $player Give me my money");
}
see
playerRecorder.pl
Unknown6996
Human
Posts: 24 Joined: 07 Oct 2011, 11:21
Noob?: No
#3
Post
by Unknown6996 » 08 Oct 2011, 10:39
Okay,but i have other problem.
With :
Code: Select all
sub onPlayer {
my (undef, $args) = @_;
my $player = $args->{player};
message "Exists a player : $player";
}
1;
All players are appeared as Unknown. (I Download openkore much times) Sorry for my English !
And with :
Code: Select all
sub onPlayer {
my (undef, $args) = @_;
my $player = $args->{player};
Commands::run("pm $player Give me my money");
}
1;
Appears:
Don't know what i do.I Had several tentatives,several.And some doesnt work !
I need Help ! Thanks for your attention and understanding!
Fr3DBr
Developers
Posts: 60 Joined: 05 Oct 2011, 09:21
Noob?: No
Location: Brazil
#4
Post
by Fr3DBr » 08 Oct 2011, 16:00
Unknown6996 wrote: Okay,but i have other problem...
Sup bro, i've figured out my doubts from the other forum ^____^, wasn't so hard considering took me just a few hours (i am a programmer)
.
4epT
Developers
Posts: 627 Joined: 30 Apr 2008, 14:17
Noob?: No
Discord: ya4ept#8494
Location: Moskow (Russia)
#5
Post
by 4epT » 09 Oct 2011, 15:11
Hook 'player' transfers only ID, but not NAME!!!
Use Hook 'charNameUpdate'
Unknown6996
Human
Posts: 24 Joined: 07 Oct 2011, 11:21
Noob?: No
#6
Post
by Unknown6996 » 09 Oct 2011, 17:39
Oh,Finally.Thanks very much boy.
But i have a new problem.The peoples have 2 name,example : Mario - Kart.
And the kore try pm him and appears (My english is very bad,i know) :
Player Mario is not online
How i resolve this ? And, How i add reputation for you ?
Thanks , very thanks !
Fr3DBr
Developers
Posts: 60 Joined: 05 Oct 2011, 09:21
Noob?: No
Location: Brazil
#7
Post
by Fr3DBr » 09 Oct 2011, 19:19
4epT wrote: Hook 'player' transfers only ID, but not NAME!!!
Use Hook 'charNameUpdate'
Altough charNameUpdate is very very slow, takes like ages to it recognize all the players around you, not sure why yet tho ?
4epT
Developers
Posts: 627 Joined: 30 Apr 2008, 14:17
Noob?: No
Discord: ya4ept#8494
Location: Moskow (Russia)
#8
Post
by 4epT » 10 Oct 2011, 16:28
need to use quotes
EternalHarvest
Developers
Posts: 1798 Joined: 05 Dec 2008, 05:42
Noob?: Yes
#9
Post
by EternalHarvest » 10 Oct 2011, 18:01
Unknown6996 wrote: And, How i add reputation for you ?
There's no dedicated "reputation" since it's unnecessary.
Fr3DBr wrote: Altough charNameUpdate is very very slow, takes like ages to it recognize all the players around you, not sure why yet tho ?
It's because character names are not sent with actor information and need to be requested (like when there may be no name in the client when you mouseover it for a first time); there are delays to prevent spamming the server, but you can reduce it in timeouts.
Unknown6996
Human
Posts: 24 Joined: 07 Oct 2011, 11:21
Noob?: No
#10
Post
by Unknown6996 » 11 Oct 2011, 00:12
When you say "need use quotes",i got it use "if" in sub onPlayer {,to especific when the player have two names,join two names,in format of one and pm from him ! ?
I Think
I'll stop here.I'm already giving work more.