30.05.2014, 12:21
[I]Hey guys!
I've got a problem in OnPlayerKeyStateChange callback.
Hope you understood me.
+rep for helper
I've got a problem in OnPlayerKeyStateChange callback.
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if(newkeys == KEY_SECONDARY_ATTACK)
{
for(new i = 0; i <= MAX_BUSINESSES; i++) // now here's a loop through all businesses
{
if(IsPlayerInRangeOfPoint(playerid, 2.0, vInfo[i][exterior][0],vInfo[i][exterior][1],vInfo[i][exterior][2])) // and if player is in range of business entrance
{
if(vInfo[i][bought] == 0) SPMB(playerid, "Noredami pirkti versla rasykite~n~/pirktiversla [ID]");
SetPlayerPos(playerid, vInfo[i][interior][0],vInfo[i][interior][1],vInfo[i][interior][2]);
SetPlayerInterior(playerid, vInfo[i][inter]);
TogglePlayerControllable(playerid, false);
SetTimerEx("FreezeTimer", 2000, false, "i", playerid);
SetPlayerVirtualWorld(playerid, vInfo[i][ID]);
}
else if(IsPlayerInRangeOfPoint(playerid, 2.0, vInfo[i][interior][0],vInfo[i][interior][1],vInfo[i][interior][2])) // else if players is range of business exit
{
SetPlayerPos(playerid, vInfo[i][exterior][0],vInfo[i][exterior][1],vInfo[i][exterior][2]);
SetPlayerInterior(playerid, 0);
TogglePlayerControllable(playerid, false);
SetTimerEx("FreezeTimer", 2000, false, "i", playerid);
SetPlayerVirtualWorld(playerid, 0);
}
} // !!!!! and when I want to enter the hospital or exit the hospital system doesn't react to this code below and when i press enter nothing happens.
if(IsPlayerInRangeOfPoint(playerid, 2, 1590.9293,1762.1729,12.5320))
{
SetPlayerInterior(playerid, 3);
SetPlayerPos(playerid,-204.5060,-1736.0486,675.7687);
TogglePlayerControllable(playerid, false);
SetTimerEx("FreezeTimer", 2000, false, "i", playerid);
}
if(IsPlayerInRangeOfPoint(playerid, 2, -204.4959,-1735.3291,675.7687))
{
if(pInfo[playerid][gydos]) return SPMB(playerid, "~r~Kaip tu iseisi?~n~Tu juk gydaisi!");
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, 1590.9293,1762.1729,12.5320);
TogglePlayerControllable(playerid, false);
SetTimerEx("FreezeTimer", 2000, false, "i", playerid);
}
}
return 1;
[/i]
Hope you understood me.
+rep for helper