Guest User

Look

a guest
Jan 23rd, 2016
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.64 KB | None | 0 0
  1. CMD:shopplate(playerid, params[])
  2. {
  3.     if(PlayerInfo[playerid][pShopTech] >= 1 || PlayerInfo[playerid][pAdmin] >= 4)
  4.     {
  5.         new iVehType, iVehIndex, iTargetOwner, carid, orderid, plate[32];
  6.         if(sscanf(params, "dds[32]", carid, orderid, plate))
  7.         {
  8.             SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /shopplate [carid] [orderid] [plate/remove]");
  9.             SendClientMessageEx(playerid, COLOR_GREY, "COLORS: (black/white/blue/red/green/purple/yellow/lightblue/navy/beige/darkgreen/darkblue/darkgrey/gold/brown/darkbrown/darkred");
  10.             SendClientMessageEx(playerid, COLOR_GREY, "/pink) USAGE: (red)Hi(white)how are you? NOTE: Each color counts for 8 characters");
  11.             return 1;
  12.         }
  13.  
  14.         foreach(new i: Player)
  15.         {
  16.             iVehIndex = GetPlayerVehicle(i, carid);
  17.             if(iVehIndex != -1)
  18.             {
  19.                 iVehType = 1;
  20.                 iTargetOwner = i;
  21.                 break;
  22.             }
  23.         }
  24.         if(iVehType == 1)
  25.         {
  26.             format(plate, sizeof(plate), "%s", str_replace("(black)", "{000000}", plate));
  27.             format(plate, sizeof(plate), "%s", str_replace("(white)", "{FFFFFF}", plate));
  28.             format(plate, sizeof(plate), "%s", str_replace("(blue)", "{0000FF}", plate));
  29.             format(plate, sizeof(plate), "%s", str_replace("(red)", "{FF0000}", plate));
  30.             format(plate, sizeof(plate), "%s", str_replace("(green)", "{008000}", plate));
  31.             format(plate, sizeof(plate), "%s", str_replace("(purple)", "{800080}", plate));
  32.             format(plate, sizeof(plate), "%s", str_replace("(yellow)", "{FFFF00}", plate));
  33.             format(plate, sizeof(plate), "%s", str_replace("(lightblue)", "{ADD8E6}", plate));
  34.             format(plate, sizeof(plate), "%s", str_replace("(navy)", "{000080}", plate));
  35.             format(plate, sizeof(plate), "%s", str_replace("(beige)", "{F5F5DC}", plate));
  36.             format(plate, sizeof(plate), "%s", str_replace("(darkgreen)", "{006400}", plate));
  37.             format(plate, sizeof(plate), "%s", str_replace("(darkblue)", "{00008B}", plate));
  38.             format(plate, sizeof(plate), "%s", str_replace("(darkgrey)", "{A9A9A9}", plate));
  39.             format(plate, sizeof(plate), "%s", str_replace("(gold)", "{FFD700}", plate));
  40.             format(plate, sizeof(plate), "%s", str_replace("(brown)", "{A52A2A}", plate));
  41.             format(plate, sizeof(plate), "%s", str_replace("(darkbrown)", "{5C4033}", plate));
  42.             format(plate, sizeof(plate), "%s", str_replace("(darkred)", "{8B0000}", plate));
  43.             format(plate, sizeof(plate), "%s", str_replace("(pink)", "{FF5B77}", plate));
  44.  
  45.             new string[128], Float:X, Float:Y, Float:Z;
  46.             GetVehiclePos(carid, X, Y, Z);
  47.             if(strcmp(plate, "remove", true) == 0)
  48.             {
  49.                 PlayerVehicleInfo[iTargetOwner][iVehIndex][pvPlate] = 0;
  50.             }
  51.             else
  52.             {
  53.                 format(PlayerVehicleInfo[iTargetOwner][iVehIndex][pvPlate], 32, "%s", plate);
  54.             }
  55.             SetVehicleToRespawn(carid);
  56.             SetVehiclePos(carid, X, Y, Z);
  57.             g_mysql_SaveVehicle(iTargetOwner, iVehIndex);
  58.  
  59.             format(string, sizeof(string), "Plate set on %s (ID: %d) %s (ID: %d)", GetPlayerNameEx(iTargetOwner), iTargetOwner, GetVehicleName(carid), carid);
  60.             SendClientMessage(playerid, COLOR_WHITE, string);
  61.             format(string, sizeof(string), "(OrderID: %d) Plate: %s", orderid, plate);
  62.             SendClientMessage(playerid, COLOR_WHITE, string);
  63.             format(string, sizeof(string), "%s set %s %s (Slot %d) plate to %s (order %d)", GetPlayerNameEx(playerid), GetPlayerNameEx(iTargetOwner), GetVehicleName(carid), iVehIndex, plate, orderid);
  64.             Log("logs/shoplog.log", string);
  65.         }
  66.         else
  67.         {
  68.             SendClientMessageEx(playerid, COLOR_GRAD1, "This is not a person owned vehicle, you cannot give it a custom plate.");
  69.         }
  70.     }
  71.     else
  72.     {
  73.         SendClientMessageEx(playerid, COLOR_GRAD1, "You are not authorized to use that command.");
  74.     }
  75.     return 1;
  76. }
Advertisement
Add Comment
Please, Sign In to add comment