[Ajuda] Atalho no teclado
#1

Boas pessoal, eu queria saber se alguйm me podia ajudar em duas coisas.
Eu tenho o comando /entrar e /sair, e eu queria que voces me ajudassem a fazer uma KEY, para dar para fazer o /entrar e o /sair no SPACE.

Код:
if(strcmp(cmd, "/entrar", true) == 0)
	{
		for(new i = 0; i < sizeof(Houses); i++)
		{
			if(IsPlayerInRangeOfPoint(playerid,1.0,Houses[i][EnterX],Houses[i][EnterY],Houses[i][EnterZ]))
			{
				if(GetPlayerVirtualWorld(playerid) == Houses[i][EnterWorld])
			   	{
					if(PlayerInfo[playerid][pHouseKey] == i || Houses[i][Locked] == 0 || PlayerInfo[playerid][pAdmin] >= 1)
					{
						SetPlayerInterior(playerid,Houses[i][ExitInterior]);
						SetPlayerPos(playerid,Houses[i][ExitX],Houses[i][ExitY],Houses[i][ExitZ]);
						SetPlayerVirtualWorld(playerid,i);
						SetPlayerFacingAngle(playerid,Houses[i][ExitAngle]);
     }
					else
					{
						GameTextForPlayer(playerid, "~r~Trancado", 5000, 1);
					}
				}
			}
		}
		for(new i = 0; i < sizeof(Building); i++)
  		{
			if(IsPlayerInRangeOfPoint(playerid,1.0,Building[i][EnterX],Building[i][EnterY],Building[i][EnterZ]))
			{
			    if(GetPlayerVirtualWorld(playerid) == Building[i][EnterWorld])
			    {
					if(Building[i][Locked] == 0 || PlayerInfo[playerid][pAdmin] >=  1)
					{
						SetPlayerInterior(playerid,Building[i][ExitInterior]);
						SetPlayerVirtualWorld(playerid,i);
						SetPlayerPos(playerid,Building[i][ExitX],Building[i][ExitY],Building[i][ExitZ]);
						SetPlayerFacingAngle(playerid,Building[i][ExitAngle]);
						GivePlayerCash(playerid,-Building[i][EntranceFee]);
					}
					else
					{
						GameTextForPlayer(playerid, "~r~Trancado", 5000, 1);
					}
				}
			}
		}
		for(new i = 0; i < sizeof(Businesses); i++)
		{
			if(IsPlayerInRangeOfPoint(playerid,1.0,Businesses[i][EnterX],Businesses[i][EnterY],Businesses[i][EnterZ]))
			{
	 			if(GetPlayerVirtualWorld(playerid) == Businesses[i][EnterWorld])
	    		{
					if(PlayerInfo[playerid][pBizKey] == i || GetPlayerCash(playerid) >= Businesses[i][EntranceCost])
					{
						if(PlayerInfo[playerid][pBizKey] != i)
						{
							if(Businesses[i][Locked] == 1 && PlayerInfo[playerid][pAdmin] == 0)
							{
								GameTextForPlayer(playerid, "~r~Negуcio Trancado", 5000, 1);
								return 1;
							}
							if(Businesses[i][Products] == 0)
							{
								GameTextForPlayer(playerid, "~r~Sem Produtos", 5000, 1);
								return 1;
							}
							GivePlayerCash(playerid,-Businesses[i][EntranceCost]);
							format(string, sizeof(string), "[Info:] You have been charged $%d to enter %s", Businesses[i][EntranceCost],Businesses[i][BusinessName]);
							SendClientMessage(playerid,COLOR_WHITE,string);
							Businesses[i][Till] += Businesses[i][EntranceCost];
							Businesses[i][Products]--;
							SetPlayerInterior(playerid,Businesses[i][ExitInterior]);
							SetPlayerPos(playerid,Businesses[i][ExitX],Businesses[i][ExitY],Businesses[i][ExitZ]);
							SetPlayerVirtualWorld(playerid,i);
							SetPlayerFacingAngle(playerid,Businesses[i][ExitAngle]);
							SaveBusinesses();
						}
						else
						{
							SendClientMessage(playerid, COLOR_WHITE, "[Info:] Free entrance for the boss");
							SetPlayerInterior(playerid,Businesses[i][ExitInterior]);
							SetPlayerPos(playerid,Businesses[i][ExitX],Businesses[i][ExitY],Businesses[i][ExitZ]);
							SetPlayerVirtualWorld(playerid,i);
							SetPlayerFacingAngle(playerid,Businesses[i][ExitAngle]);
						}
					}
					else
					{
						SendClientMessage(playerid, COLOR_GREY, "[Error:] You do not have enough money");
					}
				}
			}
		}
		return 1;
	}


Код:
if(strcmp(cmd, "/sair", true) == 0)
	{
 		if(IsPlayerConnected(playerid))
		{
		    new carid = GetPlayerVehicleID(playerid);
			if(IsAnOwnableCar(carid) && DynamicCars[carid][cOwned] == 0)
		   	{
		       	RemoveDriverFromVehicle(playerid);
	    	}
	 		for(new i = 0; i < sizeof(Houses); i++)
			{
				if(IsPlayerInRangeOfPoint(playerid,3.0,Houses[i][ExitX],Houses[i][ExitY],Houses[i][ExitZ]))
				{
	   				if(GetPlayerVirtualWorld(playerid) == i)
				    {
				        if(Houses[i][Locked] == 0 || PlayerInfo[playerid][pAdmin] >=  1)
						{
							SetPlayerInterior(playerid,Houses[i][EnterInterior]);
							SetPlayerPos(playerid,Houses[i][EnterX],Houses[i][EnterY],Houses[i][EnterZ]);
							SetPlayerVirtualWorld(playerid,Houses[i][EnterWorld]);
							SetPlayerFacingAngle(playerid,Houses[i][EnterAngle]);
						}
						else
						{
							GameTextForPlayer(playerid, "~r~Door Locked", 5000, 1);
						}
					}
				}
			}
			for(new i = 0; i < sizeof(Building); i++)
			{
				if(IsPlayerInRangeOfPoint(playerid,3.0,Building[i][ExitX],Building[i][ExitY],Building[i][ExitZ]))
				{
				    if(GetPlayerVirtualWorld(playerid) == i)
				    {
						if(Building[i][Locked] == 0 || PlayerInfo[playerid][pAdmin] >=  1)
						{
							SetPlayerInterior(playerid,Building[i][EnterInterior]);
							SetPlayerVirtualWorld(playerid,Building[i][EnterWorld]);
							SetPlayerPos(playerid,Building[i][EnterX],Building[i][EnterY],Building[i][EnterZ]);
							SetPlayerFacingAngle(playerid,Building[i][EnterAngle]);
						}
						else
						{
							GameTextForPlayer(playerid, "~r~Door Locked", 5000, 1);
						}
					}
				}
			}
	  		for(new i = 0; i < sizeof(Businesses); i++)
			{
				if(IsPlayerInRangeOfPoint(playerid,3.0,Businesses[i][ExitX],Businesses[i][ExitY],Businesses[i][ExitZ]))
				{
				    if(GetPlayerVirtualWorld(playerid) == i)
				    {
						if(Businesses[i][Locked] == 0 || PlayerInfo[playerid][pAdmin] >=  1)
						{
							SetPlayerInterior(playerid,Businesses[i][EnterInterior]);
							SetPlayerVirtualWorld(playerid,Businesses[i][EnterWorld]);
							SetPlayerPos(playerid,Businesses[i][EnterX],Businesses[i][EnterY],Businesses[i][EnterZ]);
							SetPlayerFacingAngle(playerid,Businesses[i][EnterAngle]);
						}
						else
						{
							GameTextForPlayer(playerid, "~r~Door Locked", 5000, 1);
						}
					}
				}
			}
		}
		return 1;
	}
Reply
#2

EM
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
PONHA ISSO
pawn Код:
if(newkeys == KEY_SPRINT)
{
     return OnPlayerCommandText(playerid,"/entrar");
}
if(newkeys == KEY_SPRINT)
{
     return OnPlayerCommandText(playerid,"/sair");
}
Reply
#3

