[DCallbacks] New callbacks for your scripts! -
DracoBlue - 26.07.2006
Lots of guys asked for new callbacks. Most time the normal OnPlayerEnterCheckpoint & OnPlayerLeaveCheckpoint is enough, but when it comes to big and difficult scripts, its better to have OnPlayerEnterArea and such stuff.
DCallbacks:
o
Download (Version 1.1)
Features
o OnPlayerEnterArea(playerid,areaid)
o OnPlayerLeaveArea(playerid,areaid)
Who should download and use this?
Everyone who is to lazy to read and understand the
HowTo, I made
. You should have skills in coding pawn/c, since it only exports the functions - no command handling in - thats what you have to do!
How can I make this work?
Open your gamemode-pawnfile.
After #include <a_samp> add
#include <dcallbacks>
After public OnGameModeInit() { add
SetTimer("TIMER_DCallbacks",1000,true);
For a simple example, this is an implementation which shows a little "Welcome to the course" text as soon as somebody enters the golf course in LV, and a "Bye" if the person leaves the area.
After SetTimer("TIMER_DCallbacks",1000,true); add
AREA_golfcourse=AddAreaCheck(1145.0272,1412.8173,2 728.7505,2851.1440);
Before public OnGameModeInit() { add
new AREA_golfcourse; // Our golfcourse area
At the end of your gamemode-pawnfile this:
pawn Code:
OnPlayerEnterArea(playerid,areaid) {
if (areaid==AREA_golfcourse) SendClientMessage(playerid, 0xFF7B7BAA, "Welcome to the course");
printf("OnPlayerEnterArea(%d,%d)",playerid,areaid);
}
OnPlayerLeaveArea(playerid,areaid) {
if (areaid==AREA_golfcourse) SendClientMessage(playerid, 0xFF7B7BAA, "Bye.");
printf("OnPlayerLeaveArea(%d,%d)",playerid,areaid);
}
More Callbacks will come soon.
Thats just a small insight, hope it will be useful.
Regards,
Jan (DracoBlue)
Re: [DCallbacks] New callbacks for your scripts! -
Au{R}oN - 26.07.2006
Great work, as always.
Cant wait for the others.
Re: [DCallbacks] New callbacks for your scripts! -
Kfgus3 - 27.07.2006
this is great less copy & paste
good work
Re: [DCallbacks] New callbacks for your scripts! -
{XN}BigPaddy - 04.08.2006
My Server crashes when i use this where is the TIMER_DCallbacks function
Re: [DCallbacks] New callbacks for your scripts! -
[BDC]Scarface - 04.08.2006
Excellent Work Draco, needless to say "Keep up the good work!"
Regards
=BDC=Scarface
Re: [DCallbacks] New callbacks for your scripts! -
DeC.dual - 15.08.2006
Good job Draco... I changed your AddAreaCheck around a bit tho :P
AddAreaCheck(
Area_GOLFC,
1145.0272,1412.8173,2728.7505,2851.1440);
//
Just change the AddAreaCheck func to:
public AddAreaCheck(areaid,Float
_min,Float
_max,Float: y_min,Float:y_max) {
(It looks alot neater imo)
I hope you add more stuff to this!
Re: [DCallbacks] New callbacks for your scripts! -
DracoBlue - 25.08.2006
Updated to 1.0.1, thanks to Ice-T, who find the typo
.
Re: [DCallbacks] New callbacks for your scripts! -
[NR]Luke - 08.12.2006
I know this topic died a few months back, but I need to ask something related to this.
Is it possible to edit the dcallbacks.inc to have areas inside interiors, aswell as the outside interior??
Re: [DCallbacks] New callbacks for your scripts! -
DracoBlue - 08.12.2006
Dead is what isn't used. This is used - so no problem .
About the interior check: Yes this is possible.
Replace:
pawn Code:
public AddAreaCheck(Float:x_min,Float:x_max,Float:y_min,Float:y_max) {
AREACHECK_Coords[AREACHECK_Count][0]=x_min;
AREACHECK_Coords[AREACHECK_Count][1]=x_max;
AREACHECK_Coords[AREACHECK_Count][2]=y_min;
AREACHECK_Coords[AREACHECK_Count][3]=y_max;
AREACHECK_Count++;
return (AREACHECK_Count);
}
with
pawn Code:
public AddAreaCheck(Float:x_min,Float:x_max,Float:y_min,Float:y_max,Float:z_min,Float:z_max) {
AREACHECK_Coords[AREACHECK_Count][0]=x_min;
AREACHECK_Coords[AREACHECK_Count][1]=x_max;
AREACHECK_Coords[AREACHECK_Count][2]=y_min;
AREACHECK_Coords[AREACHECK_Count][3]=y_max;
AREACHECK_Coords[AREACHECK_Count][4]=z_min;
AREACHECK_Coords[AREACHECK_Count][5]=z_max;
AREACHECK_Count++;
return (AREACHECK_Count);
}
And of course
pawn Code:
new Float:AREACHECK_Coords[MAX_AREAS_TO_CHECK][4];
with
pawn Code:
new Float:AREACHECK_Coords[MAX_AREAS_TO_CHECK][6];
And the final thing, replace:
pawn Code:
(AREACHECK_Coords[z][0]<x)&&(AREACHECK_Coords[z][1]>x) &&
(AREACHECK_Coords[z][2]<y)&&(AREACHECK_Coords[z][3]>y)
with:
pawn Code:
(AREACHECK_Coords[z][0]<x)&&(AREACHECK_Coords[z][1]>x) &&
(AREACHECK_Coords[z][2]<y)&&(AREACHECK_Coords[z][3]>y) &&
(AREACHECK_Coords[z][4]<zcoord)&&(AREACHECK_Coords[z][5]>zcoord)
Kind regards,
Jan (DracoBlue)
PS: I didn't tested this source, but it should work without any problems, report if it doesn't
Re: [DCallbacks] New callbacks for your scripts! -
[NR]Luke - 08.12.2006
I have edited my dcallbacks.inc to have the changes you told me to do. Now i'll go test it and reply back here to say if it worked or not.