Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Skrypt tagów jako teksty 3D w grze stworzony przez Tortille - FS.
- Specjalnie dla LS-RP.net 25.10.11*/
- #include <a_samp>
- #include <a_angles>
- #include <sscanf2>
- #include <a_mysql>
- #include <md5>
- #include <streamer>
- #include <model>
- #define TAGI
- #define HOST "db4free.net:3306"
- #define USER "tortilla"
- #define DB "havefun"
- #define PASS "1092801"
- #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
- #if defined TAGI
- forward StworzTag(tid, content, Float:X, Float:Y, Float:Z);
- forward WczytajTagi();
- #endif
- new queries = 0;
- enum tInfo
- {
- tUID,
- tContent,
- tFloat:x,
- tFloat:y,
- tFloat:z,
- tFloat:DrawDistance,
- tVW,
- tColor,
- };
- new TagInfo[MAX_PLAYERS][tInfo];
- public WczytajTagi()
- {
- new result[256], query[32], i = 0;
- printf("Zaczynam wczytywac tagi...");
- format(query, sizeof(query), "SELECT * FROM `game_tags`");
- mysql_query(query);
- queries++;
- mysql_store_result();
- while(mysql_fetch_row_format(result, "|") == 1)
- {
- new uid;
- sscanf(result, "p<|>d", uid);
- printf("Tag o UID: %d - wczytano następujące UID: %d", uid, uid);
- sscanf(result, "p<|>ds[216]ffffdd",
- tInfo[uid][tUID],
- tInfo[uid][tContent],
- tInfo[uid][tFloat:x],
- tInfo[uid][tFloat:y],
- tInfo[uid][tFloat:z],
- tInfo[uid][tFloat:DrawDistance],
- tInfo[uid][tVW],
- tInfo[uid][tColor]);
- printf("Tag o UID: %d - wczytano następujące dane", uid);
- tInfo[uid][tUID] = uid;
- i++;
- }
- mysql_free_result();
- printf(" %d tag/ów wczytano z bazy danych", i);
- return 1;
- }
- public StworzTag(tid, content, Float:X, Float:Y, Float:Z, Float:DrawDistance, vw, color)
- {
- new query2[1000], uid, content[216], color, Float:X, Float:Y, Float:Z, Float:DrawDistance, vw;
- format(query2, sizeof(query2), "INSERT INTO `game_tags` (`content`, `x`, `y`, `z`) VALUES ('%s', '%f', '%f', '%f')",
- inputtext, Float:X, Float:Y, Float:Z);
- mysql_query(query2);
- printf("Stworzono nowy tag");
- queries++;
- Create3DTextLabel(content, Float:X, Float:Y, Float:Z);
- GetPlayerPos(playerid, Float:x, Float:y, Float:z);
- WczytajTagi();
- return 1;
- public OnFilterScriptInit()
- {
- mysql_connect("HOST", "USER", "DB", "PASS");
- WczytajTagi();
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- if (( GetPlayerWeapon( playerid ) == 41 ) && (newkeys & (KEY_FIRE)) == (KEY_FIRE))
- {
- 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");
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if (dialogid == 1)
- {
- if (response)
- {
- StwórzTag(content, Float:x, Float:y, Float:z);
- }
- }
- return 1;
- }
Add Comment
Please, Sign In to add comment