Obrigado so que ha 1 problema
Funcionou no /entrar mas no /sair nao da :/
Reply
#4

@@ aki

se der erro fala.

pawn Код:
//onplayercommandtext
    if(strcmp(cmd, "/sair", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            new carid = GetPlayerVehicleID(playerid);
            if(IsAnOwnableCar(carid) && DynamicCars[carid][cOwned] == 0)
            {
                RemoveDriverFromVehicle(playerid);
            }
            for(new x = 0; x < sizeof(Houses); x++)
            {
                    if(GetPlayerVirtualWorld(playerid) == i)
                    {
                        if(Houses[x][Locked] == 0 || PlayerInfo[playerid][pAdmin] >=  1)
                        {
                            SetPlayerInterior(playerid,Houses[x][EnterInterior]);
                            SetPlayerPos(playerid,Houses[x][EnterX],Houses[x][EnterY],Houses[x][EnterZ]);
                            SetPlayerVirtualWorld(playerid,Houses[x][EnterWorld]);
                            SetPlayerFacingAngle(playerid,Houses[x][EnterAngle]);
                        }
                        else
                        {
                            GameTextForPlayer(playerid, "~r~Door Locked", 5000, 1);
                        }
                    }
            }
            for(new a = 0; a < sizeof(Building); a++)
            {
                    if(GetPlayerVirtualWorld(playerid) == i)
                    {
                        if(Building[a][Locked] == 0 || PlayerInfo[playerid][pAdmin] >=  1)
                        {
                            SetPlayerInterior(playerid,Building[a][EnterInterior]);
                            SetPlayerVirtualWorld(playerid,Building[a][EnterWorld]);
                            SetPlayerPos(playerid,Building[a][EnterX],Building[a][EnterY],Building[a][EnterZ]);
                            SetPlayerFacingAngle(playerid,Building[a][EnterAngle]);
                        }
                        else
                        {
                            GameTextForPlayer(playerid, "~r~Door Locked", 5000, 1);
                        }
                    }
            }
            for(new i = 0; i < sizeof(Businesses); i++)
            {
                    if(GetPlayerVirtualWorld(playerid) == i)
                    {
                        if(Businesses[i][Locked] == 0 || PlayerInfo[playerid][pAdmin] >=  1)
                        {
                            SetPlayerInterior(playerid,Businesses[i][EnterInterior]);
                            SetPlayerVirtualWorld(playerid,Businesses[i][EnterWorld]);
                            SetPlayerPos(playerid,Businesses[i][EnterX],Businesses[i][EnterY],Businesses[i][EnterZ]);
                            SetPlayerFacingAngle(playerid,Businesses[i][EnterAngle]);
                        }
                        else
                        {
                            GameTextForPlayer(playerid, "~r~Door Locked", 5000, 1);
                        }
                    }
            }
        }
        return 1;
    }

    if(strcmp(cmd, "/entrar", true) == 0)
    {
        for(new x = 0; x < sizeof(Houses); x++)
        {
                if(GetPlayerVirtualWorld(playerid) == Houses[x][EnterWorld])
                {
                    if(PlayerInfo[playerid][pHouseKey] == x || Houses[x][Locked] == 0 || PlayerInfo[playerid][pAdmin] >= 1)
                    {
                        SetPlayerInterior(playerid,Houses[x][ExitInterior]);
                        SetPlayerPos(playerid,Houses[x][ExitX],Houses[x][ExitY],Houses[x][ExitZ]);
                        SetPlayerVirtualWorld(playerid,x);
                        SetPlayerFacingAngle(playerid,Houses[x][ExitAngle]);
                    }
                    else
                    {
                        GameTextForPlayer(playerid, "~r~Trancado", 5000, 1);
                    }
                }
        }
        for(new a = 0; a < sizeof(Building); a++)
        {
                if(GetPlayerVirtualWorld(playerid) == Building[a][EnterWorld])
                {
                    if(Building[a][Locked] == 0 || PlayerInfo[playerid][pAdmin] >=  1)
                    {
                        SetPlayerInterior(playerid,Building[a][ExitInterior]);
                        SetPlayerVirtualWorld(playerid,a);
                        SetPlayerPos(playerid,Building[a][ExitX],Building[a][ExitY],Building[a][ExitZ]);
                        SetPlayerFacingAngle(playerid,Building[a][ExitAngle]);
                        GivePlayerCash(playerid,-Building[a][EntranceFee]);
                    }
                    else
                    {
                        GameTextForPlayer(playerid, "~r~Trancado", 5000, 1);
                    }
                }
        }
        for(new i = 0; i < sizeof(Businesses); i++)
        {
                if(GetPlayerVirtualWorld(playerid) == Businesses[i][EnterWorld])
                {
                    if(PlayerInfo[playerid][pBizKey] == i || GetPlayerCash(playerid) >= Businesses[i][EntranceCost])
                    {
                        if(PlayerInfo[playerid][pBizKey] != i)
                        {
                            if(Businesses[i][Locked] == 1 && PlayerInfo[playerid][pAdmin] == 0)
                            {
                                GameTextForPlayer(playerid, "~r~Negуcio Trancado", 5000, 1);
                                return 1;
                            }
                            if(Businesses[i][Products] == 0)
                            {
                                GameTextForPlayer(playerid, "~r~Sem Produtos", 5000, 1);
                                return 1;
                            }
                            GivePlayerCash(playerid,-Businesses[i][EntranceCost]);
                            format(string, sizeof(string), "[Info:] You have been charged $%d to enter %s", Businesses[i][EntranceCost],Businesses[i][BusinessName]);
                            SendClientMessage(playerid,COLOR_WHITE,string);
                            Businesses[i][Till] += Businesses[i][EntranceCost];
                            Businesses[i][Products]--;
                            SetPlayerInterior(playerid,Businesses[i][ExitInterior]);
                            SetPlayerPos(playerid,Businesses[i][ExitX],Businesses[i][ExitY],Businesses[i][ExitZ]);
                            SetPlayerVirtualWorld(playerid,i);
                            SetPlayerFacingAngle(playerid,Businesses[i][ExitAngle]);
                            SaveBusinesses();
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_WHITE, "[Info:] Free entrance for the boss");
                            SetPlayerInterior(playerid,Businesses[i][ExitInterior]);
                            SetPlayerPos(playerid,Businesses[i][ExitX],Businesses[i][ExitY],Businesses[i][ExitZ]);
                            SetPlayerVirtualWorld(playerid,i);
                            SetPlayerFacingAngle(playerid,Businesses[i][ExitAngle]);
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "[Error:] You do not have enough money");
                    }
                }
        }
        return 1;
    }

//public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
if(newkeys == KEY_SPRINT)
{
    for(new i = 0; i < sizeof(Businesses); i++)
    for(new x = 0; x < sizeof(Houses); x++)
    for(new a = 0; a < sizeof(Building); a++)
    if(IsPlayerInRangeOfPoint(playerid,1.0,Businesses[i][EnterX],Businesses[i][EnterY],Businesses[i][EnterZ]) || IsPlayerInRangeOfPoint(playerid,1.0,Houses[x][EnterX],Houses[x][EnterY],Houses[x][EnterZ]) || IsPlayerInRangeOfPoint(playerid,1.0,Building[a][EnterX],Building[a][EnterY],Building[a][EnterZ]))
    {
        return OnPlayerCommandText(playerid,"/entrar");
    }
    else if(IsPlayerInRangeOfPoint(playerid,3.0,Businesses[i][ExitX],Businesses[i][ExitY],Businesses[i][ExitZ]) || IsPlayerInRangeOfPoint(playerid,3.0,Houses[x][ExitX],Houses[x][ExitY],Houses[x][ExitZ]) || IsPlayerInRangeOfPoint(playerid,3.0,Building[a][ExitX],Building[a][ExitY],Building[a][ExitZ]))
    {
        return OnPlayerCommandText(playerid,"/sair");
    }
}
Reply
#5

Obrigado, funcionou bugvip

Cumpszzz,
Swat
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)