[Ajuda] Duvida!
#1

ola pessoal so gostaria de saber se esta tudo certinho.

Код:
#include <a_Samp>
#include <Dini>

#if defined FILTERSCRIPT

new DinheiroCaixinha;
new RespeitoCaixinha;

public OnPlayerCommandText(playerid, cmdtext[])
{
   	if(strcmp(cmd, "/travarcaixinha", true) == 0)
 	{
 	    if(IsPlayerConnected(playerid) && PlayerInfo[playerid][pAdmin] > 3)
	 	{
	 	    caixinha = 0;
	 	    SendClientMessage(playerid, COLOR_YELLOW, "[BEG] Caixinha travada!");
	 	}
		return true;
	}
	if(strcmp(cmd, "/liberarcaixinha", true) == 0)
 	{
 	    if(IsPlayerConnected(playerid) && PlayerInfo[playerid][pAdmin] > 3)
	 	{
	 	    caixinha = char;
	 	    SendClientMessage(playerid, COLOR_YELLOW, "[BEG] Caixinha liberada!");
		}
		return true;
	}
	
public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
			//======= Caixinhas - Inicio ========//
		if(PlayerToPoint(2.0,playerid,1468.4370,-1661.2919,15.2203))
        {
            new DinheiroCaixinha = 2000 + random(5000);
    		new RespeitoCaixinha = random(3);
             if(PlayerInfo[playerid][pCaixinha] == char)
            {
                if(caixinha != char){SendClientMessage(playerid, COLOR_GRAD1, "Presentes bloqueados no momento.");return true;}
                SendClientMessage(playerid, COLOR_GRAD1, "Vocк pegou uma caixinha hб pouco tempo, volte no prуximo Payday!");
                return true;
			}
			else
			{
			    if(caixinha != char){SendClientMessage(playerid, COLOR_GRAD1, "Presentes bloqueados no momento.");return true;}
			    PlayerInfo[playerid][pCaixinha] = char;
			    format(string, sizeof(string), "%s pegou uma caixinha e ganhou R$%d e %d de respeito.",PlayerName(playerid), DinheiroCaixinha, RespeitoCaixinha);
			 	SendClientMessageToAll(COLOR_LIGHTRED,string);
			 	GivePlayerMoney(playerid, DinheiroCaixinha);
				PlayerInfo[playerid][pExp] += RespeitoCaixinha;
				format(string, sizeof(string), "Na caixinha continha R$%d e %d de respeito, volte no prуximo Payday!",
			 	DinheiroCaixinha, RespeitoCaixinha);
			 	SendClientMessage(playerid, COLOR_RED, string);
			}
		}
		return true;
	}
	#endif
Reply
#2

Nгo era mais fбcil compilar e testar?

