SA-MP Forums Archive
[Ajuda] Trancar - 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] Trancar (/showthread.php?tid=335058)



[Ajuda] Trancar - GReeN_WOoD - 17.04.2012

Olб galera, bom й o seguinte meu sistema de conce й GF.
O rjjj postou um cуdigo de "/veiculo".
Ceto, sу que na parte de trancar, o cara sу pode trancar o veiculo se estiver dentro dele, e se eu sair, dou /trancar denovo, diz que o veiculo foi destrancado mais ele nгo abre, queria um tipo o cara digitava /trancar abria todos os carros vips dele, /trancar (novamente) destrancava todos os carros vips dele.
+ REP.


Re: [Ajuda] Trancar - CristoferBahr - 17.04.2012

Posta o code '-'


Re: [Ajuda] Trancar - Edu33 - 17.04.2012

Nгo precisa vou ver na minha bola de cristal


Re: [Ajuda] Trancar - GReeN_WOoD - 17.04.2012

ah desculpe, mais ninguйm conhece o 'GODFATHER'.
kkkkkkkkkkkkkk'

PHP Code:
        if(strcmp(tmp"trancar"true) == 0)
        {
            if(
PlayerInfo[playerid][pCarKey] == && PlayerInfo[playerid][pCarKey2] == 0)
            {
                
SendClientMessage(playeridCOLOR_GREY"Vocк nгo tem um Carro VIP.");
                return 
true;
            }
            if(!
IsPlayerInVehicle(playeridCarInfo[PlayerInfo[playerid][pVeiculo]][ownedvehicle]) && !IsPlayerInVehicle(playeridCarInfo[PlayerInfo[playerid][pVeiculo2]][ownedvehicle]))
            {
                
SendClientMessage(playeridCOLOR_GREY"Esse nгo й seu Carro VIP.");
                return 
true;
            }
            new 
keycar;
            if(
vehid == CarInfo[PlayerInfo[playerid][pVeiculo]][ownedvehicle]) keycar PlayerInfo[playerid][pVeiculo];
            if(
vehid == CarInfo[PlayerInfo[playerid][pVeiculo2]][ownedvehicle]) keycar PlayerInfo[playerid][pVeiculo2];
            if(
IsPlayerConnected(playerid))
            {
                if(
CarInfo[keycar][cLock] == 1)
                {
                for(new 
0MAX_PLAYERSi++)
                {
                    if(
IsPlayerConnected(i)) SetVehicleParamsForPlayer(CarInfo[keycar][ownedvehicle],i,0,0);
                }
                
format(stringsizeof(string), "~w~Veiculo VIP~n~~g~Aberto");
                
PlayerPlaySound(playerid11450.00.00.0);
                
GameTextForPlayer(playeridstring100003);
                
CarInfo[keycar][cLock] = 0;
                return 
true;
                }
                else
                {
                for(new 
0MAX_PLAYERSi++)
                {
                    if(
IsPlayerConnected(i)) SetVehicleParamsForPlayer(CarInfo[keycar][ownedvehicle],i,0,1);
                }
                
format(stringsizeof(string), "~w~Veiculo VIP~n~~r~Trancado");
                
PlayerPlaySound(playerid11450.00.00.0);
                
GameTextForPlayer(playeridstring100003);
                
CarInfo[keycar][cLock] = 1;
                return 
true;
                }
            }
            return 
true;
        } 
Esta funзгo abaixo sу tranca o veiculo se estiver dentro dele, eu queria que nгo precisasse ser dentro do veiculo, basta digitar o comando.
PHP Code:
          if(!IsPlayerInVehicle(playeridCarInfo[PlayerInfo[playerid][pVeiculo]][ownedvehicle]) && !IsPlayerInVehicle(playeridCarInfo[PlayerInfo[playerid][pVeiculo2]][ownedvehicle]))
            {
                
SendClientMessage(playeridCOLOR_GREY"Esse nгo й seu Carro VIP.");
                return 
true;
            } 
E na que destranca, o veiculo nao destranca! sу diz a mensagem destrancado, mais continua trancado.


- GReeN_WOoD - 17.04.2012

ninguem ?


Re: [Ajuda] Trancar - GReeN_WOoD - 17.04.2012

Alguйm ajuda ?


Re: [Ajuda] Trancar - CidadeNovaRP - 17.04.2012

Ta ae :
pawn Code:
if(strcmp(cmd, "/trancar", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD1, "USE: /trancar [CAR ID]");
                return true;
            }
            new testcar = strval(tmp);
            if(PlayerInfo[playerid][pCarKey] == 0 && PlayerInfo[playerid][pCarKey2] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "Vocк nгo tem um Carro VIP.");
                return true;
            }
            if(testcar == CarInfo[PlayerInfo[playerid][pVeiculo]][ownedvehicle] && testcar == CarInfo[PlayerInfo[playerid][pVeiculo2]][ownedvehicle])
            {
                SendClientMessage(playerid, COLOR_GREY, "Esse nгo й seu Carro VIP.");
                return true;
            }
            if(IsPlayerConnected(playerid))
            {
                if(CarInfo[testcar][cLock] == 1)
                {
                for(new i = 0; i < MAX_PLAYERS; i++)
                {
                    if(IsPlayerConnected(i)) SetVehicleParamsForPlayer(CarInfo[testcar][ownedvehicle],i,0,0);
                }
                format(string, sizeof(string), "~w~Veiculo VIP~n~~g~Aberto");
                PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                GameTextForPlayer(playerid, string, 10000, 3);
                CarInfo[testcar][cLock] = 0;
                return true;
                }
                else
                {
                for(new i = 0; i < MAX_PLAYERS; i++)
                {
                    if(IsPlayerConnected(i)) SetVehicleParamsForPlayer(CarInfo[testcar][ownedvehicle],i,0,1);
                }
                format(string, sizeof(string), "~w~Veiculo VIP~n~~r~Trancado");
                PlayerPlaySound(playerid, 1145, 0.0, 0.0, 0.0);
                GameTextForPlayer(playerid, string, 10000, 3);
                CarInfo[testcar][cLock] = 1;
                return true;
                }

            }
        }
        return true;
    }