Calling a callback by myself?
#1

So I found myself in a situation where calling a callback would be useful. The situation: when a player disconnects, if he's in a mini-game his partner should get a kill, so I could just call OnPlayerDeath.


My question is: is that good practice?

I believe I read somewhere that you should not do this... But it's just a function , so I'm not sure.
Reply
#2

I am not sure, if this will work but you can use function CallLocalFunction

Example, which you can try:

pawn Код:
//public OnPlayerDeath(playerid, killerid, reason)
CallLocalFunction("OnPlayerDeath", "ii", InsertHereYourArguments) //first i = playerid, second i = killerid, third i = ID of the reason
Reply
#3

No, I'm sure it will work.

But I just want to know if it's a good/common thing to do.
Reply
#4

It will work, yes. But AFAIK, it's not common practice - it is used but IMO, you should try to stay as non-interfering as possible with SA-MP callbacks. If it's that important, you can just use your own callback. If the problem is copying code over two times to two different callbacks, then the code is the problem - it should have been a function. (Up for a discussion)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)