SA-MP Forums Archive
[Pedido] Comando entrar - 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: [Pedido] Comando entrar (/showthread.php?tid=499559)



Comando entrar - giovanehen - 08.03.2014

Ola pessoas queria pedi se tem como deixar em vez de /entrar ser uma letra Tipo Y ?

PHP Code:
COMMAND:entrar(playeridparams[])
{
    
// Setup local variables
    
new HouseIDhLevelBusIDBusType;
    
// Send the command to all admins so they can see it
    
SendAdminText(playerid"/entrar"params);
    
// Check if the player has logged in
    
if (APlayerData[playerid][LoggedIn] == true)
    {
        
// Make sure the player isn't inside a vehicle
        
if (GetPlayerVehicleID(playerid) == 0)
        {
            
// Loop through all houses
            
for (HouseID 1HouseID MAX_HOUSESHouseID++)
            {
                
// Check if this house exists
                
if (AHouseData[HouseID][PickupID] != 0)
                {
                    
// Check if the player is in range of the house-pickup
                    
if (IsPlayerInRangeOfPoint(playerid2.5AHouseData[HouseID][HouseX], AHouseData[HouseID][HouseY], AHouseData[HouseID][HouseZ]))
                    {
                        
// Check if the house is closed to the public
                        
if (AHouseData[HouseID][HouseOpened] == false)
                        {
                            
// The house isn't open to the public, so keep anyone out who isn't the owner of the house
                            
if (House_PlayerIsOwner(playeridHouseID) == 0)
                            {
                                
// Let the player know that this house isn't open to the public and he can't enter it
                                
SendClientMessage(playerid0xFFFFFFFF"{808080}Esta Casa nao esta Aberta ao Publico");
                                return 
1;
                            }
                        }
                        
// The house is open to the public, or the player trying to enter is the owner, so let the player inside the house
                        // Get the level of the house
                        
hLevel AHouseData[HouseID][HouseLevel];
                        
// Set the worldid so other players cannot see him anymore
                        
SetPlayerVirtualWorld(playerid5000 HouseID);
                        
// Set the player inside the interior of the house
                        
SetPlayerInterior(playeridAHouseInteriors[hLevel][InteriorID]);
                        
// Set the position of the player at the spawn-location of the house's interior
                        
SetPlayerPos(playeridAHouseInteriors[hLevel][IntX], AHouseInteriors[hLevel][IntY], AHouseInteriors[hLevel][IntZ]);
                        
// Also set a tracking-variable to enable /housemenu to track in which house the player is
                        
APlayerData[playerid][CurrentHouse] = HouseID;
                        
// Also let the player know he can use /housemenu to upgrade/exit his house
                        
SendClientMessage(playerid0xFFFFFFFF"{FFFFFF}[ToM]{808080}Digite {FFFFFF}/menucasa{808080} para Ver as opcoes da Sua Casa");
                        
// Exit the function
                        
return 1;
                    }
                }
            }
            
// Loop through all player-owned businesses
            
for (new iMAX_BUSINESSPERPLAYERi++)
            {
                
// Get the business-id at the selected slot from the player
                
BusID APlayerData[playerid][Business][i];
                
// Check if the player has owned a business in this slot
                
if (BusID != 0)
                {
                    
// Check if the player is in range of the business-pickup
                    
if (IsPlayerInRangeOfPoint(playerid2.5ABusinessData[BusID][BusinessX], ABusinessData[BusID][BusinessY], ABusinessData[BusID][BusinessZ]))
                    {
                        
// Get the business-type
                        
BusType ABusinessData[BusID][BusinessType];
                        
// Set the worldid so other players cannot see him anymore
                        
SetPlayerVirtualWorld(playerid1000 playerid);
                        
// Set the player inside the interior of the business
                        
SetPlayerInterior(playeridABusinessInteriors[BusType][InteriorID]);
                        
// Set the position of the player at the spawn-location of the business's interior
                        
SetPlayerPos(playeridABusinessInteriors[BusType][IntX], ABusinessInteriors[BusType][IntY], ABusinessInteriors[BusType][IntZ]);
                        
// Also set a tracking-variable to enable /busmenu to track in which business the player is
                        
APlayerData[playerid][CurrentBusiness] = BusID;
                        
// Also let the player know he can use /busmenu to upgrade/exit his business
                        
SendClientMessage(playerid0xFFFFFFFF"{FFFFFF}[ToM]{808080}Digite {FFFFFF}/menuempresa{808080} para ver as Opcoes da Sua Empresa");
                        
// Exit the function
                        
return 1;
                    }
                }
            }
        }
    }
    else
        return 
0;
    
// Let the server know that this was a valid command
    
return 1;




Re: Comando entrar - Dry - 08.03.2014

pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if ( newkeys == 65536 ) cmd_entrar(playerid, params);
    return 1;
}



Re: Comando entrar - giovanehen - 08.03.2014

Onde eu coloco isso ? me explica pfv


Re: Comando entrar - Dry - 08.03.2014

CTRL + F Procurar: OnPlayerKeyStateChenge

Cole o cуdigo a baixo dentro da calback;

pawn Code:
if ( newkeys == 65536 ) cmd_entrar(playerid, params);



Re: Comando entrar - giovanehen - 08.03.2014

Cara n tem isso no meu gm

@Edite
Coloquei no gm e deu 2 erro

PHP Code:
(1710) : error 021symbol already defined"OnPlayerKeyStateChange"
                 
error 017undefined symbol "params" 



Re: Comando entrar - yNexus - 08.03.2014

ele escreveu errado, procure por isso

PHP Code:
OnPlayerKeyStateChange 



Re: Comando entrar - giovanehen - 08.03.2014

Ja achei o das keychange ai mais agora fala que nao ta definido o Params


Re: Comando entrar - DannielCooper - 09.03.2014

nгo precisa usar o params.


Re: Comando entrar - Schocc - 09.03.2014

Quote:
Originally Posted by Dry
View Post
CTRL + F Procurar: OnPlayerKeyStateChenge

Cole o cуdigo a baixo dentro da calback;

pawn Code:
if ( newkeys == 65536 ) cmd_entrar(playerid, #);
Pronto agora esta certinho.