Hello,i have a gf edit gamemode,so please,don't swear me. I want to create a new biz,in a parking. I've created a gate ,and when a player click's close to the gate,it will open.But i want to tanke some money from the player who wants to get in and to put them in the biz bank...and ideas? Thank you! |
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;
}
}
}
}