Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Ícones de morte (textdraw) por Jelly23
- */
- #define FILTERSCRIPT
- /*Includes*/
- #include <a_samp>
- #include <izcmd>
- /*TextDraws (Global)*/
- static Text:Kill_Caixa,
- Text:Kill_IconeCaixa,
- Text:Kill_Msg,
- /*TextDraws (Por Jogador)*/
- PlayerText:Kill_Nome,
- PlayerText:Kill_Icone,
- /*String*/
- nome[MAX_PLAYERS][MAX_PLAYER_NAME],
- /*Banco de dados / Database*/
- DB:db_morte,
- /*Array(s)*/
- IconeSelecionado[MAX_PLAYERS];
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" ícones de morte - Jelly23");
- print("--------------------------------------\n");
- if((db_morte = db_open("IDMorte.db")) == DB:0)
- {
- print("Nao foi possivel abrir uma conexao com o banco de dados.");
- SendRconCommand("exit");
- }
- else
- {
- db_free_result(db_query(db_morte, "CREATE TABLE IF NOT EXISTS `data`(`ID` INTEGER PRIMARY KEY AUTOINCREMENT,`icone` INTEGER NOT NULL, `nome` VARCHAR(24) NOT NULL)"));
- print("Conectado ao banco de dados \"IDMorte.db\".");
- }
- /*Criando as textdraws*/
- Kill_Caixa = TextDrawCreate(225.000000, 190.000000, "box");
- TextDrawLetterSize(Kill_Caixa, 0.000000, 2.705498);
- TextDrawTextSize(Kill_Caixa, 446.989501, 0.000000);
- TextDrawAlignment(Kill_Caixa, 1);
- TextDrawColor(Kill_Caixa, -1061109505);
- TextDrawUseBox(Kill_Caixa, 1);
- TextDrawBoxColor(Kill_Caixa, 120);
- TextDrawSetShadow(Kill_Caixa, 0);
- TextDrawSetOutline(Kill_Caixa, 0);
- TextDrawBackgroundColor(Kill_Caixa, 255);
- TextDrawFont(Kill_Caixa, 1);
- TextDrawSetProportional(Kill_Caixa, 1);
- TextDrawSetShadow(Kill_Caixa, 0);
- Kill_IconeCaixa = TextDrawCreate(225.000000, 190.000000, "box");
- TextDrawLetterSize(Kill_IconeCaixa, 0.000000, 2.644498);
- TextDrawTextSize(Kill_IconeCaixa, 250.654998, 0.000000);
- TextDrawAlignment(Kill_IconeCaixa, 1);
- TextDrawColor(Kill_IconeCaixa, -1);
- TextDrawUseBox(Kill_IconeCaixa, 1);
- TextDrawBoxColor(Kill_IconeCaixa, 100);
- TextDrawSetShadow(Kill_IconeCaixa, 0);
- TextDrawSetOutline(Kill_IconeCaixa, 0);
- TextDrawBackgroundColor(Kill_IconeCaixa, 255);
- TextDrawFont(Kill_IconeCaixa, 1);
- TextDrawSetProportional(Kill_IconeCaixa, 1);
- TextDrawSetShadow(Kill_IconeCaixa, 0);
- Kill_Msg = TextDrawCreate(261.875000, 204.666702, "TE_MATOU");
- TextDrawLetterSize(Kill_Msg, 0.231249, 1.010833);
- TextDrawAlignment(Kill_Msg, 1);
- TextDrawColor(Kill_Msg, -2147483393);
- TextDrawSetShadow(Kill_Msg, 0);
- TextDrawSetOutline(Kill_Msg, 0);
- TextDrawBackgroundColor(Kill_Msg, 255);
- TextDrawFont(Kill_Msg, 1);
- TextDrawSetProportional(Kill_Msg, 1);
- TextDrawSetShadow(Kill_Msg, 0);
- return 1;
- }
- public OnFilterScriptExit()
- {
- TextDrawDestroy(Kill_Caixa);
- TextDrawDestroy(Kill_IconeCaixa);
- TextDrawDestroy(Kill_Msg);
- return 1;
- }
- #else
- main()
- {
- print("\n----------------------------------");
- print(" ícones de morte - Jelly23");
- print("----------------------------------\n");
- }
- #endif
- /*Callbacks*/
- public OnPlayerConnect(playerid)
- {
- GetPlayerName(playerid,nome[playerid],24);
- new DBResult: query,string[68];
- format(string, sizeof(string), "SELECT * FROM `data` WHERE `nome` = '%q'", nome[playerid]);
- query = db_query(db_morte, string);
- if(db_num_rows(query) > 0)
- {
- new int_icone[2];
- db_get_field_assoc(query, "icone", int_icone, 2);
- IconeSelecionado[playerid] = strval(int_icone);
- }
- else
- {
- format(string, sizeof(string), "INSERT INTO `data` (`nome`, `icone`) VALUES ('%q', '%d')", nome[playerid], 0);
- db_free_result(db_query(db_morte, string));
- IconeSelecionado[playerid] = 0;
- }
- Kill_Icone = CreatePlayerTextDraw(playerid, 227.375000, 193.916656, "ld_shtr:pm3");
- PlayerTextDrawLetterSize(playerid, Kill_Icone, 0.000000, 0.000000);
- PlayerTextDrawTextSize(playerid, Kill_Icone, 20.000000, 15.916665);
- PlayerTextDrawAlignment(playerid, Kill_Icone, 1);
- PlayerTextDrawColor(playerid, Kill_Icone, -1);
- PlayerTextDrawSetShadow(playerid, Kill_Icone, 0);
- PlayerTextDrawSetOutline(playerid, Kill_Icone, 0);
- PlayerTextDrawBackgroundColor(playerid, Kill_Icone, 255);
- PlayerTextDrawFont(playerid, Kill_Icone, 4);
- PlayerTextDrawSetProportional(playerid, Kill_Icone, 0);
- PlayerTextDrawSetShadow(playerid, Kill_Icone, 0);
- Kill_Nome = CreatePlayerTextDraw(playerid, 260.000000, 191.166702, "Name");
- PlayerTextDrawLetterSize(playerid, Kill_Nome, 0.278750, 1.203333);
- PlayerTextDrawAlignment(playerid, Kill_Nome, 1);
- PlayerTextDrawColor(playerid, Kill_Nome, -1);
- PlayerTextDrawSetShadow(playerid, Kill_Nome, 0);
- PlayerTextDrawSetOutline(playerid, Kill_Nome, 0);
- PlayerTextDrawBackgroundColor(playerid, Kill_Nome, 255);
- PlayerTextDrawFont(playerid, Kill_Nome, 1);
- PlayerTextDrawSetProportional(playerid, Kill_Nome, 1);
- PlayerTextDrawSetShadow(playerid, Kill_Nome, 0);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(killerid != INVALID_PLAYER_ID)
- {
- new str[31];
- TextDrawShowForPlayer(playerid,Kill_Caixa);
- TextDrawShowForPlayer(playerid,Kill_IconeCaixa);
- TextDrawShowForPlayer(playerid,Kill_Msg);
- format(str,sizeof(str),"%s(%i)",nome[killerid],killerid);
- PlayerTextDrawSetString(playerid, Kill_Nome, str);
- PlayerTextDrawShow(playerid,Kill_Nome);
- UpdateIconSprite(killerid,playerid);
- PlayerTextDrawShow(playerid,Kill_Icone);
- }
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- TextDrawHideForPlayer(playerid,Kill_Caixa);
- TextDrawHideForPlayer(playerid,Kill_IconeCaixa);
- TextDrawHideForPlayer(playerid,Kill_Msg);
- PlayerTextDrawHide(playerid,Kill_Nome);
- PlayerTextDrawHide(playerid,Kill_Icone);
- return 1;
- }
- /*Funções*/
- UpdateIconSprite(killerid,playerid)
- {
- PlayerTextDrawDestroy(playerid,Kill_Icone);
- switch(IconeSelecionado[killerid])
- {
- case 1: Kill_Icone = CreatePlayerTextDraw(playerid, 227.375000, 193.916656, "ld_shtr:ps1");
- case 2: Kill_Icone = CreatePlayerTextDraw(playerid, 227.375000, 193.916656, "ld_shtr:ps2");
- case 3: Kill_Icone = CreatePlayerTextDraw(playerid, 227.375000, 193.916656, "ld_shtr:ps3");
- case 4: Kill_Icone = CreatePlayerTextDraw(playerid, 227.375000, 193.916656, "ld_shtr:pm2");
- case 5: Kill_Icone = CreatePlayerTextDraw(playerid, 227.375000, 193.916656, "ld_shtr:pa");
- default: Kill_Icone = CreatePlayerTextDraw(playerid, 227.375000, 193.916656, "ld_shtr:pm3");
- }
- PlayerTextDrawLetterSize(playerid, Kill_Icone, 0.000000, 0.000000);
- PlayerTextDrawTextSize(playerid, Kill_Icone, 20.000000, 15.916665);
- PlayerTextDrawAlignment(playerid, Kill_Icone, 1);
- PlayerTextDrawColor(playerid, Kill_Icone, -1);
- PlayerTextDrawSetShadow(playerid, Kill_Icone, 0);
- PlayerTextDrawSetOutline(playerid, Kill_Icone, 0);
- PlayerTextDrawBackgroundColor(playerid, Kill_Icone, 255);
- PlayerTextDrawFont(playerid, Kill_Icone, 4);
- PlayerTextDrawSetProportional(playerid, Kill_Icone, 0);
- PlayerTextDrawSetShadow(playerid, Kill_Icone, 0);
- }
- /*Commando(s)*/
- CMD:mudaricone(playerid,params[])
- {
- if(!strlen(params)) return SendClientMessage(playerid,-1,"/mudaricone [id]");
- if(0 < strval(params) > 5) return SendClientMessage(playerid,-1,"Ids sao entre 0-5");
- new str[74];
- IconeSelecionado[playerid] = strval(params);
- format(str,sizeof(str),"Mudou seu icone para %i",IconeSelecionado[playerid]);
- SendClientMessage(playerid,-1,str);
- format(str,sizeof(str),"UPDATE `data` SET `icone` = '%d' WHERE `nome` = '%q'", IconeSelecionado[playerid], nome[playerid]);
- db_free_result(db_query(db_morte,str));
- print(str);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement