toll (pay cash)
#3

Код:
#include <a_samp>
Код:
new port;
new timer[MAX_PLAYERS];
Код:
forward closeport();
Код:
public OnGameModeInit()
{
port = CreateObject(port_id, float_x, float_y, float_z, 0, 0, 0);
}
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/openport", cmdtext, true, 10) == 0)
{
if(IsPlayerInRangeOfPoint(playerid, distance, float_x, float_y, float_z)) // affect when the player is near
{
if(GetPlayerMoney(playerid) < 50) // check if the player has the money
{
SendClientMessage(playerid, 0xFFFFFFFF, "You dont have enough moneys");
}
else // if the player have the moneys execute the cmd
{
GivePlayerMoney(playerid, -50);  // this set the amount he need to pay to use it
MoveObject(port, float_x, float_y, float_z, speed);
SendClientMessage(playerid, 0xFFFFFFFF, "You paid $50 to open the port. Autoclose in 10 seconds");
timer[playerid] = SetTimerEx("closeport",10000,false,"i",playerid); // timer to autoclose the port
}
}
}
return 1;
}
Код:
public closeport()
{
MoveObject(port, float_x, float_y, float_z, speed); // set this to coordinates you got on OnGameModeInit()
}
this will create an automatic port on the defined float_x float_y and float_z, also it request 50$ to use the command.

i did it quickly so i didnt checked it, but i guess it will work, feel free anyone to fix me if i wrong anything.

cya
Reply


Messages In This Thread
toll (pay cash) - by kryptonice - 25.04.2012, 09:09
Re: toll (pay cash) - by MP2 - 25.04.2012, 09:13
Re: toll (pay cash) - by [swat]dragon - 25.04.2012, 09:41
Re: toll (pay cash) - by MP2 - 25.04.2012, 09:49
Re: toll (pay cash) - by [swat]dragon - 25.04.2012, 09:55
Re: toll (pay cash) - by kryptonice - 25.04.2012, 10:07
Re: toll (pay cash) - by MP2 - 25.04.2012, 10:07
Re: toll (pay cash) - by [swat]dragon - 25.04.2012, 10:12
Re: toll (pay cash) - by MP2 - 25.04.2012, 10:13
Re: toll (pay cash) - by [swat]dragon - 25.04.2012, 10:15

Forum Jump:


Users browsing this thread: 2 Guest(s)