Dando uma breve olhada nota-se que tem alguns erros.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmd, "/travarcaixinha", true) == 0)
    {
"cmd" nгo foi declarado bem como vбrias outras variбveis presentes.

Avisos/dicas.

pawn Код:
IsPlayerConnected(playerid)
Desnecessбrio.

pawn Код:
PlayerToPoint
Jб existe uma funзгo nativa (https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint).

Dini й ultrapassado, use sistemas de salvamento como DOF2, ou Y_INI.

E sem querer ser inconveniente, mas:

pawn Код:
caixinha = char;
Me lembra GMs com base GF.
Reply
#3

Quote:
Originally Posted by iCasTiel
Посмотреть сообщение
Nгo era mais fбcil compilar e testar?

Dando uma breve olhada nota-se que tem alguns erros.

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmd, "/travarcaixinha", true) == 0)
    {
"cmd" nгo foi declarado bem como vбrias outras variбveis presentes.

Avisos/dicas.

pawn Код:
IsPlayerConnected(playerid)
Desnecessбrio.

pawn Код:
PlayerToPoint
Jб existe uma funзгo nativa (https://sampwiki.blast.hk/wiki/IsPlayerInRangeOfPoint).

Dini й ultrapassado, use sistemas de salvamento como DOF2, ou Y_INI.

E sem querer ser inconveniente, mas:

pawn Код:
caixinha = char;
Me lembra GMs com base GF.
sim eu compilei e deu tudo certo mais como sou novo no Pawno nada melhor que ouvir dicas e sugestхes para melhorar, nгo acha?
Reply
#4

Quote:
Originally Posted by AssasinoLM
Посмотреть сообщение
sim eu compilei e deu tudo certo mais como sou novo no Pawno nada melhor que ouvir dicas e sugestхes para melhorar, nгo acha?
pawn Код:
if(strcmp(cmd, "/travarcaixinha", true) == 0)
    {
        if(IsPlayerConnected(playerid) && PlayerInfo[playerid][pAdmin] > 1337) //Coloque as coordenadas aqui
    {
        caixinha = 0;
        SendClientMessage(playerid, COLOR_YELLOW, "[BSF] Caixinha travada!");
    }
    return 1;
}
if(strcmp(cmd, "/liberarcaixinha", true) == 0)
    {
        if(IsPlayerConnected(playerid) && PlayerInfo[playerid][pAdmin] > 1337) //Coloque as coordenadas aqui
    {
        if(strcmp(GetName(playerid),"Bruno_Tadeu",true)==0||strcmp(GetName(playerid),"Ken_xD",true)==0)
        {
            caixinha = char;
            SendClientMessage(playerid, COLOR_YELLOW, "[BSF] Caixinha liberada!");
        }
    }
    return 1;
}

public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
{
    new string[258];
    KeyAtivada[playerid] = true;
    if(newkeys == 16 && GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
    {
        if(!PlayerToPoint(1,playerid,1930.2745,-1772.3357,13.5469))
        {
            CheckForWalkingTeleport(playerid); //Habilitar Interiores sу com "F" by Bruno_Tadeu & Ken_xD ^^
            OnPlayerCommandText(playerid,"/entrar");
            OnPlayerCommandText(playerid,"/sair");
        }
        if(PlayerToPoint(1,playerid,-2032.5986,-117.5708,1035.1719))
        {
            ShowPlayerDialog(playerid, 1332, DIALOG_STYLE_LIST, "Agencia de licencas - [BSF]","Motorista\nAerea\nNautica\nPesca\nPorte de armas ", "Confirma", "Cancela");
        }
    //=======Caixinhas - Inicio========//
        if(PlayerToPoint(25.0,playerid,1515.8346,-1678.8230,14.0469) || PlayerToPoint(25.0,playerid,-2706.8267,376.2434,4.9688))
        {
            new DinheiroCaixinha = 10000 + random(50000);
            new RespeitoCaixinha = random(2);
            if(PlayerInfo[playerid][pCaixinha] == char)
            {
                if(caixinha != char){SendClientMessage(playerid, COLOR_GRAD1, "Presentes bloqueados no momento.");return 1;}
                SendClientMessage(playerid, COLOR_GRAD1, "Vocк pegou uma caixinha hб pouco tempo, volte novamente apуs o prуximo salбrio!");
                return 1;
            }
            else
            {
                if(caixinha != char){SendClientMessage(playerid, COLOR_GRAD1, "Presentes bloqueados no momento.");return 1;}
                PlayerInfo[playerid][pCaixinha] = char;
                format(string, sizeof(string), "Jogador: %s pegou uma caixinha, nela continha %d de dinheiro e %d de respeito.",
                GetName(playerid), DinheiroCaixinha, RespeitoCaixinha);
                SendClientMessageToAll(COLOR_LIGHTRED,string);
                GivePlayerMoneyEx(playerid, DinheiroCaixinha);
                PlayerInfo[playerid][pExp] += RespeitoCaixinha;
                SendClientMessage(playerid, COLOR_RED, "Vocк ganhou uma caixinha de presente,volte novamento apуs o prуximo salбrio!");
                format(string, sizeof(string), "Na caixinha continha %d de dinheiro e %d de respeito !",
                DinheiroCaixinha, RespeitoCaixinha);
                SendClientMessage(playerid, COLOR_RED, string);
            }
        }
Cуdigo acima retirado do SampForever (incompleto).


Minha dica й, nгo retire crйditos.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)