Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT
- #include <a_samp>
- #include <zcmd>
- #define PLAYERS 100 //MAX PLAYERS
- #define TXD_PX 40.0 //Pos X
- #define TXD_PY 80.0 //Pos Y
- #define TXD_DIS_X 70.0 //Distancia entre as Imagens
- #define TXD_DIS_Y 70.0 //Distancia entre as Imagens
- #define TXD_TAM 70.0 //Tamanho das imagens (textdraw)
- #define TXD_COR_SELECAO 0x00FF00AA //Cor de seleção das textdraw
- #define TXD_BG_COLOR 0x00000055 //Cor de fundo das textdraw
- new PlayerText:TextPintura[PLAYERS][36];
- CMD:pintar(playerid)//Unica CMD
- {
- IniciarPintura(playerid);
- return 1;
- }
- public OnFilterScriptInit()
- {
- printf("Sistema de Pintura Carregado com Sucesso\nby AdrianoStk\nhayllander.ddns.net");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(GetPVarInt(playerid, "PaginaPintura") != 0)//Interessante no caso do jogador sofrer queda de conexão!
- {
- CancelSelectTextDraw(playerid);
- RemoverTextDrawPintura(playerid);
- }
- return 1;
- }
- forward IniciarPintura(playerid);
- forward PinturaCancela(playerid);
- forward PinturaFinalizada(playerid, vcor1, vcor2);
- public IniciarPintura(playerid)//Chama essa função pra iniciar a pintura
- {
- if(GetPVarInt(playerid, "PaginaPintura") != 0)
- SendClientMessage(playerid, -1, "Você já está pintando um veiculo!");
- else if(IsPlayerInAnyVehicle(playerid))
- {
- if(QuantasPinturas(GetVehicleModel(GetPlayerVehicleID(playerid))) != 0)
- {
- SetPVarInt(playerid, "PaginaPintura", 1);//Pagina Inicial das cores
- SetPVarInt(playerid, "Cor1", -1);//Não altere o valor
- SetPVarInt(playerid, "Cor2", -1);//Não altere o valor
- ExibeTextDrawPintura(playerid);
- }
- else
- SendClientMessage(playerid, -1, "Este veiculo não suporta pintura!");
- }
- else
- SendClientMessage(playerid, -1, "Para pintar um veiculo, você deve estar dentro dele!");
- return 1;
- }
- public PinturaCancela(playerid)//Quando o player cancelas, ESC ou clika no X
- {
- SendClientMessage(playerid, -1, "Você cancelou a pintura");
- return 1;
- }
- public PinturaFinalizada(playerid, vcor1, vcor2)//Quando o player finaliza a seleção de cores!
- {
- ChangeVehicleColor(GetPlayerVehicleID(playerid), vcor1, vcor2);
- GivePlayerMoney(playerid, -250);
- new Str[64];
- if(vcor2 != -1)
- format(Str, 64, "Suas novas cores, Cor1: %d Cor2: %d", vcor1, vcor2);
- else
- format(Str, 64, "Sua nova cor: %d", vcor1);
- SendClientMessage(playerid, -1, Str);
- return 1;
- }
- forward ExibeTextDrawPintura(playerid);
- public ExibeTextDrawPintura(playerid)
- {
- if(IsPlayerInAnyVehicle(playerid))
- {
- new Float:TX, Float:TY = TXD_PY, i = 0, Cor1, Cor2, ModeloV;//Variavei auxiliares
- new bool:C1;
- ModeloV = GetVehicleModel(GetPlayerVehicleID(playerid));
- C1 = GetPVarInt(playerid, "Cor1") == -1 ? false : true;
- Cor1 = C1 ? GetPVarInt(playerid, "Cor1"): (GetPVarInt(playerid, "PaginaPintura")-1) * 32;
- Cor2 = (GetPVarInt(playerid, "PaginaPintura")-1) * 32;
- for(new l = 0; l < 4; l++)//Linhas
- {
- TX = TXD_PX;
- for(new c = 0; c < 8; c++)//Colunas
- {
- TextPintura[playerid][i] = CreatePlayerTextDraw(playerid, TX, TY, "_");
- PlayerTextDrawFont(playerid, TextPintura[playerid][i], TEXT_DRAW_FONT_MODEL_PREVIEW);
- PlayerTextDrawBackgroundColor(playerid, TextPintura[playerid][i], TXD_BG_COLOR);
- PlayerTextDrawTextSize(playerid, TextPintura[playerid][i], TXD_TAM, TXD_TAM);
- PlayerTextDrawSetPreviewRot(playerid, TextPintura[playerid][i], -10.0, 0.0, -20.0, 0.8);
- PlayerTextDrawSetPreviewVehCol(playerid, TextPintura[playerid][i], Cor1, Cor2);
- PlayerTextDrawSetPreviewModel(playerid, TextPintura[playerid][i], ModeloV);
- PlayerTextDrawSetSelectable(playerid, TextPintura[playerid][i], 1);
- TX += 70.0;
- i++;
- Cor2++;
- Cor1 += C1 ? 0 : 1;
- }
- TY += TXD_DIS_X;
- }
- TextPintura[playerid][32] = CreatePlayerTextDraw(playerid, TXD_PX + 510.0, TXD_PY + 280.0, "LD_BEAT:right");//Proxima Pagina
- PlayerTextDrawFont(playerid, TextPintura[playerid][32], 4);
- PlayerTextDrawTextSize(playerid, TextPintura[playerid][32], TXD_TAM -40.0, TXD_TAM -40.0);
- PlayerTextDrawSetSelectable(playerid, TextPintura[playerid][32], 1);
- PlayerTextDrawAlignment(playerid, TextPintura[playerid][32], 2);
- TextPintura[playerid][33] = CreatePlayerTextDraw(playerid, TXD_PX + 15.0, TXD_PY + 280.0, "LD_BEAT:left");//Proxima Pagina
- PlayerTextDrawFont(playerid, TextPintura[playerid][33], 4);
- PlayerTextDrawTextSize(playerid, TextPintura[playerid][33], TXD_TAM -40.0, TXD_TAM -40.0);
- PlayerTextDrawSetSelectable(playerid, TextPintura[playerid][33], 1);
- PlayerTextDrawAlignment(playerid, TextPintura[playerid][33], 2);
- TextPintura[playerid][34] = CreatePlayerTextDraw(playerid, TXD_PX + 260, TXD_PY + 280, "LD_BEAT:cross");//Cancelar
- PlayerTextDrawFont(playerid, TextPintura[playerid][34], 4);
- PlayerTextDrawTextSize(playerid, TextPintura[playerid][34], TXD_TAM -42.0, TXD_TAM -42.0);
- PlayerTextDrawSetSelectable(playerid, TextPintura[playerid][34], 1);
- PlayerTextDrawAlignment(playerid, TextPintura[playerid][34], 2);
- PlayerTextDrawShow(playerid, TextPintura[playerid][34]);
- TextPintura[playerid][35] = CreatePlayerTextDraw(playerid, TXD_PX + 280.0, TXD_PY + 2.0, "MENU DE PINTURA");//Titulo
- PlayerTextDrawFont(playerid, TextPintura[playerid][35], 1);
- PlayerTextDrawColor(playerid, TextPintura[playerid][35], 0x1E90FFFF);
- PlayerTextDrawSetSelectable(playerid, TextPintura[playerid][35], 0);
- PlayerTextDrawAlignment(playerid, TextPintura[playerid][35], 2);
- PlayerTextDrawLetterSize(playerid, TextPintura[playerid][35], 0.5 ,1.2);
- PlayerTextDrawShow(playerid, TextPintura[playerid][35]);
- for(i = 0; i < 32; i++)
- PlayerTextDrawShow(playerid, TextPintura[playerid][i]);
- if(GetPVarInt(playerid, "PaginaPintura") != 8)
- PlayerTextDrawShow(playerid, TextPintura[playerid][32]);
- if(GetPVarInt(playerid, "PaginaPintura") != 1)
- PlayerTextDrawShow(playerid, TextPintura[playerid][33]);
- SelectTextDraw(playerid, TXD_COR_SELECAO);
- }
- return 1;
- }
- public OnPlayerClickTextDraw(playerid, Text:clickedid)
- {
- if(_:clickedid == INVALID_TEXT_DRAW)
- {
- if(GetPVarInt(playerid, "PaginaPintura") != 0)//Verifica se ele deu esc na pintura de veiculo!
- {
- DeletePVar(playerid, "PaginaPintura");
- DeletePVar(playerid, "Cor1");
- DeletePVar(playerid, "Cor2");
- RemoverTextDrawPintura(playerid);
- PinturaCancela(playerid);
- }
- }
- return 0;
- }
- public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
- {
- if(GetPVarInt(playerid, "PaginaPintura") != 0)//Significa que ele está pintando um veiculo
- {
- if(TextPintura[playerid][32] == playertextid)//Proxima
- {
- SetPVarInt(playerid, "PaginaPintura", GetPVarInt(playerid, "PaginaPintura") + 1);
- RemoverTextDrawPintura(playerid);
- SetTimerEx("ExibeTextDrawPintura", 150, false, "i", playerid);
- }
- else if(TextPintura[playerid][33] == playertextid)//Anterior
- {
- SetPVarInt(playerid, "PaginaPintura", GetPVarInt(playerid, "PaginaPintura") - 1);
- RemoverTextDrawPintura(playerid);
- SetTimerEx("ExibeTextDrawPintura", 150, false, "i", playerid);
- }
- else if(TextPintura[playerid][34] == playertextid)//Cancelar
- {
- DeletePVar(playerid, "PaginaPintura");
- DeletePVar(playerid, "Cor1");
- DeletePVar(playerid, "Cor2");
- RemoverTextDrawPintura(playerid);
- CancelSelectTextDraw(playerid);
- PinturaCancela(playerid);
- }
- else
- {
- new i = 0;
- while(i < 32 && (TextPintura[playerid][i] != playertextid))
- i++;
- if(TextPintura[playerid][i] == playertextid)
- {
- RemoverTextDrawPintura(playerid);
- if(GetPVarInt(playerid, "Cor1") == -1)
- {
- SetPVarInt(playerid, "Cor1", (GetPVarInt(playerid, "PaginaPintura")-1) *32 + i);
- if(QuantasPinturas(GetVehicleModel(GetPlayerVehicleID(playerid))) == 2)
- {
- SetTimerEx("ExibeTextDrawPintura", 150, false, "i", playerid);
- }
- else
- {
- DeletePVar(playerid, "PaginaPintura");
- RemoverTextDrawPintura(playerid);
- CancelSelectTextDraw(playerid);
- PinturaFinalizada(playerid, GetPVarInt(playerid, "Cor1"), -1);
- DeletePVar(playerid, "Cor1");
- DeletePVar(playerid, "Cor2");
- }
- }
- else
- {
- SetPVarInt(playerid, "Cor2", (GetPVarInt(playerid, "PaginaPintura")-1) *32 + i);
- DeletePVar(playerid, "PaginaPintura");
- CancelSelectTextDraw(playerid);
- RemoverTextDrawPintura(playerid);
- PinturaFinalizada(playerid, GetPVarInt(playerid, "Cor1"), GetPVarInt(playerid, "Cor2"));
- DeletePVar(playerid, "Cor1");
- DeletePVar(playerid, "Cor2");
- }
- }
- }
- return 1;
- }
- return 0;
- }
- forward RemoverTextDrawPintura(playerid);
- public RemoverTextDrawPintura(playerid)
- {
- for(new i = 0; i < 36; i++)
- {
- PlayerTextDrawHide(playerid, TextPintura[playerid][i]);
- PlayerTextDrawDestroy(playerid, TextPintura[playerid][i]);
- }
- return 1;
- }
- stock QuantasPinturas(modelo)//Quantidade de cores de cada veiculo samp! (0.3.7 ou versão anterior! (0.3DL também funcina!))
- {
- new Contem[212] = {1, 1, 1, 1, 2, 1, 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 0, 0, 0, 1, 1, 2, 1, 1, 1, 2, 2, 1, 2, 1, 2, 0, 2, 0, 1, 1, 2, 2, 2, 1, 2, 1, 1, 1,
- 2, 1, 2, 2, 0, 0, 2, 2, 1, 0, 0, 2, 2, 2, 2, 1, 2, 1, 1, 2, 2, 1, 1, 2, 2, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 2, 2, 1, 2, 1, 2, 1, 0, 0, 2, 2, 0, 2, 2,
- 1, 1, 0, 1, 1, 1, 0, 2, 2, 1, 2, 0, 0, 2, 1, 2, 2, 1, 1, 1, 1, 1, 0, 2, 1, 1, 2, 2, 2, 1, 0, 2, 1, 1, 1, 1, 1, 2, 0, 1, 1, 2, 0, 0, 0, 1, 1, 2, 1, 2, 2, 2, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 0, 1, 2,
- 0, 0, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 1, 0, 0, 1, 2, 0, 2};
- return Contem[modelo-400];
- }
Advertisement
Add Comment
Please, Sign In to add comment