[Include] a_state - Adds more callback checking change state!
#1

a_state - Adds more callback checking change state!


Introduction

This include adds more change state callback not only just OnPlayerKeyStateChange.
Not sure but, If you are using default fightstyle. The OnPlayerFStyleChangeState will return as "Old Style: x | New Style: 4". To call the StateChange callbacks you need to modify the following functions

Код:
SetPlayerFightingStyle
SetPlayerWantedLevel
SetPlayerTime
GivePlayerMoney
ResetPlayerMoney
SetPlayerPos
SetPlayerHealth
SetPlayerArmour
SetPlayerScore
SetPlayerDrunkLevel
SetPlayerSkin
SetPlayerName
Add Ex after the function name like

"SetPlayerTime" change it to "SetPlayerTimeEx"



Any changes in function?

Yes, 10% of the function has been modified.
Function name has been renamed added with Ex tag.
Function works the same. But this time. They call a public callback.

Like if you use SetPlayerPos. The "OnPlayerPositionStateChange" will be called.

Callbacks and It's explanation

Код:
OnPlayerFStyleStateChange(playerid, newstyle, oldstyle)
- Gets called when you set the players fighting style.
Callback: Integer

Код:
OnPlayerWLStateChange(playerid, newwl, oldwl)
- Gets called when you set the players wanted level.
Callback: Integer

Код:
OnPlayerTimeStateChange(playerid, newtime, oldtime, newtime2, oldtime2)
- Gets called when you set the players time.
Callback: Integer

Код:
OnPlayerMoneyStateChange(playerid, newcash, oldcash)
- Gets called when you give the player a cash or reset the players cash.
Callback: Integer

Код:
OnPlayerNameStateChange(playerid, newname[], oldname[])
- Gets called when you set the players name to newname.
Callback: String. This is the only callback who uses string.

Код:
OnPlayerSkinStateChange(playerid, newskin, oldskin)
- Gets called when you set the players skin.
Callback: Integer

Код:
OnPlayerDLStateChange(playerid, newdl, olddl)
- Gets called when you set players Drunk Level.
Callback: Integer

Код:
OnPlayerScoreStateChange(playerid, newscore, oldscore)
- Gets called when you set players Score.
Callback: Integer

Код:
OnPlayerHealthStateChange(playerid, Float:newhealth, Float:oldhealth)
- Gets called when you set players health.
Callback: Float

Код:
OnPlayerArmourStateChange(playerid, Float:newarmour, Float:oldarmour)
- Gets called when you set players armour.
Callback: Float

Код:
OnPlayerPositionStateChange(playerid, Float:newposX, Float:newposY, Float:newposZ, Float:oldposX, Float:oldposY, Float:oldposZ)
- Gets called when you set players pos.
Callback: Float

Examples:

pawn Код:
public OnPlayerFStyleStateChange(playerid, newstyle, oldstyle)
{
    new str[128];
    format(str, sizeof(str), "New Style: %i | Old Style: %i", newstyle, oldstyle);
    SendClientMessage(playerid, -1, str);
    return 1;
}

public OnPlayerNameStateChange(playerid, newname[], oldname[])
{
    new str[128];
    format(str, sizeof(str), " %s | %s", newname, oldname);
    SendClientMessage(playerid, -1, str);
    return 1;
}

public OnPlayerHealthStateChange(playerid, Float:newhealth, Float:oldhealth)
{
    new str[128];
    format(str, sizeof(str), " %f | %f", newhealth, oldhealth);
    SendClientMessage(playerid, -1, str);
    return 1;
}

public OnPlayerPositionStateChange(playerid, Float:newposX, Float:newposY, Float:newposZ, Float:oldposX, Float:oldposY, Float:oldposZ)
{
    new str[128];
    format(str, sizeof(str), " %f, %f, %f | %f, %f, %f", newposX, newposY, newposZ, oldposX, oldposY, oldposZ);
    SendClientMessage(playerid, -1, str);
    return 1;
}
Bugs

No bugs current found.

Notes

• The state callbacks only work when you use the function. They never get called if you don't use them.

Downloadlinks

Mirrors are not allowed.

Click me to download a_state.inc

How to install it

• Download a_state.inc ^^ link is in above.
• Put a_state.inc into your pawno/include
• Open your script
Put this

