25.04.2012, 09:41
Код:
#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() }
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