Command needed
#3

Havent tested it, but should work

pawn Код:
new PayTime[MAX_PLAYERS];
new InTaxi[MAX_PLAYERS];

public OnPlayerExitVehicle(playerid, vehicleid) {

  if(InTaxi[playerid] == 1) KillTimer(PayTime[playerid]);
  return 1;
}
   
public OnPlayerCommandText(playerid, cmdtext[]) {

  if(strcmp(cmdtext,"/counter",true) == 0) {
    new tmp[256], idx; tmp = strtok(cmdtext, idx);
    if(!strlen(tmp)) {
      new taxi = GetPlayerVehicleID(playerid);
      for(new i = 0; i < MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i) && IsPlayerInVehicle(i, taxi) && i != playerid) {
          PayTime[i] = SetTimerEx("Pay", 5000, 0, "ii", playerid, i);
          InTaxi[i] = 1;
        }
      }
    }
    else if(strcmp(tmp, "off", true) == 0) {
      new taxi = GetPlayerVehicleID(playerid);
      for(new i = 0; i < MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i) && IsPlayerInVehicle(i, taxi) && i != playerid) {
          KillTimer(PayTime[i]);
          InTaxi[i] = 0;
        }
      }
    }
    return 1;
  }
 
  return 0;
}

forward Pay(playerid, passenger);
public Pay(playerid, passenger) {

  if(GetPlayerMoney(passenger) >= 2) {
    GivePlayerMoney(passenger, -2);
    GivePlayerMoney(playerid, 2);
    PayTime[passenger] = SetTimerEx("Pay", 5000, 0, "ii", playerid, passenger);
  }else{
    RemovePlayerFromVehicle(passenger);
    SendClientMessage(playerid, WHITE, "You have been kicked from taxi..");
  }
}
You should also add InTaxi[playerid] = 0; OnPlayerConnect

Have fun
Reply


Messages In This Thread
Command needed - by [Sk]Noob - 21.07.2009, 22:05
Re: Command needed - by [Sk]Noob - 22.07.2009, 07:41
Re: Command needed - by M4S7ERMIND - 22.07.2009, 08:49
Re: Command needed - by [Sk]Noob - 22.07.2009, 08:57
Re: Command needed - by M4S7ERMIND - 22.07.2009, 09:00
Re: Command needed - by [Sk]Noob - 22.07.2009, 09:52
Re: Command needed - by Mowgli - 22.07.2009, 10:01
Re: Command needed - by [Sk]Noob - 22.07.2009, 10:25
Re: Command needed - by [Sk]Noob - 22.07.2009, 16:52

Forum Jump:


Users browsing this thread: 1 Guest(s)