SA-MP Forums Archive
Problems using the Dcallbacks.inc - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problems using the Dcallbacks.inc (/showthread.php?tid=48318)



Problems using the Dcallbacks.inc - Maniac_X - 24.08.2008

I'm trying to add more than one area in but am not sure if i'm placing the new code in the correct spot.

All the needed areas are defined in the script and symbols as well.

this is at the bottom of my .pwn script :

OnPlayerEnterArea(playerid,areaid)
{
if (areaid==OceanCity_Entry)
SendClientMessage(playerid, 0xFF7B7BAA, "Ocean");
SetPlayerPos(playerid, -2222.8391,1415.8199,-18.7510);
printf("OnPlayerEnterArea(%d,%d)",playerid,areaid) ;

if (areaid==OceanCity_Exit)
SendClientMessage(playerid, 0xFF7B7BAA, "Leaving Ocean");
SetPlayerPos(playerid, -2222.7556,1355.3188,7.5855);
printf("OnPlayerEnterArea(%d,%d)",playerid,areaid) ;
}

OnPlayerLeaveArea(playerid,areaid)
{
printf("OnPlayerLeaveArea(%d,%d)",playerid,areaid) ;
return 1;
}

** the last bit is just so i dont get the error for not giving definition to the OnPlayerLeaveArea symbol **


What is happening at the moment goes as follows :
Player enters Ocean_Enter area..
Player Spawns at the target location setup for the Ocean_Exit..
// so it is ignoring the first "SetPlayerPos" command and using the 2nd one instead.

however if i move my player into the 2nd area (Ocean_Exit) it also teleports the player to the 2nd setplayerpos location.

I know it does this cause i'm not seperating them properly perhaps .. i just don't know how to properly seperate each area in the code so they function independantly.

When i remove the Ocean_Exit area and related code from the script so there is just 1 area (Ocean_Enter) the ocean enter area works as scripted and the player reaches the intended target location upon entering the Ocean_Enter area.

p.s. i've tried to use "public", #define and "new" as different ways to define the symbols
OnPlayerEnterArea
OnPlayerLeaveArea
but as i'm sure you are aware that's just not possible.


any help would be greatly appreciated


Re: Problems using the Dcallbacks.inc - boelie - 07.07.2009

Damn why doesnt anyone answer you :S
I got almost same problem with making more Areas..it sipmly listens to just one..very weird but maybe you have the solution already ?




Re: Problems using the Dcallbacks.inc - Maniac_X - 29.09.2009

Quote:
Originally Posted by boelie
Damn why doesnt anyone answer you :S
I got almost same problem with making more Areas..it sipmly listens to just one..very weird but maybe you have the solution already ?

I did end up finding a solution, however my solution was that I instead used a different method for creating the areas which I found on another post here.. If you search for my posts based on this topic you'll find it .. unfortunately the raw code I was using has been destroyed when my hdd that I had it on died