22.12.2013, 00:08
Simples FS de presentes natalinos em TextDraw.
Sгo 3 caixas de presentes, e o jogador sу pode escolher 1 delas.
O prкmio й pago em dinheiro, em random, ajuste como quiser para seu uso.
Comando: /presentes
Necessбrio uso da sscanf2 e zcmd.
Imagens:
Cуdigo:
Crйditos:
Otacon: Script de base.
GReeN_WOoD: Ediзгo.
Sгo 3 caixas de presentes, e o jogador sу pode escolher 1 delas.
O prкmio й pago em dinheiro, em random, ajuste como quiser para seu uso.
Comando: /presentes
Necessбrio uso da sscanf2 e zcmd.
Imagens:
Cуdigo:
PHP код:
/*
-* Simples FS de presentes natalinos.
-* Script de base por: Otacon.
-* Script modificado por: GReeN_WOoD.
*/
#define FILTERSCRIPT
#include < a_samp >
#include < zcmd >
#include < sscanf2 >
#if defined FILTERSCRIPT
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//
#define MAXIMO_ARVORES (50)
#define @VERMELHO 0xD80000AA
forward Executar_Arvore(playerid);
new Text:Arvore_TD[MAXIMO_ARVORES],
Terminar_Arvore[MAX_PLAYERS];
//=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//
CMD:presentes(playerid) {
for(new o, user = GetMaxPlayers(); o != user; o++){
if(!IsPlayerConnected(o)) continue;
for(new v = 0; v < MAXIMO_ARVORES; v ++) TextDrawShowForPlayer(o,Arvore_TD[v]);
KillTimer(Terminar_Arvore[o]);
Terminar_Arvore[o] = SetTimerEx("Executar_Arvore", 500, true, "d", o);
StopAudioStreamForPlayer(o);
PlayAudioStreamForPlayer(o, "http://s3.amazonaws.com/pb_previews/129_jingle-bells-music-box/129_short_jingle-bells-music-box_0021.mp3");
for(new x = 0; x < 12; x ++) SendClientMessage(o, -1, " ");
SendClientMessage(o, @VERMELHO, "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
SendClientMessage(o, @VERMELHO, "*** {FFFFFF}Presentes de natal liberado!");
SendClientMessage(o, @VERMELHO, "*** {FFFFFF}No canto inferior direito escolha 1 das 3 caixas de presentes.");
SendClientMessage(o, @VERMELHO, "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
SelectTextDraw(o, 0xFF0000FF);
}
return true;
}
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=//
public OnFilterScriptInit(){
Arvore_TD[0] = TextDrawCreate(380.000000, 214.000000, "_"); //tree
TextDrawBackgroundColor(Arvore_TD[0], 0x00B20000);
TextDrawFont(Arvore_TD[0], TEXT_DRAW_FONT_MODEL_PREVIEW);
TextDrawLetterSize(Arvore_TD[0], 3.599998, 2.000000);
TextDrawColor(Arvore_TD[0], -1);
TextDrawSetOutline(Arvore_TD[0], 0);
TextDrawSetProportional(Arvore_TD[0], 1);
TextDrawSetShadow(Arvore_TD[0], 1);
TextDrawUseBox(Arvore_TD[0], 1);
TextDrawBoxColor(Arvore_TD[0], 255);
TextDrawTextSize(Arvore_TD[0], 289.000000, 210.000000);
TextDrawSetPreviewModel(Arvore_TD[0], 19076);
TextDrawSetPreviewRot(Arvore_TD[0], -16.000000, 0.000000, -55.000000, 1.000000);
TextDrawSetSelectable(Arvore_TD[0], false);
Arvore_TD[5] = TextDrawCreate(394.000000, 298.000000, "_"); //bush
TextDrawSetPreviewModel(Arvore_TD[5], 826);
TextDrawSetPreviewRot(Arvore_TD[5], -16.000000, 0.000000, -55.000000, 1.000000);
Arvore_TD[1] = TextDrawCreate(490.000000, 383.000000, "_"); //gift 1
TextDrawSetPreviewModel(Arvore_TD[1], 19057);
TextDrawSetPreviewRot(Arvore_TD[1], -16.000000, 0.000000, -55.000000, 1.000000);
Arvore_TD[2] = TextDrawCreate(424.000000, 368.000000, "_"); //gift 2
TextDrawSetPreviewModel(Arvore_TD[2], 19055);
TextDrawSetPreviewRot(Arvore_TD[2], -16.000000, 0.000000, -55.000000, 1.000000);
Arvore_TD[3] = TextDrawCreate(556.000000, 368.000000, "_"); //gift 3
TextDrawSetPreviewModel(Arvore_TD[3], 19058);
TextDrawSetPreviewRot(Arvore_TD[3], -16.000000, 0.000000, -55.000000, 1.000000);
Arvore_TD[4] = TextDrawCreate(553.000000, 346.000000, "_"); //Navidad hat
TextDrawSetPreviewModel(Arvore_TD[4], 19065);
TextDrawSetPreviewRot(Arvore_TD[4], -16.000000, 30.000000, 2.000000, 1.000000);
for(new index=1; index<6; index++) {
TextDrawBackgroundColor(Arvore_TD[index], 0x00000000);
TextDrawFont(Arvore_TD[index], TEXT_DRAW_FONT_MODEL_PREVIEW);
TextDrawLetterSize(Arvore_TD[index], 0.500000, 1.000000);
TextDrawColor(Arvore_TD[index], -1);
TextDrawSetOutline(Arvore_TD[index], 0);
TextDrawSetProportional(Arvore_TD[index], 1);
TextDrawSetShadow(Arvore_TD[index], 1);
TextDrawUseBox(Arvore_TD[index], 1);
TextDrawBoxColor(Arvore_TD[index], 255);
TextDrawTextSize(Arvore_TD[index], 85.000000, 67.000000);
TextDrawSetSelectable(Arvore_TD[index], true);
}
TextDrawSetSelectable(Arvore_TD[4], false);
TextDrawSetSelectable(Arvore_TD[5], false);
TextDrawTextSize(Arvore_TD[5], 260.000000, 222.000000);
Arvore_TD[6] = TextDrawCreate(478.000000, 245.000000, "]"); //starlets
TextDrawLetterSize(Arvore_TD[6], 0.509999, 1.699999);
Arvore_TD[7] = TextDrawCreate(451.000000, 260.000000, "]");
TextDrawLetterSize(Arvore_TD[7], 0.509999, 1.699999);
Arvore_TD[8] = TextDrawCreate(450.000000, 236.000000, "]");
TextDrawLetterSize(Arvore_TD[8], 0.509999, 1.699999);
Arvore_TD[9] = TextDrawCreate(563.000000, 267.000000, "]");
TextDrawLetterSize(Arvore_TD[9], 0.509999, 1.699999);
Arvore_TD[10] = TextDrawCreate(588.000000, 253.000000, "]");
TextDrawLetterSize(Arvore_TD[10], 0.509999, 1.699999);
Arvore_TD[11] = TextDrawCreate(594.000000, 278.000000, "]");
TextDrawLetterSize(Arvore_TD[11], 0.509999, 1.699999);
Arvore_TD[12] = TextDrawCreate(546.000000, 227.000000, "]");
TextDrawLetterSize(Arvore_TD[12], 0.820000, 2.899999);
Arvore_TD[13] = TextDrawCreate(484.000000, 219.000000, "]");
TextDrawLetterSize(Arvore_TD[13], 0.690000, 2.200000);
for(new index=6; index<14; index++) {
TextDrawBackgroundColor(Arvore_TD[index], 255);
TextDrawFont(Arvore_TD[index], 2);
TextDrawColor(Arvore_TD[index], -1);
TextDrawSetOutline(Arvore_TD[index], 1);
TextDrawSetProportional(Arvore_TD[index], 1);
TextDrawSetSelectable(Arvore_TD[index], false);
}
print("\n- FilterScript de presentes natalinos carregado.\n");
return true;
}
public OnFilterScriptExit(){
for(new a = 0; a < MAXIMO_ARVORES; a ++) TextDrawDestroy(Arvore_TD[a]);
return true;
}
public OnPlayerConnect(playerid){
for(new p = 0; p < MAXIMO_ARVORES; p ++) TextDrawHideForPlayer(playerid, Arvore_TD[p]);
KillTimer(Terminar_Arvore[playerid]);
return true;
}
public OnPlayerDisconnect(playerid, reason){
for(new f = 0; f < MAXIMO_ARVORES; f ++) TextDrawHideForPlayer(playerid, Arvore_TD[f]);
KillTimer(Terminar_Arvore[playerid]);
return true;
}
public OnPlayerClickTextDraw(playerid, Text:clickedid){
for(new t = 1; t < 4; t ++) {
if(clickedid == Arvore_TD[t]) {
CancelSelectTextDraw(playerid);
static str_natal[128];
new Dinheiro_Natal = 100 + random(500);
GivePlayerMoney(playerid, Dinheiro_Natal);
format(str_natal, sizeof(str_natal), "PRESENTE DE NATAL: {FFFFFF}Vocк ganhou R$%d. ", Dinheiro_Natal);
SendClientMessage(playerid, @VERMELHO, str_natal);
for(new b = 0; b < MAXIMO_ARVORES; b ++) TextDrawHideForPlayer(playerid, Arvore_TD[b]);
KillTimer(Terminar_Arvore[playerid]);
}
}
return false;
}
public Executar_Arvore(playerid) {
for(new c = 6; c < 14; c ++) {
TextDrawHideForPlayer(playerid, Arvore_TD[c]);
switch(random(2)){
case 0:{
TextDrawBackgroundColor(Arvore_TD[c], SetAlphaColor(0x000000FF, 0x00000055));
TextDrawColor(Arvore_TD[c], SetAlphaColor(0xFFFFFBFF, 0xFFFFFB55));
}
case 1:{
TextDrawBackgroundColor(Arvore_TD[c], SetAlphaColor(0xFFFFFB55, 0xFFFFFBFF));
TextDrawColor(Arvore_TD[c], SetAlphaColor(0x00000055, 0x000000FF));
}
}
TextDrawShowForPlayer(playerid, Arvore_TD[c]);
}
}
stock SetAlphaColor(color , alpha) return ((color >>> 8) << 8) + alpha;
#endif
Crйditos:
Otacon: Script de base.
GReeN_WOoD: Ediзгo.