Advertisement
Gireada

PickUp's Creator

Feb 23rd, 2013
487
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.26 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dini>
  3. #include <zcmd>
  4. #include <mSelection>
  5.  
  6. forward SaveThisPickUp(pickupid);
  7. forward LoadPickUp();
  8. forward SendAdminMesaj(color,const string[]);
  9.  
  10. new pickups = mS_INVALID_LISTID;
  11. new maxpickups = 100;
  12.  
  13. enum PickupData
  14. {
  15.     Model,
  16.     Float:Locatiex,
  17.     Float:Locatiey,
  18.     Float:Locatiez,
  19. }
  20. new PickUpInfo[MAX_PLAYERS][PickupData];
  21.  
  22. public OnGameModeInit()
  23. {
  24.     pickups = LoadModelSelectionMenu("pickup's.txt");
  25.     return 1;
  26.  
  27. }
  28.  
  29. public OnFilterScriptInit()
  30. {
  31.     print("\n--------------------------------------");
  32.     print(" Pick-up Creator by Gireada");
  33.     print("--------------------------------------\n");
  34.     return 1;
  35. }
  36.  
  37. public OnFilterScriptExit()
  38. {
  39.     return 1;
  40. }
  41.  
  42. main()
  43. {
  44.     print("\n----------------------------------");
  45.     print(" Pick-up Creator by Gireada");
  46.     print("----------------------------------\n");
  47. }
  48.  
  49. CMD:clanhelp(playerid, params[])
  50. {
  51.     if(IsPlayerAdmin(playerid))
  52.     {
  53.         ShowModelSelectionMenu(playerid, pickups, "PickUp");
  54.     }
  55.     return 1;
  56. }
  57.  
  58. public LoadPickUp()
  59. {
  60.     new file[50];
  61.     for(new idx=1;idx<maxpickups;idx++)
  62.     {
  63.         format(file, sizeof(file),"Pickup/%d.ini", idx);
  64.         if(dini_Exists(file))
  65.         {
  66.             PickUpInfo[idx][Model] = dini_Int(file,"Model");
  67.             PickUpInfo[idx][Locatiex] = dini_Float(file,"Locatiex");
  68.             PickUpInfo[idx][Locatiey] = dini_Float(file,"Locatiey");
  69.             PickUpInfo[idx][Locatiez] = dini_Float(file,"Locatiez");
  70.             CreatePickup(PickUpInfo[idx][Model], 1, PickUpInfo[idx][Locatiex], PickUpInfo[idx][Locatiey], PickUpInfo[idx][Locatiez], -1);
  71.         }
  72.     }
  73.     return 1;
  74. }
  75.  
  76.  
  77. public SaveThisPickUp(pickupid)
  78. {
  79.     new file2[50];
  80.     format(file2, sizeof(file2),"Pickup/%d.ini", pickupid);
  81.     dini_Create(file2);
  82.     dini_IntSet(file2,"Model",PickUpInfo[pickupid][Model]);
  83.     dini_FloatSet(file2,"Locatiex",PickUpInfo[pickupid][Locatiex]);
  84.     dini_FloatSet(file2,"Locatiey",PickUpInfo[pickupid][Locatiey]);
  85.     dini_FloatSet(file2,"Locatiez",PickUpInfo[pickupid][Locatiez]);
  86.     return 1;
  87.  
  88. }
  89.  
  90. public OnPlayerModelSelection(playerid, response, listid, modelid)
  91. {
  92.     new Float:x, Float:y, Float:z, string[700], name[MAX_PLAYER_NAME], file2[100];
  93.     GetPlayerName(playerid, name, sizeof(name));
  94.     if(listid == pickups)
  95.     {
  96.         GetPlayerPos(playerid, x,y,z);
  97.         if(response)
  98.         {
  99.             for(new i=1;i<MAX_PLAYERS; i++)
  100.             {
  101.                 format(file2, sizeof(file2),"Pickup/%d.ini", i);
  102.                 if(!dini_Exists(file2))
  103.                 {
  104.                     PickUpInfo[i][Model] = modelid;
  105.                     PickUpInfo[i][Locatiex] = x;
  106.                     PickUpInfo[i][Locatiey] = y;
  107.                     PickUpInfo[i][Locatiez] = z;
  108.                     CreatePickup(PickUpInfo[i][Model], 1, PickUpInfo[i][Locatiex], PickUpInfo[i][Locatiey], PickUpInfo[i][Locatiez], -1);
  109.                     format(string, sizeof(string), "Admin-ul %s a creiat pick-ul %d",name,i);
  110.                     SendAdminMesaj(0xFFFFFFFF,string); SaveThisPickUp(i);
  111.                     break;
  112.                 }
  113.             }
  114.         }
  115.         else SendClientMessage(playerid, 0xFF0000FF, "Cancel pickpu selection");
  116.         return 1;
  117.  
  118.     }
  119.     return 1;
  120. }
  121.  
  122. public SendAdminMesaj(color,const string[])
  123. {
  124.     for(new i = 0; i < MAX_PLAYERS; i++)
  125.     {
  126.         if(IsPlayerConnected(i))
  127.         {
  128.             if(IsPlayerAdmin(i))
  129.             {
  130.                 SendClientMessage(i, color, string);
  131.                 printf("%s", string);
  132.             }
  133.         }
  134.     }
  135.     return 1;
  136. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement