daily pastebin goal
4%
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <streamer>
  2. #include <foreach>
  3. #include <zcmd>
  4. new TaxiDuty[MAX_PLAYERS];
  5. new RTaxi[MAX_PLAYERS];
  6. new taxicashh[MAX_PLAYERS];
  7. new changed[MAX_PLAYERS];
  8. new ontaxitimr[MAX_PLAYERS];
  9. new DutyCashh[MAX_PLAYERS];
  10. CMD:calltaxi(playerid, params[])
  11. {
  12.     new msg[143];
  13.     if (IsPlayerFighting(playerid) && !AdminCheck(playerid, 2)) return SendClientMessage(playerid, ERRORCOLOR, "You must wait 15 seconds before teleporting after being shot or shooting someone.");
  14.     if(Drivers == 0) return SendClientMessage(playerid, ERRORCOLOR, "no currently taxi drivers on town , please wait a little.");
  15.     SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE);
  16.     SetPlayerAttachedObject(playerid, 9, 330, 6);
  17.     RTaxi[playerid] = 1;
  18.     SetTimerEx("message1", 1200, false, "i", playerid);
  19.     format(msg, sizeof(msg), "{FF3636}%s{FF3636} requested a taxi driver at his place", Name[playerid]);
  20.     timingout = SetTimerEx("timedout", 15000, false, "i", playerid);
  21.     foreach(new i : Character)
  22.     {
  23.         if(TaxiDuty[i] == 1) SendClientMessage(i, ERRORCOLOR, msg);
  24.     }
  25.     return 1;
  26. }
  27. CMD:cancelcall(playerid, params[])
  28. {
  29.     new msg[56];
  30.     RTaxi[playerid] = 0;
  31.     KillTimer(timingout);
  32.     SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
  33.     RemovePlayerAttachedObject(playerid, 9);
  34.     foreach(new i : Character)
  35.     {
  36.         if(TaxiDuty[i] == 1) format(msg, sizeof(msg)," %s has canceled his taxi drive request"); SendClientMessage(i, COLOR_YELLOW, msg);
  37.     }
  38.     return 1;
  39. }
  40. public OnPlayerStateChange(playerid, newstate, oldstate)
  41. {
  42.     if (newstate == PLAYER_STATE_PASSENGER)
  43.     {
  44.         if(GetVehicleModel(vehicleid) == 420 || GetVehicleModel(vehicleid) == 438)
  45.         {
  46.             intaxitir[playerid] = true;
  47.             ontaxitimr[playerid] = SetTimerEx("Gettincash", 60000, true, "i", playerid);
  48.         }
  49.     }
  50.     if (intaxitir[playerid] && newstate != PLAYER_STATE_PASSENGER)
  51.     {
  52.         intaxitir[playerid] = false;
  53.         KillTimer(ontaxitimr[playerid]);
  54.     }
  55.     if (newstate == PLAYER_STATE_DRIVER)
  56.     {
  57.         new msg5[125];
  58.         if(GetVehicleModel(vehicleid) == 420 || GetVehicleModel(vehicleid) == 438)
  59.         {
  60.             format(msg5, sizeof(msg5), "%s is now a taxi driver", Name[playerid]);
  61.             SendClientMessageToAll(0xFFFB26FF, msg5);
  62.             TaxiDuty[playerid] = 1;
  63.             Drivers += 1;
  64.             DutyCashh[playerid] = SetTimerEx("DutyCash", 300000, true, "i", playerid);
  65.             SendClientMessage(playerid, 0x6FF7E1FF, "Please change the taxi earning amount or you are counted as a free driver !. (via /taxicash)");
  66.             pambocolor[playerid] = GetPlayerColor(playerid);
  67.             SetPlayerColor(playerid, 0xFFFF00FF);
  68.         }
  69.     }
  70.     if (TaxiDuty[playerid] == 1 && GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
  71.     {
  72.         format(msg, sizeof(msg), "%s is now off taxi duty{FFFF00}", Name[playerid]);
  73.         SendClientMessageToAll(0xED2881FF, msg);
  74.         Drivers -= 1;
  75.         TaxiDuty[playerid] = 0;
  76.         taxicashh[playerid] = 0;
  77.         SetPlayerColor(playerid, pcolor[playerid]);
  78.         KillTimer(DutyCashh[playerid]);
  79.     }
  80. }
  81. forward DutyCash(playerid);
  82. public DutyCash(playerid)
  83. {
  84.     GivePlayerMoney(playerid, 5000);
  85.     SendClientMessage(playerid,0x6FF7E1FF, "You have taken 5000$ for being on taxi duty.");
  86.     return 1;
  87. }
  88. forward Gettincash(playerid);
  89. public Gettincash(playerid)
  90. {
  91.     new msg4[163];
  92.     new vehicleid = GetPlayerVehicleID(playerid);
  93.     new driverid =  GetVehicleDriverID(vehicleid);
  94.     GivePlayerMoney(driverid, taxicashh[driverid]);
  95.     format(msg4 ,sizeof(msg4), "You are with the driver %s", Name[driverid]);
  96.     SendClientMessage(playerid, ERRORCOLOR, msg4);
  97.     format(msg4, sizeof(msg4), "You Have paid %d for the driver %s", taxicashh[driverid], Name[driverid]);
  98.     SendClientMessage(driverid, ERRORCOLOR, msg4);
  99.     SetPlayerMoney(playerid, GetPlayerMoney(playerid) - taxicashh[driverid]);
  100.     format(msg4, sizeof(msg4), "You have taken %d for 1 min passed", taxicashh[driverid]);
  101.     SendClientMessage(driverid, ERRORCOLOR, msg4);
  102.     return 1;
  103. }
  104. CMD:taxicash(playerid, params[])
  105. {
  106.     new money, str[57];
  107.     if(changed[playerid] == 1) return SendClientMessage(playerid, ERRORCOLOR, "You may only change your taxi fare once every 10 seconds.");
  108.     if(sscanf(params, "i", money)) return SendClientMessage(playerid, ERRORCOLOR, "Usage: /taxicash [amount]");
  109.     if(money > 1000 || money < 500) return SendClientMessage(playerid, ERRORCOLOR, "Usage: /taxicash [500-1000]");
  110.     taxicashh[playerid] = money;
  111.     changed[playerid] = 1;
  112.     format(str, sizeof(str), "%s has changed his taxi fare to %d", Name[playerid], money);
  113.     SetTimerEx("changecooldown", 10000, false, "i", playerid);
  114.     SendClientMessageToAll(0x195E00FF, str);
  115.     return 1;
  116. }
  117. CMD:acceptdrive(playerid, params[])
  118. {
  119.     new id, str[678];
  120.     if(sscanf(params,"i", id)) return SendClientMessage(playerid, ERRORCOLOR, "Usage: /acceptdrive [playerid]");
  121.     if(RTaxi[id] != 1) return SendClientMessage(playerid, ERRORCOLOR, "This player didn't request any taxi driver");
  122.     if(!IsPlayerConnected(id)) return SendClientMessage(playerid, ERRORCOLOR, "invaild player");
  123.     format(str, sizeof(str), "Taxi Driver %s: Alright sir, i got your location and i'll be there in a few mintues.", Name[playerid]);
  124.     SendClientMessage(id, 0xFFFF00FF, str);
  125.     SendClientMessage(playerid, 0xFFFF00FF, str);
  126.     RTaxi[playerid] = 0;
  127.     SetPlayerSpecialAction(id, SPECIAL_ACTION_STOPUSECELLPHONE);
  128.     RemovePlayerAttachedObject(id, 9);
  129.     KillTimer(timingout);
  130.     return 1;
  131. }
  132. forward timedout(playerid);
  133. public timedout(playerid)
  134. {
  135.     RTaxi[playerid] = 0;
  136.     SetPlayerSpecialAction(playerid, SPECIAL_ACTION_STOPUSECELLPHONE);
  137.     RemovePlayerAttachedObject(playerid, 9);
  138.     SendClientMessage(playerid, 0xFF0084FF, "The signal had been timed out due to non-responde");
  139.     return 1;
  140. }
  141. forward changecooldown(playerid);
  142. public changecooldown(playerid)
  143. {
  144.     changed[playerid] = 0;
  145.     return 1;
  146. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top