pawn Код:
#include <a_state>
• Now read the topic manual (http://forum.sa-mp.com/showthread.ph...19#post2282919)
• Have fun!
Reply
#2

This is pretty good, nice job. Would be more better if there's a define which enables/disables hooking the original functions.
Reply
#3

Quote:
Originally Posted by Lordz™
Посмотреть сообщение
This is pretty good, nice job. Would be more better if there's a define which enables/disables hooking the original functions.
NO it is NOT good.

@Romel: Give me one reason WHY I would use this?
Reply
#4

^^

I've test it.
And it's my opinion.
I've been bored that's why i create it.
Reply
#5

Nice, im a bad scripter but maybe you can make a user system with it.
Thanks for posting ,makes scripting kinda easyer
Reply
#6

Useful for anti-cheats.
Reply
#7

Quote:
Originally Posted by Gh05t_
Посмотреть сообщение
NO it is NOT good.
It becomes more better and easy for others. Also, it's up to the author of the script to decide whether he must or not do changes.

Quote:
Originally Posted by Gh05t_
Посмотреть сообщение
@Romel: Give me one reason WHY I would use this?
He ain't forcing you to use this. Get yourself some good reason to use this rather than posting shits.

@Romel, I suggest you to add 'OnPlayerVehicleChange' which gets called when a player switchs to another vehicle, it gets the old vehicleid and the newone. Once again, good work.
Reply
#8

Quote:
Originally Posted by Romel
Посмотреть сообщение
I've been bored that's why i create it.
Well I HIGHLY suggest you quit creating stuff if you're "bored".

Quote:
Originally Posted by Romel
Посмотреть сообщение
And it's my opinion.
Here's mine.

You decide to make stuff which makes no sense and provides no use to the community, ALL just to receive comments such as "good job" and "well done" just for your own self-gratification. You (and other members here) love the feeling of being praised for utterly useless code. I HIGHLY recommend you start looking at ACTUAL work and code that has purpose.

****** has written a VERY good read on his view of "thinkers" and "feelers" in the "how to reply a topic thread", i believe it GENERALLY applies to ALL written work/code and of course posts. READ IT.

EDIT:
Quote:
Originally Posted by Lordz
He ain't forcing you to use this. Get yourself some good reason to use this rather than posting shits.
Lordz, what I've said to Romel goes for you to.
Reply
#9

Quote:
Originally Posted by Gh05t_
Посмотреть сообщение
Well I HIGHLY suggest you quit creating stuff if you're "bored".



Here's mine.

You decide to make stuff which makes no sense and provides no use to the community, ALL just to receive comments such as "good job" and "well done" just for your own self-gratification. You (and other members here) love the feeling of being praised for utterly useless code. I HIGHLY recommend you start looking at ACTUAL work and code that has purpose.
No use to the community? Well I don't think so. You are just discouraging the user from coding something. It's actually lame. You said this include doesn't makes any sense, well it might not make any kind of sense to you but might to others. You ain't able to read others mind whether they do like it, want it or to use it. So just stop with your stupid posts, ignore if you don't feel it as useful or doesn't like it.
Reply
#10

Quote:
Originally Posted by Gh05t_
Посмотреть сообщение
Well I HIGHLY suggest you quit creating stuff if you're "bored".



Here's mine.

You decide to make stuff which makes no sense and provides no use to the community, ALL just to receive comments such as "good job" and "well done" just for your own self-gratification. You (and other members here) love the feeling of being praised for utterly useless code. I HIGHLY recommend you start looking at ACTUAL work and code that has purpose.

****** has written a VERY good read on his view of "thinkers" and "feelers" in the "how to reply a topic thread", i believe it GENERALLY applies to ALL written work/code and of course posts. READ IT.

EDIT:

Lordz, what I've said to Romel goes for you to.
You're asking questions all the time, Now I've a little question for you;

What is the reason of doing this? What is your goal,

Because, What you're doing won't help you, Won't help anyone, If you don't like it, Okay, But you actually don't stop, You're posting a message on my profile, Wich is kinda insulting, Why? What did I do to you?

Nothing, Right.

I would really appriciate it if you just leave this thread AND my, Lordz's or Romel's profile.

Thanks in advance.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)