14.02.2012, 12:38
This is just an example of how I do it. Of course you would fill in everything with your server information. This is untested.
pawn Код:
new IsGateOpen = 0;
public OnPlayerKeyStateChange(playerid ,newkeys, oldkeys)
{
if(newkeys == KEY_FIRE)
{
if(IsPlayerInRangeOfPoint(playerid,x,y,z)) //gate coordinates go here.
{
if(GetPlayerMoney(playerid) > 100) //Checks if player has 100 at least.
{
GivePlayerMoney(playerid, -100); //This takes away 100 dollars from the player who opens the gate.
BizzMoney = BizzMoney + 100 //Don't use this variable. Just an example. But this gives the business the money.
if(IsGateOpen == 0)
{
MoveObject(objectid,x,y,z)//Moves Object
IsGateOpen = 1;
{
else if(IsGateOpen == 1)
{
MoveObject(objectid,x,y,z)//Moves Object back to original position.
IsGateOpen = 0;
return 1;
}
else if(GetPlayerMoney(playerid) < 100)
{
SendClientMessage(playerid,COLOR_GREY,"You do not have enough money to pay the toll.");
return 1;
}
}
}
}