29.06.2018, 20:40
(
Последний раз редактировалось Jonorusc; 30.06.2018 в 22:45.
)
Tava fora do samp, ai voltei a jogar GT, achei da hora o pichar e fiz um parecido pra galera!
Link to images
Link to images
PHP код:
#include "a_samp"
//Variбveis
/*
SetPlayerObjectMaterialText(playerid, Objeto[playerid], Texto[playerid], Index[playerid], MSize[playerid], \
Fonte[playerid], Size[playerid], Bold[playerid], CorTexto[playerid], Fundo[playerid], Align[playerid]);
CORES: https://sampwiki.blast.hk/wiki/Colors_Li...3.44487974
HEXTOINT: https://sampforum.blast.hk/showthread.php?tid=218185
NOME CORRETO: https://duvidas.dicio.com.br/pichar-ou-p...3.44487974
Cores retiradas da 'interwebes'
A stock "HEXTOINT" e para usar cores em variбveis
EX:
Jeito certo > Var[playerid] = HexToInt("0xFFFFFF00");
Jeito incorreto > Var[playerid] = OxFFFFFF00;
Ela irб converter para um nъmero 'INT'
*/
//cores estгo entre aspas para entrar no HexToInt
#define AMARELO ("0xFFFF00FF")
#define AZUL ("0x058AFFFF")
#define ROSA ("0xFF05CDFF")
#define VERDE ("0x33AA33AA")
#define BRANCO ("0xFFFFFFAA")
#define VERMELHO ("0xAA3333AA")
#define PRETO ("0x000000FF")
#define CINZA ("0x878787FF")
#define AZULCLARO ("0x03F2FFFF")
#define VERDECLARO ("0x03FF35FF")
#define ROXO ("0x9900FFFF")
#define ROXOCLARO ("0x9A03FFFF")
#define LARANJA ("0xFF7403FF")
#define DEEP_BLUE ("0x00BFFFFF")
#define PRINCIPAL 0
#define TEXTO 1
#define MSIZE 2
#define DFONTE 3
#define DSFONTE 4
#define DCOR 5
/*enum pinfo
{
Objeto,
Texto[128],
Index = 0,
Bold = 0,
Align = 1, //centro
Fonte[128], //Fonte[128] = "Arial"
Size = 24, //padrгo, 255 Mбximo
MSize = 50, //10 = padrгo
CorTexto,
Fundo = 0,
Float:Pos[4],
Float:Rot[3]
}
*/
new Objeto[MAX_PLAYERS],
Texto[MAX_PLAYERS][128],
Index[MAX_PLAYERS] = 0,
Bold[MAX_PLAYERS] = 0,
Align[MAX_PLAYERS] = 1,
Fonte[MAX_PLAYERS][128],
Size[MAX_PLAYERS] = 24,
MSize[MAX_PLAYERS] = 50,
CorTexto[MAX_PLAYERS],
Fundo[MAX_PLAYERS] = 0,
Float:Pos[4],
Float:Rot[3];
new Objeto2[MAX_PLAYERS] = 19353;
new bool:Criando[MAX_PLAYERS] = false;
public OnFilterScriptInit()
{
print("Jonorusc");
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/pichar", true) || !strcmp(cmdtext, "/pixar", true))
{
if(!IsPlayerAdmin(playerid))
return SendClientMessage(playerid, -1, #ERROR);
if(Criando[playerid] == false)
{
Texto[playerid] = "Texto",
Fonte[playerid] = "Arial",
CorTexto[playerid] = HexToInt(BRANCO),
Fundo[playerid] = 0,
Criando[playerid] = true;
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]),GetPlayerFacingAngle(playerid, Pos[3]);
new Float:x = Pos[0] + (5.0 * floatsin(-Pos[3], degrees));
new Float:y = Pos[1] + (5.0 * floatcos(-Pos[3], degrees));
Objeto[playerid] = CreatePlayerObject(playerid, Objeto2[playerid], x, y, Pos[2]+0.5, 0.0, 0.0, Pos[3] - 90.0);
SetPlayerObjectMaterialText(playerid, Objeto[playerid], Texto[playerid], Index[playerid], MSize[playerid],
Fonte[playerid], Size[playerid], Bold[playerid], CorTexto[playerid], Fundo[playerid], Align[playerid]);
EditObject(playerid, Objeto[playerid]);
new string[600];
strcat(string, "Texto\nSize do Material\nFonte\nFonte size\nCor\nDeletar\nMover");
ShowPlayerDialog(playerid, PRINCIPAL, DIALOG_STYLE_LIST, "Menu", string, "Escolher", "Fechar");
}
else
SendClientMessage(playerid, -1, #ERROR);
return 1;
}
if(!strcmp(cmdtext, "/destroirp", true))
{
if(Criando[playerid] == true)
{
Atualizar(playerid), Menu(playerid);
}
else
SendClientMessage(playerid, -1, #ERROR);
return 1;
}
return SendClientMessage(playerid, -1, #ERROR);
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == PRINCIPAL)
{
if(response)
{
switch(listitem) {
case 0: //texto
{
new string[64];
format(string, 128, "%s, Digite o texo:", Texto[playerid]);
ShowPlayerDialog(playerid, TEXTO, DIALOG_STYLE_INPUT, "#Escolhendo o texto", string, "#Escolher", "#Voltar");
}
case 1: //Size do material
{
new sizes[400];
strcat(sizes,"1. 32x32(10)\n2. 64x32(20)\n3. 64x64(30)\n4. 128x32(40)\n5. 128x64(50)\n 6. 128x128(60)\n7. 256x32(70)");
strcat(sizes,"8. 256x64(80)\n9. 256x128(90)\n10. 256x256(100)\n11. 512x64(110)\n12. 512x128(120)\n13. 512x256(130)\n14. 512x512(140)");
new string[64];
format(string, sizeof(string),"#Atual: %d",MSize[playerid]);
ShowPlayerDialog(playerid, MSIZE, DIALOG_STYLE_LIST, string, sizes, "#Escolher", "#Voltar");
}
case 2: //Fonte
{
new string[128];
format(string, 128, "#Atual: %s", Fonte[playerid]);
ShowPlayerDialog(playerid, DFONTE, DIALOG_STYLE_INPUT, string, "#Escolha uma fonte\nEX: Arial, Impact...", "#Escolher", "#Voltar");
}
case 3: //Fonte Size
{
new string[128];
format(string, 128, "#Atual: %s", Size[playerid]);
ShowPlayerDialog(playerid, DSFONTE, DIALOG_STYLE_INPUT, string, "#Escolha uma fonte size\n 1 a 255", "#Escolher", "#Voltar");
}
case 4: //Cor
{
new string[128];
format(string, 128, "#Atual: %i", CorTexto[playerid]);
new cores[300];
strcat(cores,"BRANCO\nVERMELHO\nCINZA\nAMARELO\nVERDE\nROSA\nPRETO");
strcat(cores,"AZULCLARO\nVERDECLARO\nROXO\nROXOCLARO\nLARANJA\nDEEP_BLUE");
ShowPlayerDialog(playerid, DCOR, DIALOG_STYLE_LIST, string, cores, "#Escolher", "#Voltar");
}
case 5: //deletar (SУ APARECE SE USAR O COMANDO)
{
Atualizar(playerid), Criando[playerid] = false;
DestroyPlayerObject(playerid, Objeto[playerid]);
}
case 6: //mover (SУ APARECE SE USAR O COMANDO)
{
EditObject(playerid, Objeto[playerid]);
}
}
}
}
if(dialogid == TEXTO)
{
if(!response)
Menu(playerid);
else
{
new string[128];
format(string, 128,"%s",inputtext);
Texto[playerid] = string;
Atualizar(playerid), Menu(playerid);
}
}
if(dialogid == MSIZE)
{
if(!response)
Menu(playerid);
else
{
switch(listitem) {
case 0: MSize[playerid] = 10;
case 1: MSize[playerid] = 20;
case 2: MSize[playerid] = 30;
case 3: MSize[playerid] = 40;
case 4: MSize[playerid] = 50;
case 5: MSize[playerid] = 60;
case 6: MSize[playerid] = 70;
case 7: MSize[playerid] = 80;
case 8: MSize[playerid] = 90;
case 9: MSize[playerid] = 100;
case 10: MSize[playerid] = 110;
case 11: MSize[playerid] = 120;
case 12: MSize[playerid] = 130;
case 13: MSize[playerid] = 140;
}
Atualizar(playerid), Menu(playerid);
}
}
if(dialogid == DFONTE)
{
if(!response)
Menu(playerid);
else
{
new string[64];
format(string, 64, "#Atualizada para: %s", inputtext);
SendClientMessage(playerid, -1, string);
format(string, 64, "%s", inputtext);
Fonte[playerid] = string;
Atualizar(playerid), Menu(playerid);
}
}
if(dialogid == DSFONTE)
{
if(!response)
Menu(playerid);
else
{
if(!isNumeric(inputtext)) return SendClientMessage(playerid, -1, "Somente numero de 1 a 255");
if(strval(inputtext) < 1)
SendClientMessage(playerid, -1, "Somente numero de 1 a 255"), Atualizar(playerid), Menu(playerid);
Size[playerid] = strval(inputtext), Atualizar(playerid), Menu(playerid);
}
}
if(dialogid == DCOR)
{
if(!response)
Menu(playerid);
else
{
switch(listitem) {
case 0: CorTexto[playerid] = HexToInt(BRANCO);
case 1: CorTexto[playerid] = HexToInt(VERMELHO);
case 2: CorTexto[playerid] = HexToInt(CINZA);
case 3: CorTexto[playerid] = HexToInt(AMARELO);
case 4: CorTexto[playerid] = HexToInt(VERDE);
case 5: CorTexto[playerid] = HexToInt(ROSA);
case 6: CorTexto[playerid] = HexToInt(PRETO);
case 7: CorTexto[playerid] = HexToInt(AZULCLARO);
case 8: CorTexto[playerid] = HexToInt(VERDECLARO);
case 9: CorTexto[playerid] = HexToInt(ROXO);
case 10: CorTexto[playerid] = HexToInt(ROXOCLARO);
case 11: CorTexto[playerid] = HexToInt(LARANJA);
case 12: CorTexto[playerid] = HexToInt(DEEP_BLUE);
}
Atualizar(playerid), Menu(playerid);
}
}
return 1;
}
public OnPlayerEditObject(playerid, playerobject, objectid, response, Float:fX, Float:fY, Float:fZ, Float:fRotX, Float:fRotY, Float:fRotZ)
{
if(objectid == Objeto[playerid])
{
if(response == EDIT_RESPONSE_FINAL)
{
DestroyPlayerObject(playerid, Objeto[playerid]);
Objeto[playerid] = CreatePlayerObject(playerid, Objeto2[playerid], fX, fY, fZ, fRotX, fRotY, fRotZ);
SetPlayerObjectMaterialText(playerid, Objeto[playerid], Texto[playerid], Index[playerid], MSize[playerid], \
Fonte[playerid], Size[playerid], Bold[playerid], CorTexto[playerid], Fundo[playerid], Align[playerid]);
new string[600];
strcat(string, "Texto\nSize do Material\nFonte\nFonte size\nCor");
ShowPlayerDialog(playerid, PRINCIPAL, DIALOG_STYLE_LIST, "Menu", string, "Escolher", "Fechar");
}
else if(response == EDIT_RESPONSE_CANCEL)
{
Atualizar(playerid);
new string[600];
strcat(string, "Texto\nSize do Material\nFonte\nFonte size\nCor");
ShowPlayerDialog(playerid, PRINCIPAL, DIALOG_STYLE_LIST, "Menu", string, "Escolher", "Fechar");
}
}
}
Menu(playerid)
{
new string[600];
strcat(string, "Texto\nSize do Material\nFonte\nFonte size\nCor");
ShowPlayerDialog(playerid, PRINCIPAL, DIALOG_STYLE_LIST, "Menu", string, "Escolher", "Fechar");
}
stock isNumeric(const string[])
{
new length=strlen(string);
if (length==0) return false;
for (new i = 0; i < length; i++)
{
if (
(string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+') // Not a number,'+' or '-'
|| (string[i]=='-' && i!=0) // A '-' but not at first.
|| (string[i]=='+' && i!=0) // A '+' but not at first.
) return false;
}
if (length==1 && (string[0]=='-' || string[0]=='+')) return false;
return true;
}
stock HexToInt(string[])
{
if (string[0] == 0)
{
return 0;
}
new i;
new cur = 1;
new res = 0;
for (i = strlen(string); i > 0; i--)
{
if (string[i-1] < 58)
{
res = res + cur * (string[i - 1] - 48);
}
else
{
res = res + cur * (string[i-1] - 65 + 10);
cur = cur * 16;
}
}
return res;
}
Atualizar(playerid)
{
if(MSize[playerid] < 10)
{
SendClientMessage(playerid, -1, #Escolha o material size);
Menu(playerid);
return 1;
}
GetPlayerObjectPos(playerid, Objeto[playerid], Pos[0], Pos[1], Pos[2]);
GetPlayerObjectRot(playerid, Objeto[playerid], Rot[0], Rot[1], Rot[2]);
DestroyPlayerObject(playerid, Objeto[playerid]);
Objeto[playerid] = CreatePlayerObject(playerid, Objeto2[playerid], Pos[0], Pos[1], Pos[2], Rot[0], Rot[1], Rot[2]);
SetPlayerObjectMaterialText(playerid, Objeto[playerid], Texto[playerid], Index[playerid], MSize[playerid], \
Fonte[playerid], Size[playerid], Bold[playerid], CorTexto[playerid], Fundo[playerid], Align[playerid]);
EditObject(playerid, Objeto[playerid]);
return 1;
}