Guest User

Untitled

a guest
Feb 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.07 KB | None | 0 0
  1. /*Skrypt tagów jako teksty 3D w grze stworzony przez Tortille - FS.
  2. Specjalnie dla LS-RP.net 25.10.11*/
  3.  
  4. #include <a_samp>
  5. #include <a_angles>
  6. #include <sscanf2>
  7. #include <a_mysql>
  8. #include <md5>
  9. #include <streamer>
  10. #include <model>
  11.  
  12. #define TAGI
  13.  
  14. #define HOST    "db4free.net:3306"
  15. #define USER    "tortilla"
  16. #define DB      "havefun"
  17. #define PASS    "1092801"
  18.  
  19. #define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  20.  
  21. #if defined TAGI
  22. forward StworzTag(tid, content, Float:X, Float:Y, Float:Z);
  23. forward WczytajTagi();
  24. #endif
  25.  
  26. new queries = 0;
  27.  
  28. enum tInfo
  29. {
  30. tUID,
  31. tContent,
  32. tFloat:x,
  33. tFloat:y,
  34. tFloat:z,
  35. tFloat:DrawDistance,
  36. tVW,
  37. tColor,
  38. };
  39. new TagInfo[MAX_PLAYERS][tInfo];
  40.  
  41. public WczytajTagi()
  42. {
  43. new result[256], query[32], i = 0;
  44.     printf("Zaczynam wczytywac tagi...");
  45.     format(query, sizeof(query), "SELECT * FROM `game_tags`");
  46.     mysql_query(query);
  47.     queries++;
  48.     mysql_store_result();
  49.     while(mysql_fetch_row_format(result, "|") == 1)
  50.     {
  51.         new uid;
  52.         sscanf(result, "p<|>d", uid);
  53.         printf("Tag o UID: %d - wczytano następujące UID: %d", uid, uid);
  54.         sscanf(result, "p<|>ds[216]ffffdd",
  55.                         tInfo[uid][tUID],
  56.                         tInfo[uid][tContent],
  57.                         tInfo[uid][tFloat:x],
  58.                         tInfo[uid][tFloat:y],
  59.                         tInfo[uid][tFloat:z],
  60.                         tInfo[uid][tFloat:DrawDistance],
  61.                         tInfo[uid][tVW],
  62.                         tInfo[uid][tColor]);
  63.         printf("Tag o UID: %d - wczytano następujące dane", uid);
  64.         tInfo[uid][tUID] = uid;
  65.         i++;
  66.     }
  67.     mysql_free_result();
  68.     printf(" %d tag/ów wczytano z bazy danych", i);
  69.     return 1;
  70. }
  71.  
  72. public StworzTag(tid, content, Float:X, Float:Y, Float:Z, Float:DrawDistance, vw, color)
  73. {
  74. new query2[1000], uid, content[216], color, Float:X, Float:Y, Float:Z, Float:DrawDistance, vw;
  75.     format(query2, sizeof(query2), "INSERT INTO `game_tags` (`content`, `x`, `y`, `z`) VALUES ('%s', '%f', '%f', '%f')",
  76.                                                                 inputtext, Float:X, Float:Y, Float:Z);
  77.     mysql_query(query2);
  78.     printf("Stworzono nowy tag");
  79.     queries++;
  80.     Create3DTextLabel(content, Float:X, Float:Y, Float:Z);
  81.     GetPlayerPos(playerid, Float:x, Float:y, Float:z);
  82.     WczytajTagi();
  83.     return 1;
  84.    
  85. public OnFilterScriptInit()
  86. {
  87. mysql_connect("HOST", "USER", "DB", "PASS");
  88. WczytajTagi();
  89. return 1;
  90. }
  91.  
  92. public OnFilterScriptExit()
  93. {
  94.     return 1;
  95. }
  96.  
  97.  
  98.  
  99. public OnPlayerConnect(playerid)
  100. {
  101.     return 1;
  102. }
  103.  
  104. public OnPlayerDisconnect(playerid, reason)
  105. {
  106.     return 1;
  107. }
  108.  
  109.  
  110. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  111. {
  112. if (( GetPlayerWeapon( playerid ) == 41 ) && (newkeys & (KEY_FIRE)) == (KEY_FIRE))
  113. {
  114. ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "LS-RP.net -> Tworzenie tagu:", "Wpisz w okno treść, która będzie zawarta w tagu", "Twórz", "Anuluj");
  115. }
  116.     return 1;
  117. }
  118.  
  119.  
  120. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  121. {
  122. if (dialogid == 1)
  123. {
  124. if (response)
  125. {
  126. StwórzTag(content, Float:x, Float:y, Float:z);
  127. }
  128. }
  129.     return 1;
  130. }
Add Comment
Please, Sign In to add comment