Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <streamer>
- #include <foreach>
- #include <zcmd>
- new TaxiDuty[MAX_PLAYERS];
- new RTaxi[MAX_PLAYERS];
- new taxicashh[MAX_PLAYERS];
- new changed[MAX_PLAYERS];
- new ontaxitimr[MAX_PLAYERS];
- new DutyCashh[MAX_PLAYERS];
- CMD:calltaxi(playerid, params[])
- {
- new msg[143];
- if (IsPlayerFighting(playerid) && !AdminCheck(playerid, 2)) return SendClientMessage(playerid, ERRORCOLOR, "You must wait 15 seconds before teleporting after being shot or shooting someone.");
- if(Drivers == 0) return SendClientMessage(playerid, ERRORCOLOR, "no currently taxi drivers on town , please wait a little.");
- SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE);
- SetPlayerAttachedObject(playerid, 9, 330, 6);
- RTaxi[playerid] = 1;
- SetTimerEx("message1", 1200, false, "i", playerid);
- format(msg, sizeof(msg), "{FF3636}%s{FF3636} requested a taxi driver at his place", Name[playerid]);
- timingout = SetTimerEx("timedout", 15000, false, "i", playerid);
- foreach(new i : Character)
- {
- if(TaxiDuty[i] == 1) SendClientMessage(i, ERRORCOLOR, msg);
- }
- return 1;
- }
- CMD:cancelcall(playerid, params[])
- {
- new msg[56];
- RTaxi[playerid] = 0;
- KillTimer(timingout);
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
- RemovePlayerAttachedObject(playerid, 9);
- foreach(new i : Character)
- {
- if(TaxiDuty[i] == 1) format(msg, sizeof(msg)," %s has canceled his taxi drive request"); SendClientMessage(i, COLOR_YELLOW, msg);
- }
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- if (newstate == PLAYER_STATE_PASSENGER)
- {
- if(GetVehicleModel(vehicleid) == 420 || GetVehicleModel(vehicleid) == 438)
- {
- intaxitir[playerid] = true;
- ontaxitimr[playerid] = SetTimerEx("Gettincash", 60000, true, "i", playerid);
- }
- }
- if (intaxitir[playerid] && newstate != PLAYER_STATE_PASSENGER)
- {
- intaxitir[playerid] = false;
- KillTimer(ontaxitimr[playerid]);
- }
- if (newstate == PLAYER_STATE_DRIVER)
- {
- new msg5[125];
- if(GetVehicleModel(vehicleid) == 420 || GetVehicleModel(vehicleid) == 438)
- {
- format(msg5, sizeof(msg5), "%s is now a taxi driver", Name[playerid]);
- SendClientMessageToAll(0xFFFB26FF, msg5);
- TaxiDuty[playerid] = 1;
- Drivers += 1;
- DutyCashh[playerid] = SetTimerEx("DutyCash", 300000, true, "i", playerid);
- SendClientMessage(playerid, 0x6FF7E1FF, "Please change the taxi earning amount or you are counted as a free driver !. (via /taxicash)");
- pambocolor[playerid] = GetPlayerColor(playerid);
- SetPlayerColor(playerid, 0xFFFF00FF);
- }
- }
- if (TaxiDuty[playerid] == 1 && GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
- {
- format(msg, sizeof(msg), "%s is now off taxi duty{FFFF00}", Name[playerid]);
- SendClientMessageToAll(0xED2881FF, msg);
- Drivers -= 1;
- TaxiDuty[playerid] = 0;
- taxicashh[playerid] = 0;
- SetPlayerColor(playerid, pcolor[playerid]);
- KillTimer(DutyCashh[playerid]);
- }
- }
- forward DutyCash(playerid);
- public DutyCash(playerid)
- {
- GivePlayerMoney(playerid, 5000);
- SendClientMessage(playerid,0x6FF7E1FF, "You have taken 5000$ for being on taxi duty.");
- return 1;
- }
- forward Gettincash(playerid);
- public Gettincash(playerid)
- {
- new msg4[163];
- new vehicleid = GetPlayerVehicleID(playerid);
- new driverid = GetVehicleDriverID(vehicleid);
- GivePlayerMoney(driverid, taxicashh[driverid]);
- format(msg4 ,sizeof(msg4), "You are with the driver %s", Name[driverid]);
- SendClientMessage(playerid, ERRORCOLOR, msg4);
- format(msg4, sizeof(msg4), "You Have paid %d for the driver %s", taxicashh[driverid], Name[driverid]);
- SendClientMessage(driverid, ERRORCOLOR, msg4);
- SetPlayerMoney(playerid, GetPlayerMoney(playerid) - taxicashh[driverid]);
- format(msg4, sizeof(msg4), "You have taken %d for 1 min passed", taxicashh[driverid]);
- SendClientMessage(driverid, ERRORCOLOR, msg4);
- return 1;
- }
- CMD:taxicash(playerid, params[])
- {
- new money, str[57];
- if(changed[playerid] == 1) return SendClientMessage(playerid, ERRORCOLOR, "You may only change your taxi fare once every 10 seconds.");
- if(sscanf(params, "i", money)) return SendClientMessage(playerid, ERRORCOLOR, "Usage: /taxicash [amount]");
- if(money > 1000 || money < 500) return SendClientMessage(playerid, ERRORCOLOR, "Usage: /taxicash [500-1000]");
- taxicashh[playerid] = money;
- changed[playerid] = 1;
- format(str, sizeof(str), "%s has changed his taxi fare to %d", Name[playerid], money);
- SetTimerEx("changecooldown", 10000, false, "i", playerid);
- SendClientMessageToAll(0x195E00FF, str);
- return 1;
- }
- CMD:acceptdrive(playerid, params[])
- {
- new id, str[678];
- if(sscanf(params,"i", id)) return SendClientMessage(playerid, ERRORCOLOR, "Usage: /acceptdrive [playerid]");
- if(RTaxi[id] != 1) return SendClientMessage(playerid, ERRORCOLOR, "This player didn't request any taxi driver");
- if(!IsPlayerConnected(id)) return SendClientMessage(playerid, ERRORCOLOR, "invaild player");
- format(str, sizeof(str), "Taxi Driver %s: Alright sir, i got your location and i'll be there in a few mintues.", Name[playerid]);
- SendClientMessage(id, 0xFFFF00FF, str);
- SendClientMessage(playerid, 0xFFFF00FF, str);
- RTaxi[playerid] = 0;
- SetPlayerSpecialAction(id, SPECIAL_ACTION_STOPUSECELLPHONE);
- RemovePlayerAttachedObject(id, 9);
- KillTimer(timingout);
- return 1;
- }
- forward timedout(playerid);
- public timedout(playerid)
- {
- RTaxi[playerid] = 0;
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
- RemovePlayerAttachedObject(playerid, 9);
- SendClientMessage(playerid, 0xFF0084FF, "The signal had been timed out due to non-responde");
- return 1;
- }
- forward changecooldown(playerid);
- public changecooldown(playerid)
- {
- changed[playerid] = 0;
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement