[Ajuda] Problema com Comando
#1

Bom estou com 2 comandos e quero tipo pra somente quem tem Cash poder comprar / colocar e quando retirar devolver o cash de volta o problema que estou й que quando vai criar mesmo sem o valor de cash de 250 que setei da pra criar e quando vou destruir nгo devolve os cash.

Aqui estгo os cуdigos:
Код:
CMD:criarportao( playerid, params[] )
{
	if ( pInfo[playerid][MoedasCash] >= 250 )
	{
			if( isnull( params) )
			    return SendClientMessage( playerid, -1, "[ > ]: /criarportao [Senha]" );

			if( !strval( params ) )
			    return SendClientMessage( playerid, -1, "[ > ]: USE SOMENTE NUMEROS." );

			if( IsPlayerInAnyVehicle( playerid ) )
			    return SendClientMessage( playerid, -1, "[ > ] Saia Do Veiculo !" );

			new Float:pPosPortao[4];
			GetPlayerPos( playerid, pPosPortao[0], pPosPortao[1], pPosPortao[2] );
			GetPlayerFacingAngle( playerid, pPosPortao[3] );
			CreateGate( playerid, strval( params ), pPosPortao[0], pPosPortao[1], pPosPortao[2], pPosPortao[3] );
			SendClientMessage( playerid, -1, "[ > ] Portгo Criado Com Sucesso" );
			
	} else return	SendClientMessage(playerid, AZUL_BPH, "Vocк nгo tem Cash suficiente criar um Portгo.");
	return 1;
}
Код:
CMD:destruirportao( playerid, params[] )
{
	for( new i = 0; i != MAX_GATES; i++ )
	{
		if( GateInfo[i][gCreated] == 1 )
		{
		    if( IsPlayerInRangeOfPoint( playerid, 10.0, GateInfo[i][gX], GateInfo[i][gY], GateInfo[i][gZ] ) )
			{
  				new szName[24];
				GetPlayerName( playerid, szName, 24 );
				if( !strcmp( szName, GateInfo[i][gPlacedBy], true ) || IsPlayerAdmin( playerid ) )
				{
					DestroyObject( GateInfo[i][gObject] );
					format( GateInfo[i][gPlacedBy], 24, "None" );
			        GateInfo[i][gCreated] = 0;
			        GateInfo[i][gX] = 0.0;
			        GateInfo[i][gY] = 0.0;
			        GateInfo[i][gZ] = 0.0;
			        GateInfo[i][gA] = 0.0;
			        GateInfo[i][gPassword] = 0;
			        GateInfo[i][gStatus] = GATE_STATE_CLOSED;
			        //BPH_SetInt(gFile, "MoedasCash", BPH_GetInt(gFile, "MoedasCash") + 250);
			        //pInfo[playerid][MoedasCash] -= 250;
			        SendClientMessage( playerid, -1, "[ > ] Voce Destruiu o portao e recebeu seus 250 Cash de volta para criar outro." );

					new file[32];
					format( file, 32, "Gates/gate_%d.ini", i );
					if( BPH_FileExists( file ) )
	    				BPH_RemoveFile( file );
					break;
                }

				else
					return SendClientMessage( playerid, -1, "Voce Nao E Dono Deste Portгo" );
			}

			else
				return SendClientMessage( playerid, -1, "Nao Hб Portгo no local !" );
        }
    }
	return 1;
}
Reply
#2

PHP код:
CMD:criarportaoplayeridparams[] )
{
    if ( 
pInfo[playerid][MoedasCash] >= 250 )
    {
            if( 
isnullparams) )
                return 
SendClientMessageplayerid, -1"[ > ]: /criarportao [Senha]" );

            if( !
strvalparams ) )
                return 
SendClientMessageplayerid, -1"[ > ]: USE SOMENTE NUMEROS." );

            if( 
IsPlayerInAnyVehicleplayerid ) )
                return 
SendClientMessageplayerid, -1"[ > ] Saia Do Veiculo !" );

            new 
Float:pPosPortao[4];
            
GetPlayerPosplayeridpPosPortao[0], pPosPortao[1], pPosPortao[2] );
            
GetPlayerFacingAngleplayeridpPosPortao[3] );
            
CreateGateplayeridstrvalparams ), pPosPortao[0], pPosPortao[1], pPosPortao[2], pPosPortao[3] );
            
SendClientMessageplayerid, -1"[ > ] Portгo Criado Com Sucesso" );
            
pInfo[playerid][MoedasCash] -= 250;
               
BPH_SetInt(gFile"MoedasCash"BPH_GetInt(gFile"MoedasCash") -= 250);

    } else return    
