SA-MP Forums Archive
[Ajuda] Me Ajude com esse comando porfavor! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Me Ajude com esse comando porfavor! (/showthread.php?tid=613727)



Me Ajude com esse comando porfavor! - RianRBS - 31.07.2016

Olб galera й o seguinte eu gostбria que o quando o Polнcial utiliza-se o comando Ex: "/Multar 0 1000"
Multa-se o Jogador, tipo eu gostбria que pode-se multar por vбrios valores abaixo de 1000
jб tentei fazer mais deu uns erros entгo resolvi pedi ajuda para vocкs no caso ai eu deixei para tirar o dinheiro do Banco e eu gostбria que remove-se o dinheiro que estive-se na mгo!

Cуdigo abaixo
Ajude-me e ganhe +1 Reputaзгo

Код:
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, "/multar [id] [quantidade]");
			return 1;
		}
		
		plid = strval(tmp);
		
		tmp = strtok(cmdtext, idx);
		
		if(!strlen(tmp)) 
		{
			SendClientMessage(playerid, Vermelho, "/multar [id] [quantidade]");
			return 1;
		}
		
		if(UsouID[plid] == true) return SendClientMessage(playerid, Vermelho, "Esse ID jб foi utilizado!");
		
		quant = strval(tmp);
		
		if(quant > 1000 || quant <= 0)
		{
			SendClientMessage(playerid, Vermelho, "(INFO) Vocк nгo estб multando de forma justa.");
			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), "(INFO) Vocк recebeu uma multa de R$%d Pelo policial %s . O dinheiro foi retirado do banco.", quant, aname);
			SendClientMessage(plid, COLOR_GREEN, string);
			
			SendClientMessage(playerid, COLOR_GREEN, "(INFO) Multa dada.");
			
			UsouID[plid] = true;
			
			SetTimerEx("ResetarMultados", 300000, true, "i", plid);
			
			dini_IntSet(file2, "SaldoBancario", dini_Int(file2, "SaldoBancario")- quant);
			return 1;
		}
		else
		{
			SendClientMessage(playerid, Vermelho, "(INFO) O jogador nгo estб conectado!");
			return 1;
		}
	}
}



Re: Me Ajude com esse comando porfavor! - NegoEnsina - 31.07.2016

O que tem de errado no comando? Alйm de tirar a grana do banco e nгo da mгo


Re: Me Ajude com esse comando porfavor! - RianRBS - 31.07.2016

Quote:
Originally Posted by NegoEnsina
Посмотреть сообщение
O que tem de errado no comando? Alйm de tirar a grana do banco e nгo da mгo
Eu quero que tire o dinhero que estiver na mгo e nгo dinheiro do banco.


Re: Me Ajude com esse comando porfavor! - NegoEnsina - 31.07.2016

Simples.
Substitui:
Код:
dini_IntSet(file2, "SaldoBancario", dini_Int(file2, "SaldoBancario")- quant);
por:
Код:
GivePlayerMoney(plid, -quant);



Re: Me Ajude com esse comando porfavor! - RianRBS - 31.07.2016

Quote:
Originally Posted by NegoEnsina
Посмотреть сообщение
Simples.
Substitui:
Код:
dini_IntSet(file2, "SaldoBancario", dini_Int(file2, "SaldoBancario")- quant);
por:
Код:
GivePlayerMoney(plid, -quant);
Substitui jб mais ele remove o dinheiro e o dinheiro volta novamente !!

botei assim
Код:
{
	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, "/multar [id] [quantidade]");
			return 1;
		}

		plid = strval(tmp);

		tmp = strtok(cmdtext, idx);

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

		if(UsouID[plid] == true) return SendClientMessage(playerid, Vermelho, "Espere 5 minutos para multar esse ID novamente!");

		quant = strval(tmp);

		if(quant > 1000 || quant <= 0)
		{
			SendClientMessage(playerid, Vermelho, "(INFO) Vocк nгo estб multando de forma justa.");
			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), "(INFO) Vocк recebeu uma multa de R$%d Pelo policial %s . O dinheiro foi retirado do banco.", quant, aname);
			SendClientMessage(plid, COLOR_GREEN, string);

			SendClientMessage(playerid, COLOR_GREEN, "(INFO) Multa dada.");

			UsouID[plid] = true;

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

            GivePlayerMoney(plid, -quant);
			return 1;
		}
		else
		{
			SendClientMessage(playerid, Vermelho, "(INFO) O jogador nгo estб conectado!");
			return 1;
		}
	}
}



Respuesta: Me Ajude com esse comando porfavor! - SammyJ - 31.07.2016

Veja qual funзгo auxiliar tira dinheiro do jogador !


Re: Me Ajude com esse comando porfavor! - SkullFire - 31.07.2016

^
Seu gamemode deve ter uma espйcie de anti-cheat que nгo permite tirar a grana dessa forma.
Deve ter outra maneira de retirar dinheiro do jogador...


Re: Me Ajude com esse comando porfavor! - Kamper - 31.07.2016

Eu ia ajudar mas vi que vocк tem menos de 50 posts e por isso nгo pode dar a reputaзгo que prometeu.


Re: Me Ajude com esse comando porfavor! - RianRBS - 31.07.2016

Galera consegui modifiquei o GivePlayerMoney(plid, -quant); para GivePlayerGrana(plid, -quant); que й a funзгo de dar dinheiro obrigado mesmo assim a todos obrigado NegoEnsina.