[Ajuda] A quantia da Grana & p Motivo nгo aparece
#1

Olб galera sуu novato em Pawno!
Entгo galera eu criei esse comando ai para o Polнcial multar um jogador...
Quando ele digita Ex : /multar 0 800 Desacato o Comando envez de aparecer assim : ATENЗГO : %s Foi multado pelo Policial Sult4n com uma quantia de R$800. (Motivo: Desacato) < aparece assim : ATENЗГO : Sult4n foi multado pelo Policial com uma quantia de R%. (Motivo

Porfavor me ajudem cуdigo abaixo !!

Код HTML:
if(strcmp(cmd, "/multar", true) == 0)
{
	new aname[MAX_PLAYER_NAME];

	GetPlayerName(playerid, aname, MAX_PLAYER_NAME);

	format(file, sizeof(file), PASTA_CONTAS, aname);

	if(dini_Int(file, "Profissao") == Policial_C || dini_Int(file, "Profissao") == Policial_F || dini_Int(file, "Profissao") == Delegado || dini_Int(file, "Profissao") == Bope || dini_Int(file, "Profissao") == Swat || dini_Int(file, "Profissao") == Narcoticos || dini_Int(file, "Profissao") == Policial_M || dini_Int(file, "Profissao") == FBI || dini_Int(file, "Profissao") == Interpol || dini_Int(file, "Profissao") == LSPD || dini_Int(file, "aAdmin") == 1 || IsPlayerAdmin(playerid))
	{
		new tmp[256];
		new plid;

		new quant;

		tmp = strtok(cmdtext, idx);

		if(!strlen(tmp))
		{
			SendClientMessage(playerid, Vermelho, "{FF0000}(INFO) {FF0000}/multar [id] [quantidade]");
			return 1;
		}

		plid = strval(tmp);

		tmp = strtok(cmdtext, idx);

		if(!strlen(tmp))
		{
			SendClientMessage(playerid, Vermelho, "{FF0000}(INFO) {FF0000}/multar [id] [quantidade]");
			return 1;
		}

		if(UsouID[plid] == true) return SendClientMessage(playerid, Vermelho, "{FF0000}(INFO) {FFD700}Espere 1 Minutos para Multar esse ID Novamente!");

		quant = strval(tmp);

		if(quant > 800 || quant <= 0)
		{
			SendClientMessage(playerid, Vermelho, "{FF0000}(INFO) {FFD700}Vocк nгo estб multando de forma justa MAX R$800.");
			return 1;
		}

		if(IsPlayerConnected(plid))
		{
			new pname[MAX_PLAYER_NAME];

			GetPlayerName(plid, pname, MAX_PLAYER_NAME);

			format(file2, sizeof(file2), PASTA_CONTAS, pname);

			format(string, sizeof(string), "({FF0000}(INFO) {FFD700}Vocк recebeu uma multa de R$%d Pelo policial %s . O dinheiro foi retirado do banco.", quant, aname);
			SendClientMessage(plid, COLOR_GREEN, string);

            format(string, sizeof(string), "{FF0000}(INFO) {FFD700}ATENЗГO : %s Foi multado pelo Policial %s com uma quantia de R$%d. (Motivo: %s)",aname);
            SendClientMessageToAll(roxo,string);

			SendClientMessage(playerid, COLOR_GREEN, "{FF0000}(INFO) {FFD700}Multa dada.");

			UsouID[plid] = true;

			SetTimerEx("ResetarMultados", 60000, true, "i", plid);

			dini_IntSet(file2, "SaldoBancario", dini_Int(file2, "SaldoBancario")- quant);
			return 1;
		}
		else
		{
			SendClientMessage(playerid, Vermelho, "{FF0000}(INFO) {FFD700}O jogador nгo estб conectado!");
			return 1;
		}
	}
}
Reply
#2

Faltou colocar as variбveis no format.
Reply
#3

Quote:
Originally Posted by ipsLuan
Посмотреть сообщение
Faltou colocar as variбveis no format.
Nгo sei ajeitar porisso estуu fazendo um pedido, vai me servir de base !!
Reply
#4

https://sampwiki.blast.hk/wiki/Format.
Bom estudo.
Reply
#5

Quote:
Originally Posted by RianRBS
Посмотреть сообщение
Olб galera sуu novato em Pawno!
Entгo galera eu criei esse comando ai para o Polнcial multar um jogador...
Quando ele digita Ex : /multar 0 800 Desacato o Comando envez de aparecer assim : ATENЗГO : %s Foi multado pelo Policial Sult4n com uma quantia de R$800. (Motivo: Desacato) < aparece assim : ATENЗГO : Sult4n foi multado pelo Policial com uma quantia de R%. (Motivo

Porfavor me ajudem cуdigo abaixo !!

Код HTML:
if(strcmp(cmd, "/multar", true) == 0)
{
	new aname[MAX_PLAYER_NAME];

	GetPlayerName(playerid, aname, MAX_PLAYER_NAME);

	format(file, sizeof(file), PASTA_CONTAS, aname);

	if(dini_Int(file, "Profissao") == Policial_C || dini_Int(file, "Profissao") == Policial_F || dini_Int(file, "Profissao") == Delegado || dini_Int(file, "Profissao") == Bope || dini_Int(file, "Profissao") == Swat || dini_Int(file, "Profissao") == Narcoticos || dini_Int(file, "Profissao") == Policial_M || dini_Int(file, "Profissao") == FBI || dini_Int(file, "Profissao") == Interpol || dini_Int(file, "Profissao") == LSPD || dini_Int(file, "aAdmin") == 1 || IsPlayerAdmin(playerid))
	{
		new tmp[256];
		new plid;

		new quant;

		tmp = strtok(cmdtext, idx);

		if(!strlen(tmp))
		{
			SendClientMessage(playerid, Vermelho, "{FF0000}(INFO) {FF0000}/multar [id] [quantia]");
			return 1;
		}

		plid = strval(tmp);

		tmp = strtok(cmdtext, idx);

		if(!strlen(tmp))
		{
			SendClientMessage(playerid, Vermelho, "{FF0000}(INFO) {FF0000}/multar [id] [quantia]");
			return 1;
		}

		if(UsouID[plid] == true) return SendClientMessage(playerid, Vermelho, "{FF0000}(INFO) {FFD700}Espere 1 Minutos para Multar esse ID Novamente!");

		quant = strval(tmp);

		if(quant > 800 || quant <= 0)
		{
			SendClientMessage(playerid, Vermelho, "{FF0000}(INFO) {FFD700}Vocк nгo estб multando de forma justa MAX R$800.");
			return 1;
		}

		if(IsPlayerConnected(plid))
		{
			new pname[MAX_PLAYER_NAME];

			GetPlayerName(plid, pname, MAX_PLAYER_NAME);

			format(file2, sizeof(file2), PASTA_CONTAS, pname);

			format(string, sizeof(string), "({FF0000}(INFO) {FFD700}Vocк recebeu uma multa de R$%d Pelo policial %s . O dinheiro foi retirado do banco.", quant, aname);
			SendClientMessage(plid, COLOR_GREEN, string);

            format(string, sizeof(string), "{FF0000}(INFO) {FFD700}ATENЗГO : %s Foi multado pelo Policial %s com uma quantia de R$%d. (Motivo: %s)",aname);
            SendClientMessageToAll(roxo,string);

			SendClientMessage(playerid, COLOR_GREEN, "{FF0000}(INFO) {FFD700}Multa dada.");

			UsouID[plid] = true;

			SetTimerEx("ResetarMultados", 60000, true, "i", plid);

			dini_IntSet(file2, "SaldoBancario", dini_Int(file2, "SaldoBancario")- quant);
			return 1;
		}
		else
		{
			SendClientMessage(playerid, Vermelho, "{FF0000}(INFO) {FFD700}O jogador nгo estб conectado!");
			return 1;
		}
	}
}
Tenta isso...

Код HTML:
if(strcmp(cmd, "/multar", true) == 0)
{
	new aname[MAX_PLAYER_NAME];
        //new playerID;

	GetPlayerName(playerid, aname, MAX_PLAYER_NAME);

	format(file, sizeof(file), PASTA_CONTAS, aname);

	if(dini_Int(file, "Profissao") == Policial_C || dini_Int(file, "Profissao") == Policial_F || dini_Int(file, "Profissao") == Delegado || dini_Int(file, "Profissao") == Bope || dini_Int(file, "Profissao") == Swat || dini_Int(file, "Profissao") == Narcoticos || dini_Int(file, "Profissao") == Policial_M || dini_Int(file, "Profissao") == FBI || dini_Int(file, "Profissao") == Interpol || dini_Int(file, "Profissao") == LSPD || dini_Int(file, "aAdmin") == 1 || IsPlayerAdmin(playerid))
	{
		new tmp[256];
		new plid;

		new quant;

		tmp = strtok(cmdtext, idx);

		if(!strlen(tmp))
		{
			SendClientMessage(playerid, Vermelho, "{FF0000}(INFO) {FF0000}/multar [id] [quantidade]");
			return 1;
		}

		plid = strval(tmp);

		tmp = strtok(cmdtext, idx);

		if(!strlen(tmp))
		{
			SendClientMessage(playerid, Vermelho, "{FF0000}(INFO) {FF0000}/multar [id] [quantidade]");
			return 1;
		}

		if(UsouID[plid] == true) return SendClientMessage(playerid, Vermelho, "{FF0000}(INFO) {FFD700}Espere 1 Minutos para Multar esse ID Novamente!");

		quant = strval(tmp);

		if(quant > 800 || quant <= 0)
		{
			SendClientMessage(playerid, Vermelho, "{FF0000}(INFO) {FFD700}Vocк nгo estб multando de forma justa MAX R$800.");
			return 1;
		}

		if(IsPlayerConnected(plid))
		{
			new pname[MAX_PLAYER_NAME];
                        
                        new playerID;
                       
                        new quant;

                        string[500];

                        GetPlayerName(plid, pname, MAX_PLAYER_NAME);

			format(file2, sizeof(file2), PASTA_CONTAS, pname);

			format(string, sizeof(string), "({FF0000}(INFO) {FFD700}Vocк recebeu uma multa de R$%d do policial %s. O dinheiro foi retirado do banco.", quant, nome(playerID));
			SendClientMessage(plid, COLOR_GREEN, string);

            format(string, sizeof(string), "{FF0000}(INFO) {FFD700}ATENЗГO : %s Foi multado pelo Policial %s pela quantia de R$%d. (Motivo: Desacato)",pname, nome(playerID), quant);
            SendClientMessageToAll(roxo,string);

			SendClientMessage(playerid, COLOR_GREEN, "{FF0000}(INFO) {FFD700}Multa dada.");

			UsouID[plid] = true;

			SetTimerEx("ResetarMultados", 60000, true, "i", plid);

			dini_IntSet(file2, "SaldoBancario", dini_Int(file2, "SaldoBancario")- quant);
			return 1;
		}
		else
		{
			SendClientMessage(playerid, Vermelho, "{FF0000}(INFO) {FFD700}O jogador nгo estб conectado!");
			return 1;
		}
	}
}
Coloca esse stock no GM

stock nome(playerid)
{
new Name[MAX_PLAYERS];
GetPlayerName(playerid,Name,sizeof(Name));
return Name;
}
Reply
#6

Код:
if(strcmp(cmd, "/multar", true) == 0)
{
	new aname[MAX_PLAYER_NAME];

	GetPlayerName(playerid, aname, MAX_PLAYER_NAME);

	format(file, sizeof(file), PASTA_CONTAS, aname);

	if(dini_Int(file, "Profissao") == Policial_C || dini_Int(file, "Profissao") == Policial_F || dini_Int(file, "Profissao") == Delegado || dini_Int(file, "Profissao") == Bope || dini_Int(file, "Profissao") == Swat || dini_Int(file, "Profissao") == Narcoticos || dini_Int(file, "Profissao") == Policial_M || dini_Int(file, "Profissao") == FBI || dini_Int(file, "Profissao") == Interpol || dini_Int(file, "Profissao") == LSPD || dini_Int(file, "aAdmin") == 1 || IsPlayerAdmin(playerid))
	{
		new tmp[256];
		new plid;

		new quant;

		tmp = strtok(cmdtext, idx);

		if(!strlen(tmp))
		{
			SendClientMessage(playerid, Vermelho, "{FF0000}(INFO) {FF0000}/multar [id] [quantidade]");
			return 1;
		}

		plid = strval(tmp);

		tmp = strtok(cmdtext, idx);

		if(!strlen(tmp))
		{
			SendClientMessage(playerid, Vermelho, "{FF0000}(INFO) {FF0000}/multar [id] [quantidade]");
			return 1;
		}

		if(UsouID[plid] == true) return SendClientMessage(playerid, Vermelho, "{FF0000}(INFO) {FFD700}Espere 1 Minutos para Multar esse ID Novamente!");

		quant = strval(tmp);

		if(quant > 800 || quant <= 0)
		{
			SendClientMessage(playerid, Vermelho, "{FF0000}(INFO) {FFD700}Vocк nгo estб multando de forma justa MAX R$800.");
			return 1;
		}

		if(IsPlayerConnected(plid))
		{
			new pname[MAX_PLAYER_NAME];

			GetPlayerName(plid, pname, MAX_PLAYER_NAME);

			format(file2, sizeof(file2), PASTA_CONTAS, pname);

			format(string, sizeof(string), "({FF0000}(INFO) {FFD700}Vocк recebeu uma multa de R$%d Pelo policial %s . O dinheiro foi retirado do banco.", quant, aname);
			SendClientMessage(plid, COLOR_GREEN, string);

            format(string, sizeof(string), "{FF0000}(INFO) {FFD700}ATENЗГO : %s Foi multado pelo Policial %s com uma quantia de R$%d. (Motivo: %s)",aname);
            SendClientMessageToAll(roxo,string);

			SendClientMessage(playerid, COLOR_GREEN, "{FF0000}(INFO) {FFD700}Multa dada.");

			UsouID[plid] = true;

			SetTimerEx("ResetarMultados", 60000, true, "i", plid);

			dini_IntSet(file2, "SaldoBancario", dini_Int(file2, "SaldoBancario")- quant);
			return 1;
		}
		else
		{
			SendClientMessage(playerid, Vermelho, "{FF0000}(INFO) {FFD700}O jogador nгo estб conectado!");
			return 1;
		}
	}
}
Faltou as variбveis no format.

Vocк ta com a faca e o queijo na mгo...

Uma reflexгo bem bбsica.

Se eu quiser mandar essa mensagem na callback OnPlayerConnect, nгo й sу chegar e por {FFFFFF}%s - [ID: %d] saiu do servidor.

Sinceramente, acha que se eu colocar sу isso irб funcionar?

Код:
Й a mesma coisa disso aqui у, new nPM

nPM significa Nome do Player Multado.

Aн eu faзo isso:

string[128], pMN[MAX_PLAYER_NAME];
GetPlayerName(playerid, nPM, MAX_PLAYER_NAME);
format(string, sizeof, string, "%{FFFFFF}%s - [ID: %d] entrou no servidor", nPM, playerid);
SendClientMessageToAll(-1, string);

Repare nas diferenзas dos dois cуdigos.

A partir desta reflexгo, o senhor nгo tem mais desculpas para dizer que nгo entendeu o que o ipsLuan disse...

Atй logo...
Vou pensar se arrumo o seu cуdigo, mas tente aprender.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)