[Ajuda]Sistema Motor
#1

Queria saber como fazer esses 2 comandos ficar somente em um: /motor

PHP код:
[B]if (strcmp("/motoron"cmdtexttrue10) == 0)
    {
        new 
motlualarporcappormaob;
        new 
carro GetPlayerVehicleID(playerid);
        if(
carro != INVALID_VEHICLE_ID)
        {
                if(
motor[playerid] == 0)
                {
                    
GetVehicleParamsEx(carromotlualarporcappormaob);
                    
SetVehicleParamsEx(carroVEHICLE_PARAMS_ONlualarporcappormaob);
                    
motor[playerid] = 1;
                    
SendClientMessage(playerid0xFFFFFFAA"Veiculo {2F991A}Ligado!");
                }
            }
    }
    if (
strcmp("/motoroff"cmdtexttrue10) == 0)
    {
        new 
motlualarporcappormaob;
        new 
carro GetPlayerVehicleID(playerid);
        if(
carro != INVALID_VEHICLE_ID)
            {
                if(
motor[playerid] == 1)
                {
                    
GetVehicleParamsEx(carromotlualarporcappormaob);
                    
SetVehicleParamsEx(carroVEHICLE_PARAMS_OFFlualarporcappormaob);
                    
motor[playerid] = 0;
                    
SendClientMessage(playerid0xFFFFFFAA"Veiculo {E31919}Desligado!");
                }
            }
    }[/
B
Reply
#2

pawn Код:
//new motor[MAX_PLAYERS];

if (strcmp("/motoron", cmdtext, true, 10) == 0)
    {
        new mot, lu, alar, por, cap, porma, ob;
        new carro = GetPlayerVehicleID(playerid);
        if(carro != INVALID_VEHICLE_ID)
        {
            if(motor[playerid] == 0)
            {
                GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                SetVehicleParamsEx(carro, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
                motor[playerid] = 1;
                SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {2F991A}Ligado!");
            }
            if(motor[playerid] == 1)
            {
                GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
                motor[playerid] = 0;
                SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {E31919}Desligado!");
            }
        }
    }
    return true;
}
Reply
#3

vlw + reputation pra vc.
Reply
#4

pawn Код:
if (strcmp("/motor", cmdtext, true, 10) == 0)
    {
        new mot, lu, alar, por, cap, porma, ob;
        new carro = GetPlayerVehicleID(playerid);
        if(carro != INVALID_VEHICLE_ID)
        {
            if(motor[playerid] == 0)
            {
                GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                SetVehicleParamsEx(carro, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
                motor[playerid] = 1;
                SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {2F991A}Ligado!");
            }
            else if(motor[playerid] == 1)
            {
                GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
                motor[playerid] = 0;
                SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {E31919}Desligado!");
            }
        }
        return 1;
    }

Quote:
Originally Posted by Enderman
Посмотреть сообщение
pawn Код:
//new motor[MAX_PLAYERS];

if (strcmp("/motoron", cmdtext, true, 10) == 0)
    {
        new mot, lu, alar, por, cap, porma, ob;
        new carro = GetPlayerVehicleID(playerid);
        if(carro != INVALID_VEHICLE_ID)
        {
            if(motor[playerid] == 0)
            {
                GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                SetVehicleParamsEx(carro, VEHICLE_PARAMS_ON, lu, alar, por, cap, porma, ob);
                motor[playerid] = 1;
                SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {2F991A}Ligado!");
            }
            if(motor[playerid] == 1)
            {
                GetVehicleParamsEx(carro, mot, lu, alar, por, cap, porma, ob);
                SetVehicleParamsEx(carro, VEHICLE_PARAMS_OFF, lu, alar, por, cap, porma, ob);
                motor[playerid] = 0;
                SendClientMessage(playerid, 0xFFFFFFAA, "Veiculo {E31919}Desligado!");
            }
        }
    }
    return true;
}
Se nгo usar else if vai dar erro in-game.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)