SendClientMessage(playeridAZUL_BPH"Vocк nгo tem Cash suficiente criar um Portгo.");
    return 
1;

PHP код:
CMD:destruirportaoplayeridparams[] )
{
    for( new 
0!= MAX_GATESi++ )
    {
        if( 
GateInfo[i][gCreated] == )
        {
            if( 
IsPlayerInRangeOfPointplayerid10.0GateInfo[i][gX], GateInfo[i][gY], GateInfo[i][gZ] ) )
            {
                  new 
szName[24];
                
GetPlayerNameplayeridszName24 );
                if( !
strcmpszNameGateInfo[i][gPlacedBy], true ) || IsPlayerAdminplayerid ) )
                {
                    
DestroyObjectGateInfo[i][gObject] );
                    
formatGateInfo[i][gPlacedBy], 24"None" );
                    
GateInfo[i][gCreated] = 0;
                    
GateInfo[i][gX] = 0.0;
                    
GateInfo[i][gY] = 0.0;
                    
GateInfo[i][gZ] = 0.0;
                    
GateInfo[i][gA] = 0.0;
                    
GateInfo[i][gPassword] = 0;
                    
GateInfo[i][gStatus] = GATE_STATE_CLOSED;
                    
pInfo[playerid][MoedasCash] += 250;
                    
BPH_SetInt(gFile"MoedasCash"BPH_GetInt(gFile"MoedasCash") += 250);
                    
SendClientMessageplayerid, -1"[ > ] Voce Destruiu o portao e recebeu seus 250 Cash de volta para criar outro." );

                    new 
file[32];
                    
formatfile32"Gates/gate_%d.ini");
                    if( 
BPH_FileExistsfile ) )
                        
BPH_RemoveFilefile );
                    break;
                }

                else
                    return 
SendClientMessageplayerid, -1"Voce Nao E Dono Deste Portгo" );
            }

            else
                return 
SendClientMessageplayerid, -1"Nao Hб Portгo no local !" );
        }
    }
    return 
1;

Reply
#3

Quote:
Originally Posted by Relaxed
Посмотреть сообщение
PHP код:
CMD:criarportaoplayeridparams[] )
{
    if ( 
pInfo[playerid][MoedasCash] >= 250 )
    {
            if( 
isnullparams) )
                return 
SendClientMessageplayerid, -1"[ > ]: /criarportao [Senha]" );
            if( !
strvalparams ) )
                return 
SendClientMessageplayerid, -1"[ > ]: USE SOMENTE NUMEROS." );
            if( 
IsPlayerInAnyVehicleplayerid ) )
                return 
SendClientMessageplayerid, -1"[ > ] Saia Do Veiculo !" );
            new 
Float:pPosPortao[4];
            
GetPlayerPosplayeridpPosPortao[0], pPosPortao[1], pPosPortao[2] );
            
GetPlayerFacingAngleplayeridpPosPortao[3] );
            
CreateGateplayeridstrvalparams ), pPosPortao[0], pPosPortao[1], pPosPortao[2], pPosPortao[3] );
            
SendClientMessageplayerid, -1"[ > ] Portгo Criado Com Sucesso" );
            
pInfo[playerid][MoedasCash] -= 250;
               
BPH_SetInt(gFile"MoedasCash"BPH_GetInt(gFile"MoedasCash") -= 250);
    } else return    
SendClientMessage(playeridAZUL_BPH"Vocк nгo tem Cash suficiente criar um Portгo.");
    return 
1;

PHP код:
CMD:destruirportaoplayeridparams[] )
{
    for( new 
0!= MAX_GATESi++ )
    {
        if( 
GateInfo[i][gCreated] == )
        {
            if( 
IsPlayerInRangeOfPointplayerid10.0GateInfo[i][gX], GateInfo[i][gY], GateInfo[i][gZ] ) )
            {
                  new 
szName[24];
                
GetPlayerNameplayeridszName24 );
                if( !
strcmpszNameGateInfo[i][gPlacedBy], true ) || IsPlayerAdminplayerid ) )
                {
                    
DestroyObjectGateInfo[i][gObject] );
                    
formatGateInfo[i][gPlacedBy], 24"None" );
                    
GateInfo[i][gCreated] = 0;
                    
GateInfo[i][gX] = 0.0;
                    
GateInfo[i][gY] = 0.0;
                    
GateInfo[i][gZ] = 0.0;
                    
GateInfo[i][gA] = 0.0;
                    
GateInfo[i][gPassword] = 0;
                    
GateInfo[i][gStatus] = GATE_STATE_CLOSED;
                    
pInfo[playerid][MoedasCash] += 250;
                    
BPH_SetInt(gFile"MoedasCash"BPH_GetInt(gFile"MoedasCash") += 250);
                    
