Advertisement
CddNovaRP

[Include] All Item Finder

Jun 23rd, 2012
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 23.18 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3. #include <sscanf>
  4.  
  5. #define MAX_LABELS 999
  6.  
  7. new Pickups, Labels;
  8.  
  9. enum
  10. {
  11.     iNone,
  12.     iObjeto,
  13.     iPickup,
  14.     iLabel,
  15.     iVehicle
  16. }
  17.  
  18. enum pInfo
  19. {
  20.     Float:pX,
  21.     Float:pY,
  22.     Float:pZ,
  23.     pType,
  24.     bool:pCriado,
  25.     pModel,
  26.     pVirtual
  27. }
  28. enum lInfo
  29. {
  30.     Float:lX,
  31.     Float:lY,
  32.     Float:lZ,
  33.     lText[128],
  34.     bool:lCriado,
  35.     Text3D:lLabel,
  36.     lColor,
  37.     lVirtual,
  38.     Float:lDrawDistance
  39. }
  40.  
  41. new PickupInfo[MAX_PICKUPS][pInfo], LabelInfo[MAX_LABELS][lInfo];
  42. new PlayerInfo[MAX_PLAYERS], PlayerItem[MAX_PLAYERS], bool:PlayerEdit[MAX_PLAYERS];
  43.  
  44. public OnPlayerConnect(playerid)
  45. {
  46.     return PlayerInfo[playerid] = -1;
  47. }
  48.  
  49. #if defined _ALS_OnPlayerConnect
  50.     #undef OnPlayerConnect
  51. #else
  52.     #define _ALS_OnPlayerConnect
  53. #endif
  54. #define OnPlayerConnect gb_OnPlayerConnect
  55. forward gb_OnPlayerConnect(playerid);
  56.  
  57. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  58. {
  59.     new Float:ItemPos[3], str[256];
  60.     switch(dialogid)
  61.     {
  62.         case 9099:
  63.         {
  64.             if(!response)
  65.             {
  66.                 return 1;
  67.             }
  68.             switch(listitem)
  69.             {
  70.                 case 0:
  71.                 {
  72.                     new Float:Item[3], Float:Distance = 10000.0;
  73.                     for(new i; i < MAX_OBJECTS; i++)
  74.                     {
  75.                         GetObjectPos(playerid, Item[0], Item[1], Item[2]);
  76.                         if(GetPlayerDistanceFromPoint(playerid, Item[0], Item[1], Item[2]) < Distance)
  77.                         {
  78.                             Distance = GetPlayerDistanceFromPoint(playerid, Item[0], Item[1], Item[2]);
  79.                             PlayerInfo[playerid] = i;
  80.                             PlayerItem[playerid] = iObjeto;
  81.                         }
  82.                     }
  83.                     for(new i; i < MAX_PICKUPS; i++)
  84.                     {
  85.                         GetPickupPos(playerid, Item[0], Item[1], Item[2]);
  86.                         if(GetPlayerDistanceFromPoint(playerid, Item[0], Item[1], Item[2]) < Distance)
  87.                         {
  88.                             Distance = GetPlayerDistanceFromPoint(playerid, Item[0], Item[1], Item[2]);
  89.                             PlayerInfo[playerid] = i;
  90.                             PlayerItem[playerid] = iPickup;
  91.                         }
  92.                     }
  93.                     for(new i; i < MAX_LABELS; i++)
  94.                     {
  95.                         Get3DTextLabelPos(playerid, Item[0], Item[1], Item[2]);
  96.                         if(GetPlayerDistanceFromPoint(playerid, Item[0], Item[1], Item[2]) < Distance)
  97.                         {
  98.                             Distance = GetPlayerDistanceFromPoint(playerid, Item[0], Item[1], Item[2]);
  99.                             PlayerInfo[playerid] = i;
  100.                             PlayerItem[playerid] = iLabel;
  101.                         }
  102.                     }
  103.                     for(new i; i < MAX_VEHICLES; i++)
  104.                     {
  105.                         GetVehiclePos(playerid, Item[0], Item[1], Item[2]);
  106.                         if(GetPlayerDistanceFromPoint(playerid, Item[0], Item[1], Item[2]) < Distance)
  107.                         {
  108.                             Distance = GetPlayerDistanceFromPoint(playerid, Item[0], Item[1], Item[2]);
  109.                             PlayerInfo[playerid] = i;
  110.                             PlayerItem[playerid] = iVehicle;
  111.                         }
  112.                     }
  113.                     SetPlayerToItem(playerid);
  114.                 }
  115.             }
  116.         }
  117.         case 9001:
  118.         {
  119.             if(!response)
  120.             {
  121.                 return 1;
  122.             }
  123.             switch(listitem)
  124.             {
  125.                 case 0:
  126.                 {
  127.                     PlayerInfo[playerid] ++;
  128.                     SetPlayerToItem(playerid);
  129.                     DestroyObject(PlayerInfo[playerid]);
  130.                     SendClientMessage(playerid, -1, "Objeto Deletado.");
  131.                 }
  132.                 case 1:
  133.                 {
  134.                     GetObjectPos(PlayerInfo[playerid], ItemPos[0], ItemPos[1], ItemPos[2]);
  135.                     format(str, sizeof(str), "OBJETO ID: %d\nPOSX: %f\nPOSY: %f\nPOSZ: %f", PlayerInfo[playerid], ItemPos[0], ItemPos[1], ItemPos[2]);
  136.                     ShowPlayerDialog(playerid, 9009, DIALOG_STYLE_MSGBOX, "Informações", str, "Confirma", "");
  137.                 }
  138.             }
  139.         }
  140.         case 9002:
  141.         {
  142.             if(!response)
  143.             {
  144.                 return 1;
  145.             }
  146.             switch(listitem)
  147.             {
  148.                 case 0:
  149.                 {
  150.                     PlayerInfo[playerid] ++;
  151.                     SetPlayerToItem(playerid);
  152.                     DestroyPickupEx(PlayerInfo[playerid]);
  153.                     SendClientMessage(playerid, -1, "Pickup Deletado.");
  154.                 }
  155.                 case 1:
  156.                 {
  157.                     TogglePlayerControllable(playerid, 1);
  158.                     PlayerEdit[playerid] = true;
  159.                     SendClientMessage(playerid, -1, "USE: /finder [SAVE - CANCEL]");
  160.                 }
  161.                 case 2:
  162.                 {
  163.                     ShowPlayerDialog(playerid, 9007, DIALOG_STYLE_INPUT, "Change Model", "Digite o Model para o Pickup:", "Confirma", "Cancela");
  164.                 }
  165.                 case 3:
  166.                 {
  167.                     ShowPlayerDialog(playerid, 9008, DIALOG_STYLE_INPUT, "Change Type", "Digite o Type para o Pickup:", "Confirma", "Cancela");
  168.                 }
  169.                 case 4:
  170.                 {
  171.                     GetPickupPos(PlayerInfo[playerid], ItemPos[0], ItemPos[1], ItemPos[2]);
  172.                     format(str, sizeof(str), "PICKUP ID: %d\nTYPE: %d\nPOSX: %f\nPOSY: %f\nPOSZ: %f\nVirtual World: %d", PlayerInfo[playerid], PickupInfo[PlayerInfo[playerid]][pType], ItemPos[0], ItemPos[1], ItemPos[2], PickupInfo[PlayerInfo[playerid]][pVirtual]);
  173.                     ShowPlayerDialog(playerid, 9009, DIALOG_STYLE_MSGBOX, "Informações", str, "Confirma", "");
  174.                 }
  175.             }
  176.         }
  177.         case 9003:
  178.         {
  179.             if(!response)
  180.             {
  181.                 return 1;
  182.             }
  183.             switch(listitem)
  184.             {
  185.                 case 0:
  186.                 {
  187.                     PlayerInfo[playerid] ++;
  188.                     SetPlayerToItem(playerid);
  189.                     Delete3DTextLabelEx(PlayerInfo[playerid]);
  190.                     SendClientMessage(playerid, -1, "Label Deletado.");
  191.                 }
  192.                 case 1:
  193.                 {
  194.                     TogglePlayerControllable(playerid, 1);
  195.                     PlayerEdit[playerid] = true;
  196.                     SendClientMessage(playerid, -1, "USE: /finder [SAVE - CANCEL]");
  197.                 }
  198.                 case 2:
  199.                 {
  200.                     ShowPlayerDialog(playerid, 9006, DIALOG_STYLE_INPUT, "Change Text", "Digite o Texto para o Label:", "Confirma", "Cancela");
  201.                 }
  202.                 case 3:
  203.                 {
  204.                     Get3DTextLabelPos(PlayerInfo[playerid], ItemPos[0], ItemPos[1], ItemPos[2]);
  205.                     format(str, sizeof(str), "LABEL ID: %d\nTEXT: %s\nPOSX: %f\nPOSY: %f\nPOSZ: %f\nCOR: %x\nVirtual World: %d", PlayerInfo[playerid], LabelInfo[PlayerInfo[playerid]][lText], ItemPos[0], ItemPos[1], ItemPos[2], LabelInfo[PlayerInfo[playerid]][lColor], LabelInfo[PlayerInfo[playerid]][lVirtual]);
  206.                     ShowPlayerDialog(playerid, 9009, DIALOG_STYLE_MSGBOX, "Informações", str, "Confirma", "");
  207.                 }
  208.             }
  209.         }
  210.         case 9004:
  211.         {
  212.             if(!response)
  213.             {
  214.                 return 1;
  215.             }
  216.             switch(listitem)
  217.             {
  218.                 case 0:
  219.                 {
  220.                     PlayerInfo[playerid] ++;
  221.                     SetPlayerToItem(playerid);
  222.                     DestroyVehicle(PlayerInfo[playerid]);
  223.                     SendClientMessage(playerid, -1, "Veiculo Deletado.");
  224.                 }
  225.                 case 1:
  226.                 {
  227.                     TogglePlayerControllable(playerid, 1);
  228.                     PlayerEdit[playerid] = true;
  229.                     SendClientMessage(playerid, -1, "USE: /finder [SAVE - CANCEL]");
  230.                 }
  231.                 case 2:
  232.                 {
  233.                     SetVehicleToRespawn(PlayerInfo[playerid]);
  234.                     SendClientMessage(playerid, -1, "Veículo Spawnado.");
  235.                 }
  236.                 case 3:
  237.                 {
  238.                     GetVehiclePos(PlayerInfo[playerid], ItemPos[0], ItemPos[1], ItemPos[2]);
  239.                     format(str, sizeof(str), "VEHICLE ID: %d\nPOSX: %f\nPOSY: %f\nPOSZ: %f", PlayerInfo[playerid], ItemPos[0], ItemPos[1], ItemPos[2]);
  240.                     ShowPlayerDialog(playerid, 9009, DIALOG_STYLE_MSGBOX, "Informações", str, "Confirma", "");
  241.                 }
  242.             }
  243.         }
  244.         case 9006:
  245.         {
  246.             Update3DTextLabelTextEx(PlayerInfo[playerid], LabelInfo[PlayerInfo[playerid]][lColor], inputtext);
  247.             ShowPlayerDialog(playerid, 9003, DIALOG_STYLE_LIST, "Edit LABEL", "Deletar\nMover\nTexto\nInformações", "Confirma", "Cancela");
  248.             SendClientMessage(playerid, -1, "Texto Alterado.");
  249.         }
  250.         case 9007:
  251.         {
  252.             PickupInfo[PlayerInfo[playerid]][pModel] = strval(inputtext);
  253.             DestroyPickup(PlayerInfo[playerid]);
  254.             CreatePickup(PickupInfo[PlayerInfo[playerid]][pModel], PickupInfo[PlayerInfo[playerid]][pType], PickupInfo[PlayerInfo[playerid]][pX], PickupInfo[PlayerInfo[playerid]][pY], PickupInfo[PlayerInfo[playerid]][pZ], PickupInfo[PlayerInfo[playerid]][pVirtual]);
  255.             ShowPlayerDialog(playerid, 9002, DIALOG_STYLE_LIST, "Edit PICKUP", "Deletar\nMover\nModel\nType\nInformações", "Confirma", "Cancela");
  256.             SendClientMessage(playerid, -1, "Model Alterado.");
  257.         }
  258.         case 9008:
  259.         {
  260.             PickupInfo[PlayerInfo[playerid]][pType] = strval(inputtext);
  261.             DestroyPickup(PlayerInfo[playerid]);
  262.             CreatePickup(PickupInfo[PlayerInfo[playerid]][pModel], PickupInfo[PlayerInfo[playerid]][pType], PickupInfo[PlayerInfo[playerid]][pX], PickupInfo[PlayerInfo[playerid]][pY], PickupInfo[PlayerInfo[playerid]][pZ], PickupInfo[PlayerInfo[playerid]][pVirtual]);
  263.             ShowPlayerDialog(playerid, 9002, DIALOG_STYLE_LIST, "Edit PICKUP", "Deletar\nMover\nModel\nType\nInformações", "Confirma", "Cancela");
  264.             SendClientMessage(playerid, -1, "Type Alterado.");
  265.         }
  266.         case 9009:
  267.         {
  268.             if(PlayerItem[playerid] == iObjeto)
  269.             {
  270.                 ShowPlayerDialog(playerid, 9001, DIALOG_STYLE_LIST, "Edit OBJETO", "Deletar\nInformações", "Confirma", "Cancela");
  271.             }
  272.             else if(PlayerItem[playerid] == iPickup)
  273.             {
  274.                 ShowPlayerDialog(playerid, 9002, DIALOG_STYLE_LIST, "Edit PICKUP", "Deletar\nMover\nModel\nType\nInformações", "Confirma", "Cancela");
  275.             }
  276.             else if(PlayerItem[playerid] == iLabel)
  277.             {
  278.                 ShowPlayerDialog(playerid, 9003, DIALOG_STYLE_LIST, "Edit LABEL", "Deletar\nMover\nTexto\nInformações", "Confirma", "Cancela");
  279.             }
  280.             else if(PlayerItem[playerid] == iVehicle)
  281.             {
  282.                 ShowPlayerDialog(playerid, 9004, DIALOG_STYLE_LIST, "Edit VEHICLE", "Deletar\nMover\nRespawn\nInformações", "Confirma", "Cancela");
  283.             }
  284.         }
  285.     }
  286.     return 0;
  287. }
  288.  
  289. #if defined _ALS_OnDialogResponse
  290.     #undef OnDialogResponse
  291. #else
  292.     #define _ALS_OnDialogResponse
  293. #endif
  294. #define OnDialogResponse gb_OnDialogResponse
  295. forward gb_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
  296.  
  297. forward SetPlayerToItem(playerid);
  298. public SetPlayerToItem(playerid)
  299. {
  300.     new Float:ItemPos[3], str[256];
  301.     if(PlayerItem[playerid] == iObjeto)
  302.     {
  303.         if(PlayerInfo[playerid] == MAX_OBJECTS) PlayerInfo[playerid] = 0;
  304.         if(!IsValidObject(PlayerInfo[playerid]))
  305.         {
  306.             for(new i = PlayerInfo[playerid]; i < MAX_OBJECTS; i++)
  307.             {
  308.                 PlayerInfo[playerid] = i;
  309.                 if(IsValidObject(PlayerInfo[playerid])) break;
  310.                 if(i == MAX_OBJECTS-1) PlayerInfo[playerid] = 0;
  311.             }
  312.         }
  313.         GetObjectPos(PlayerInfo[playerid], ItemPos[0], ItemPos[1], ItemPos[2]);
  314.         format(str, sizeof(str), "OBJETO ID: %d~n~POSX: %f~n~POSY: %f~n~POSZ: %f", PlayerInfo[playerid], ItemPos[0], ItemPos[1], ItemPos[2]);
  315.         GameTextForPlayer(playerid, str, 3000, 6);
  316.         SetPlayerPos(playerid, ItemPos[0], ItemPos[1], ItemPos[2]);
  317.     }
  318.     else if(PlayerItem[playerid] == iPickup)
  319.     {
  320.         if(PlayerInfo[playerid] == MAX_PICKUPS) PlayerInfo[playerid] = 0;
  321.         if(PickupInfo[PlayerInfo[playerid]][pCriado] == false)
  322.         {
  323.             for(new i = PlayerInfo[playerid]; i < MAX_PICKUPS; i++)
  324.             {
  325.                 PlayerInfo[playerid] = i;
  326.                 if(PickupInfo[PlayerInfo[playerid]][pCriado] == true) break;
  327.                 if(i == MAX_PICKUPS-1) PlayerInfo[playerid] = 0;
  328.             }
  329.         }
  330.         GetPickupPos(PlayerInfo[playerid], ItemPos[0], ItemPos[1], ItemPos[2]);
  331.         format(str, sizeof(str), "PICKUP ID: %d~n~MODEL: %d~n~TYPE: %d~n~POSX: %f~n~POSY: %f~n~POSZ: %f~n~Virtual World: %d", PlayerInfo[playerid], PickupInfo[PlayerInfo[playerid]][pModel], PickupInfo[PlayerInfo[playerid]][pType], ItemPos[0], ItemPos[1], ItemPos[2], PickupInfo[PlayerInfo[playerid]][pVirtual]);
  332.         GameTextForPlayer(playerid, str, 3000, 6);
  333.         SetPlayerPos(playerid, ItemPos[0], ItemPos[1], ItemPos[2]);
  334.     }
  335.     else if(PlayerItem[playerid] == iLabel)
  336.     {
  337.         if(PlayerInfo[playerid] == MAX_LABELS) PlayerInfo[playerid] = 0;
  338.         if(LabelInfo[PlayerInfo[playerid]][lCriado] == false)
  339.         {
  340.             for(new i = PlayerInfo[playerid]; i < MAX_LABELS; i++)
  341.             {
  342.                 PlayerInfo[playerid] = i;
  343.                 if(LabelInfo[PlayerInfo[playerid]][lCriado] == true) break;
  344.                 if(i == MAX_LABELS-1) PlayerInfo[playerid] = 0;
  345.             }
  346.         }
  347.         Get3DTextLabelPos(PlayerInfo[playerid], ItemPos[0], ItemPos[1], ItemPos[2]);
  348.         format(str, sizeof(str), "LABEL ID: %d~n~TEXT: %s~n~POSX: %f~n~POSY: %f~n~POSZ: %f~n~COR: %x~n~Virtual World: %d", PlayerInfo[playerid], LabelInfo[PlayerInfo[playerid]][lText], ItemPos[0], ItemPos[1], ItemPos[2], LabelInfo[PlayerInfo[playerid]][lColor], LabelInfo[PlayerInfo[playerid]][lVirtual]);
  349.         GameTextForPlayer(playerid, str, 3000, 6);
  350.         SetPlayerPos(playerid, ItemPos[0], ItemPos[1], ItemPos[2]);
  351.     }
  352.     else if(PlayerItem[playerid] == iVehicle)
  353.     {
  354.         if(PlayerInfo[playerid] == MAX_VEHICLES) PlayerInfo[playerid] = 0;
  355.         if(GetVehicleModel(PlayerInfo[playerid]) == 0)
  356.         {
  357.             for(new i = PlayerInfo[playerid]; i < MAX_VEHICLES; i++)
  358.             {
  359.                 PlayerInfo[playerid] = i;
  360.                 if(GetVehicleModel(PlayerInfo[playerid]) != 0) break;
  361.                 if(i == MAX_VEHICLES-1) PlayerInfo[playerid] = 0;
  362.             }
  363.         }
  364.         GetVehiclePos(PlayerInfo[playerid], ItemPos[0], ItemPos[1], ItemPos[2]);
  365.         PutPlayerInVehicle(playerid, PlayerInfo[playerid], 0);
  366.         format(str, sizeof(str), "VEHICLE ID: %d~n~POSX: %f~n~POSY: %f~n~POSZ: %f", PlayerInfo[playerid], ItemPos[0], ItemPos[1], ItemPos[2]);
  367.         GameTextForPlayer(playerid, str, 3000, 6);
  368.     }
  369.     return 1;
  370. }
  371.  
  372. CMD:finder(playerid, params[])
  373. {
  374.     new item[16];
  375.     if(PlayerInfo[playerid] == -1 && PlayerEdit[playerid] == false)
  376.     {
  377.         if(sscanf(params, "s", item)) return SendClientMessage(playerid, -1, "USE: /finder [OBJETO - PICKUP - LABEL - VEHICLE - EXTRA]");
  378.         if(strcmp("objeto", params, true, 10) == 0)
  379.         {
  380.             PlayerInfo[playerid] = 0;
  381.             PlayerItem[playerid] = iObjeto;
  382.             SetPlayerToItem(playerid);
  383.         }
  384.         else if(strcmp("pickup", params, true, 10) == 0)
  385.         {
  386.             PlayerInfo[playerid] = 0;
  387.             PlayerItem[playerid] = iPickup;
  388.             SetPlayerToItem(playerid);
  389.         }
  390.         else if(strcmp("label", params, true, 10) == 0)
  391.         {
  392.             PlayerInfo[playerid] = 0;
  393.             PlayerItem[playerid] = iLabel;
  394.             SetPlayerToItem(playerid);
  395.         }
  396.         else if(strcmp("vehicle", params, true, 10) == 0)
  397.         {
  398.             PlayerInfo[playerid] = 0;
  399.             PlayerItem[playerid] = iVehicle;
  400.             SetPlayerToItem(playerid);
  401.         }
  402.         else if(strcmp("extra", params, true, 10) == 0)
  403.         {
  404.             ShowPlayerDialog(playerid, 9099, DIALOG_STYLE_LIST, "Extras", "Item mais proximo", "Confirma", "Cancela");
  405.         }
  406.         else
  407.         {
  408.             SendClientMessage(playerid, -1, "USE: /finder [OBJETO - PICKUP - LABEL - VEHICLE - EXTRA]");
  409.         }
  410.     }
  411.     else if(PlayerInfo[playerid] > -1  && PlayerEdit[playerid] == false)
  412.     {
  413.         if(sscanf(params, "s", item)) return SendClientMessage(playerid, -1, "USE: /finder [EDIT- PROXIMO - OFF - ITEM ID]");
  414.         if(strcmp("proximo", params, true, 10) == 0)
  415.         {
  416.             PlayerInfo[playerid] ++;
  417.             SetPlayerToItem(playerid);
  418.         }
  419.         else if(strcmp("off", params, true, 10) == 0)
  420.         {
  421.             PlayerInfo[playerid] = -1;
  422.             PlayerItem[playerid] = iNone;
  423.             SpawnPlayer(playerid);
  424.         }
  425.         else if(strcmp("edit", params, true, 10) == 0)
  426.         {
  427.             if(PlayerItem[playerid] == iObjeto)
  428.             {
  429.                 ShowPlayerDialog(playerid, 9001, DIALOG_STYLE_LIST, "Edit OBJETO", "Deletar\nInformações", "Confirma", "Cancela");
  430.             }
  431.             else if(PlayerItem[playerid] == iPickup)
  432.             {
  433.                 ShowPlayerDialog(playerid, 9002, DIALOG_STYLE_LIST, "Edit PICKUP", "Deletar\nMover\nModel\nType\nInformações", "Confirma", "Cancela");
  434.             }
  435.             else if(PlayerItem[playerid] == iLabel)
  436.             {
  437.                 ShowPlayerDialog(playerid, 9003, DIALOG_STYLE_LIST, "Edit LABEL", "Deletar\nMover\nTexto\nInformações", "Confirma", "Cancela");
  438.             }
  439.             else if(PlayerItem[playerid] == iVehicle)
  440.             {
  441.                 ShowPlayerDialog(playerid, 9004, DIALOG_STYLE_LIST, "Edit VEHICLE", "Deletar\nMover\nRespawn\nInformações", "Confirma", "Cancela");
  442.             }
  443.         }
  444.         else
  445.         {
  446.             new itemid;
  447.             if(sscanf(params, "d", itemid)) return SendClientMessage(playerid, -1, "USE: /finder [EDIT- PROXIMO - OFF - ITEM ID]");
  448.             PlayerInfo[playerid] = itemid;
  449.             SetPlayerToItem(playerid);
  450.         }
  451.     }
  452.     else if(PlayerEdit[playerid] == true)
  453.     {
  454.         new option[16];
  455.         if(sscanf(params, "s", option)) return SendClientMessage(playerid, -1, "USE: /finder [SAVE - CANCEL]");
  456.         if(strcmp("save", params, true, 10) == 0)
  457.         {
  458.             new Float:Pos[3];
  459.             GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  460.             if(PlayerItem[playerid] == iPickup)
  461.             {
  462.                 PlayerEdit[playerid] = false;
  463.                 SetPickupPos(PlayerInfo[playerid], Pos[0], Pos[1], Pos[2]);
  464.                 PlayerInfo[playerid] ++;
  465.                 SetPlayerToItem(playerid);
  466.                 ShowPlayerDialog(playerid, 9002, DIALOG_STYLE_LIST, "Edit PICKUP", "Deletar\nMover\nModel\nType\nInformações", "Confirma", "Cancela");
  467.             }
  468.             else if(PlayerItem[playerid] == iLabel)
  469.             {
  470.                 PlayerEdit[playerid] = false;
  471.                 Set3DTextLabelPos(PlayerInfo[playerid], Pos[0], Pos[1], Pos[2]);
  472.                 PlayerInfo[playerid] ++;
  473.                 SetPlayerToItem(playerid);
  474.                 ShowPlayerDialog(playerid, 9003, DIALOG_STYLE_LIST, "Edit LABEL", "Deletar\nMover\nTexto\nInformações", "Confirma", "Cancela");
  475.             }
  476.             else if(PlayerItem[playerid] == iVehicle)
  477.             {
  478.                 PlayerEdit[playerid] = false;
  479.                 PlayerInfo[playerid] ++;
  480.                 SetPlayerToItem(playerid);
  481.                 ShowPlayerDialog(playerid, 9004, DIALOG_STYLE_LIST, "Edit VEHICLE", "Deletar\nMover\nRespawn\nInformações", "Confirma", "Cancela");
  482.             }
  483.         }
  484.         else if(strcmp("cancel", params, true, 10) == 0)
  485.         {
  486.             new Float:Pos[3];
  487.             if(PlayerItem[playerid] == iPickup)
  488.             {
  489.                 PlayerEdit[playerid] = false;
  490.                 GetPickupPos(PlayerInfo[playerid], Pos[0], Pos[1], Pos[2]);
  491.                 SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  492.                 ShowPlayerDialog(playerid, 9002, DIALOG_STYLE_LIST, "Edit PICKUP", "Deletar\nMover\nModel\nType\nInformações", "Confirma", "Cancela");
  493.             }
  494.             else if(PlayerItem[playerid] == iLabel)
  495.             {
  496.                 PlayerEdit[playerid] = false;
  497.                 Get3DTextLabelPos(PlayerInfo[playerid], Pos[0], Pos[1], Pos[2]);
  498.                 SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  499.                 ShowPlayerDialog(playerid, 9003, DIALOG_STYLE_LIST, "Edit LABEL", "Deletar\nMover\nTexto\nInformações", "Confirma", "Cancela");
  500.             }
  501.             else if(PlayerItem[playerid] == iVehicle)
  502.             {
  503.                 PlayerEdit[playerid] = false;
  504.                 GetVehiclePos(PlayerInfo[playerid], Pos[0], Pos[1], Pos[2]);
  505.                 SetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  506.                 ShowPlayerDialog(playerid, 9004, DIALOG_STYLE_LIST, "Edit VEHICLE", "Deletar\nMover\nRespawn\nInformações", "Confirma", "Cancela");
  507.             }
  508.         }
  509.     }
  510.     return 1;
  511. }
  512.  
  513. stock CreatePickupEx(model, type, Float:X, Float:Y, Float:Z, Virtualworld = 0)
  514. {
  515.     PickupInfo[Pickups][pType] = type;
  516.     PickupInfo[Pickups][pModel] = model;
  517.     PickupInfo[Pickups][pX] = X;
  518.     PickupInfo[Pickups][pY] = Y;
  519.     PickupInfo[Pickups][pZ] = Z;
  520.     PickupInfo[Pickups][pVirtual] = Virtualworld;
  521.     PickupInfo[Pickups][pCriado] = true;
  522.     CreatePickup(model, type, X, Y, Z, Virtualworld);
  523.     Pickups ++;
  524.     return Pickups-1;
  525. }
  526.  
  527. stock ReturnPickupID()
  528. {
  529.     return Pickups-1;
  530. }
  531.  
  532. stock GetPickupPos(pickupid, &Float:X, &Float:Y, &Float:Z)
  533. {
  534.     X = PickupInfo[pickupid][pX];
  535.     Y = PickupInfo[pickupid][pY];
  536.     Z = PickupInfo[pickupid][pZ];
  537.     return 1;
  538. }
  539.  
  540. stock SetPickupPos(pickupid, Float:X, Float:Y, Float:Z, Virtualworld = -1)
  541. {
  542.     if(Virtualworld == -1) Virtualworld = PickupInfo[pickupid][pVirtual];
  543.     PickupInfo[pickupid][pX] = X;
  544.     PickupInfo[pickupid][pY] = Y;
  545.     PickupInfo[pickupid][pZ] = Z;
  546.     DestroyPickup(pickupid);
  547.     CreatePickup(PickupInfo[pickupid][pModel], PickupInfo[pickupid][pType], X, Y, Z, Virtualworld);
  548.     return 1;
  549. }
  550.  
  551. stock DestroyPickupEx(pickupid)
  552. {
  553.     PickupInfo[pickupid][pCriado] = false;
  554.     PickupInfo[pickupid][pType] = 0;
  555.     PickupInfo[pickupid][pModel] = 0;
  556.     PickupInfo[pickupid][pX] = 0;
  557.     PickupInfo[pickupid][pY] = 0;
  558.     PickupInfo[pickupid][pZ] = 0;
  559.     PickupInfo[pickupid][pVirtual] = 0;
  560.     DestroyPickup(pickupid);
  561.     return 1;
  562. }
  563.  
  564. stock Create3DTextLabelEx(text[], color, Float:X, Float:Y, Float:Z, Float:DrawDistance, Virtualworld = 0, testLOS = 0)
  565. {
  566.     new str[128];
  567.     format(str, sizeof(str), "%s", text);
  568.     LabelInfo[Labels][lText] = str;
  569.     LabelInfo[Labels][lX] = X;
  570.     LabelInfo[Labels][lY] = Y;
  571.     LabelInfo[Labels][lZ] = Z;
  572.     LabelInfo[Labels][lColor] = color;
  573.     LabelInfo[Labels][lVirtual] = Virtualworld;
  574.     LabelInfo[Labels][lDrawDistance] = DrawDistance;
  575.     LabelInfo[Labels][lCriado] = true;
  576.     LabelInfo[Labels][lLabel] = Create3DTextLabel(text, color, X, Y, Z, DrawDistance, Virtualworld, testLOS);
  577.     Labels ++;
  578.     return Labels-1;
  579. }
  580.  
  581. stock Return3DTextLabelID()
  582. {
  583.     return Labels-1;
  584. }
  585.  
  586. stock Get3DTextLabelPos(labelid, &Float:X, &Float:Y, &Float:Z)
  587. {
  588.     X = LabelInfo[labelid][lX];
  589.     Y = LabelInfo[labelid][lY];
  590.     Z = LabelInfo[labelid][lZ];
  591.     return 1;
  592. }
  593.  
  594. stock Set3DTextLabelPos(labelid, Float:X, Float:Y, Float:Z, Float:DrawDistance = -1.0, Virtualworld = -1, testLOS = 0)
  595. {
  596.     if(Virtualworld == -1) Virtualworld = LabelInfo[labelid][lVirtual];
  597.     if(DrawDistance == -1) DrawDistance = LabelInfo[labelid][lDrawDistance];
  598.     LabelInfo[labelid][lX] = X;
  599.     LabelInfo[labelid][lY] = Y;
  600.     LabelInfo[labelid][lZ] = Z;
  601.     Delete3DTextLabel(LabelInfo[labelid][lLabel]);
  602.     LabelInfo[labelid][lLabel] = Create3DTextLabel(LabelInfo[labelid][lText], LabelInfo[labelid][lColor], X, Y, Z, DrawDistance, Virtualworld, testLOS);
  603.     return 1;
  604. }
  605.  
  606. stock Delete3DTextLabelEx(labelid)
  607. {
  608.     LabelInfo[labelid][lCriado] = false;
  609.     LabelInfo[labelid][lX] = 0;
  610.     LabelInfo[labelid][lY] = 0;
  611.     LabelInfo[labelid][lZ] = 0;
  612.     LabelInfo[labelid][lVirtual] = 0;
  613.     LabelInfo[labelid][lColor] = 0;
  614.     LabelInfo[labelid][lDrawDistance] = 0;
  615.     new str[128];
  616.     format(str, sizeof(str), "");
  617.     LabelInfo[labelid][lText] = str;
  618.     Delete3DTextLabel(LabelInfo[labelid][lLabel]);
  619.     return 1;
  620. }
  621.  
  622. stock Update3DTextLabelTextEx(labelid, color, text[])
  623. {
  624.     new str[128];
  625.     format(str, sizeof(str), "%s", text);
  626.     LabelInfo[labelid][lText] = str;
  627.     Update3DTextLabelText(LabelInfo[labelid][lLabel], color, text);
  628.     return 1;
  629. }
  630.  
  631. #define Create3DTextLabel(%0) Create3DTextLabelEx(%0)
  632. #define Update3DTextLabelText(%0) Update3DTextLabelTextEx(%0)
  633. #define Delete3DTextLabel(%0) Delete3DTextLabelEx(%0)
  634. #define CreatePickup(%0) CreatePickupEx(%0)
  635. #define AddStaticPickup(%0) CreatePickupEx(%0)
  636. #define DestroyPickup(%0) DestroyPickupEx(%0)
  637. #define Text3D:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement