Banks -
aa - 17.11.2012
I have 3 banks, i made enter/exit for each, but with different virtualworld.
When i go to second, or third bank and exit he teleports me to first.
Code:
Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if( newkeys == KEY_SECONDARY_ATTACK )
{
if(IsPlayerInRangeOfPoint( playerid, 3.0, 1481.0592,-1772.3126,18.7958 )) // Commerce
{
SetPlayerPos(playerid, 2305.3645,-16.3774,26.7496);
SetPlayerFacingAngle(playerid,270.4258);
return 1;
}
}
if(newkeys == KEY_SECONDARY_ATTACK )
{
if(IsPlayerInRangeOfPoint(playerid,3.0, 2305.3645,-16.3774,26.7496 )) // Commerce
{
SetPlayerPos(playerid, 1481.0592,-1772.3126,18.7958);
SetPlayerFacingAngle(playerid,357.4608);
return 1;
}
}
if( newkeys == KEY_SECONDARY_ATTACK )
{
if(IsPlayerInRangeOfPoint( playerid, 3.0, 1459.5172,-1009.9211,26.8438 )) // Downtown
{
SetPlayerPos(playerid, 2305.3645,-16.3774,26.7495);
SetPlayerVirtualWorld(playerid, 1);
SetPlayerFacingAngle(playerid,270.4258);
return 1;
}
}
if(newkeys == KEY_SECONDARY_ATTACK )
{
if(IsPlayerInRangeOfPoint(playerid,3.0, 2305.3645,-16.3774,26.7495 )) // Downtown
{
SetPlayerPos(playerid, 1459.5172,-1009.9211,26.8438);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerFacingAngle(playerid,179.1760);
return 1;
}
}
if( newkeys == KEY_SECONDARY_ATTACK )
{
if(IsPlayerInRangeOfPoint( playerid, 3.0, 593.6159,-1250.9601,18.2534 )) // Richman
{
SetPlayerPos(playerid, 2305.3645,-16.3774,26.7494);
SetPlayerVirtualWorld(playerid, 2);
SetPlayerFacingAngle(playerid,270.4258);
return 1;
}
}
if(newkeys == KEY_SECONDARY_ATTACK )
{
if(IsPlayerInRangeOfPoint(playerid,3.0, 2305.3645,-16.3774,26.7494 )) // Richman
{
SetPlayerPos(playerid, 593.6159,-1250.9601,18.2534);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerFacingAngle(playerid,179.1760);
return 1;
}
}
return 1;
}
Re: Banks -
zDivine - 17.11.2012
Try this:
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_SECONDARY_ATTACK)
{
if(IsPlayerInRangeOfPoint( playerid, 3.0, 1481.0592,-1772.3126,18.7958 )) // Commerce
{
SetPlayerPos(playerid, 2305.3645,-16.3774,26.7496);
SetPlayerFacingAngle(playerid,270.4258);
return 1;
}
else if(IsPlayerInRangeOfPoint(playerid,3.0, 2305.3645,-16.3774,26.7496 )) // Commerce
{
SetPlayerPos(playerid, 1481.0592,-1772.3126,18.7958);
SetPlayerFacingAngle(playerid,357.4608);
return 1;
}
else if(IsPlayerInRangeOfPoint( playerid, 3.0, 1459.5172,-1009.9211,26.8438 )) // Downtown
{
SetPlayerPos(playerid, 2305.3645,-16.3774,26.7495);
SetPlayerVirtualWorld(playerid, 1);
SetPlayerFacingAngle(playerid,270.4258);
return 1;
}
else if(IsPlayerInRangeOfPoint(playerid,3.0, 2305.3645,-16.3774,26.7495 )) // Downtown
{
if(GetPlayerVirtualWorld(playerid) == 1)
{
SetPlayerPos(playerid, 1459.5172,-1009.9211,26.8438);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerFacingAngle(playerid,179.1760);
return 1;
}
}
else if(IsPlayerInRangeOfPoint( playerid, 3.0, 593.6159,-1250.9601,18.2534 )) // Richman
{
SetPlayerPos(playerid, 2305.3645,-16.3774,26.7494);
SetPlayerVirtualWorld(playerid, 2);
SetPlayerFacingAngle(playerid,270.4258);
return 1;
}
else if(IsPlayerInRangeOfPoint(playerid,3.0, 2305.3645,-16.3774,26.7494 )) // Richman
{
if(GetPlayerVirtualWorld(playerid) == 2)
{
SetPlayerPos(playerid, 593.6159,-1250.9601,18.2534);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerFacingAngle(playerid,179.1760);
return 1;
}
}
}
return 1;
Re: Banks -
aa - 17.11.2012
Nothing :S same as before
Re: Banks -
zDivine - 17.11.2012
Create a variable at the top of your script:
Then instead of using virtual worlds, use that variable, and set it to 0 for first bank, 1 for second bank, and 2 for first bank.
Then when you detect if they are at bank 0, 1, or 2, instead of using 'GetPlayerVirtualWorld', use 'if(BankID[playerid] = ID_HERE)'
Re: Banks -
aa - 17.11.2012
Got it working, thanks