SendClientMessageplayerid, -1"[ > ] Voce Destruiu o portao e recebeu seus 250 Cash de volta para criar outro." );
                    new 
file[32];
                    
formatfile32"Gates/gate_%d.ini");
                    if( 
BPH_FileExistsfile ) )
                        
BPH_RemoveFilefile );
                    break;
                }
                else
                    return 
SendClientMessageplayerid, -1"Voce Nao E Dono Deste Portгo" );
            }
            else
                return 
SendClientMessageplayerid, -1"Nao Hб Portгo no local !" );
        }
    }
    return 
1;

Deu erro:
C:\Users\Natan\Desktop\Brasil Power Hard\gamemodes\BPH.pwn(58693) : warning 217: loose indentation
C:\Users\Natan\Desktop\Brasil Power Hard\gamemodes\BPH.pwn(58693) : error 022: must be lvalue (non-constant)
C:\Users\Natan\Desktop\Brasil Power Hard\gamemodes\BPH.pwn(58693) : warning 215: expression has no effect
C:\Users\Natan\Desktop\Brasil Power Hard\gamemodes\BPH.pwn(58693) : error 001: expected token: ";", but found ")"
C:\Users\Natan\Desktop\Brasil Power Hard\gamemodes\BPH.pwn(58693) : error 029: invalid expression, assumed zero
C:\Users\Natan\Desktop\Brasil Power Hard\gamemodes\BPH.pwn(58693) : fatal error 107: too many error messages on one line

Nessa linha:
PHP код:
               BPH_SetInt(gFile"MoedasCash"BPH_GetInt(gFile"MoedasCash") -= 250); 
Reply
#4

PHP код:
CMD:criarportaoplayeridparams[] )
{
    if ( 
pInfo[playerid][MoedasCash] >= 250 )
    {
            if( 
isnullparams) )
                return 
SendClientMessageplayerid, -1"[ > ]: /criarportao [Senha]" );

            if( !
strvalparams ) )
                return 
SendClientMessageplayerid, -1"[ > ]: USE SOMENTE NUMEROS." );

            if( 
IsPlayerInAnyVehicleplayerid ) )
                return 
SendClientMessageplayerid, -1"[ > ] Saia Do Veiculo !" );

            new 
Float:pPosPortao[4];
            
GetPlayerPosplayeridpPosPortao[0], pPosPortao[1], pPosPortao[2] );
            
GetPlayerFacingAngleplayeridpPosPortao[3] );
            
CreateGateplayeridstrvalparams ), pPosPortao[0], pPosPortao[1], pPosPortao[2], pPosPortao[3] );
            
SendClientMessageplayerid, -1"[ > ] Portгo Criado Com Sucesso" );
            
pInfo[playerid][MoedasCash] -= 250;

    } else return    
SendClientMessage(playeridAZUL_BPH"Vocк nгo tem Cash suficiente criar um Portгo.");
    return 
1;
}
// destruir
CMD:destruirportaoplayeridparams[] )
{
    for( new 
0!= MAX_GATESi++ )
    {
        if( 
GateInfo[i][gCreated] == )
        {
            if( 
IsPlayerInRangeOfPointplayerid10.0GateInfo[i][gX], GateInfo[i][gY], GateInfo[i][gZ] ) )
            {
                  new 
szName[24];
                
GetPlayerNameplayeridszName24 );
                if( !
strcmpszNameGateInfo[i][gPlacedBy], true ) || IsPlayerAdminplayerid ) )
                {
                    
DestroyObjectGateInfo[i][gObject] );
                    
formatGateInfo[i][gPlacedBy], 24"None" );
                    
GateInfo[i][gCreated] = 0;
                    
GateInfo[i][gX] = 0.0;
                    
GateInfo[i][gY] = 0.0;
                    
GateInfo[i][gZ] = 0.0;
                    
GateInfo[i][gA] = 0.0;
                    
GateInfo[i][gPassword] = 0;
                    
GateInfo[i][gStatus] = GATE_STATE_CLOSED;
                    
pInfo[playerid][MoedasCash] += 250;
                    
SendClientMessageplayerid, -1"[ > ] Voce Destruiu o portao e recebeu seus 250 Cash de volta para criar outro." );

                    new 
file[32];
                    
formatfile32"Gates/gate_%d.ini");
                    if( 
BPH_FileExistsfile ) )
                        
BPH_RemoveFilefile );
                    break;
                }

                else
                    return 
SendClientMessageplayerid, -1"Voce Nao E Dono Deste Portгo" );
            }

            else
                return 
SendClientMessageplayerid, -1"Nao Hб Portгo no local !" );
        }
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)