How to call a public callback?
#1

Hey i want to know how scripters call their made callback

Ex.

OnPlayerEnterWater - If player is in water this function is called

How can i call my public callback? I'm planning to create a include.
Reply
#2

Timer.
Reply
#3

No, i mean without timer, they don't use timer they just call it

Ex.

When i'm in water OnPlayerEnterWater is called but maybe, maybe they use one?
Reply
#4

SetTimer ; SetTimerEx
CallLocalFunction and CallRemoteFunction for mor einfo please visit some tutorials on samp wiki or forums

Edit:
for water part i guess they use IsPlayerInRangeOfPoint or something liek that and use in OnPlayerUpdate or a repeating timer callback ; and check the player if he is there it will call function either by a timer or calllocal / remote fucntion
Reply
#5

Without a timer

=

Make your callback a stock, and call it w/e you like.
Reply
#6

Thanks both of you but i cannot rep you for now i will say 'Thank you'
Reply
#7

It is not possible to have a callback be called without doing it yourself, IE setting a check in a timer or using Onplayerupdate
Reply
#8

theirs also
OnPlayerStateChange


and i think they check for water by checking the animations the player currently has,
Reply
#9

Hey one more question i'm creating a call back that checks something Ex.

pawn Код:
forward OnPlayerDancingAnim(playerid, animlib[], animname[])
public OnPlayerDancingAnim(playerid, animlib[], animname[])
{
     if(animlib == "DANCING")
     {
        if(animname == "dnce_M_a")
        {
             //codes
        }
     }
     return 1;
}
it give me error like

Код:
error 033: array must be indexed (variable "animlib")
error 033: array must be indexed (variable "animname")
and is it ok to call the public call back with CallRemoteFunction in OnPlayerUpdate by checking if player is playing an animation?
Reply
#10

Quote:
Originally Posted by Romel
Посмотреть сообщение
Hey one more question i'm creating a call back that checks something Ex.

pawn Код:
forward OnPlayerDancingAnim(playerid, animlib[], animname[])
public OnPlayerDancingAnim(playerid, animlib[], animname[])
{
     if(animlib == "DANCING")
     {
        if(animname == "dnce_M_a")
        {
             //codes
        }
     }
     return 1;
}
it give me error like

Код:
error 033: array must be indexed (variable "animlib")
error 033: array must be indexed (variable "animname")
and is it ok to call the public call back with CallRemoteFunction in OnPlayerUpdate by checking if player is playing an animation?
You can't compare strings using the == operator. You have to use strcmp (string compare) in order to compare strings.

Your final question: Yes, it is okay, however you should ensure that it is only called once.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)