24.08.2008, 03:47
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
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