[AJUDA] CARROS
#1

Olб malta,tudo bem com voce? =) Bem,eu estou tendo um problema,tipo,no GM,quando tenho assim
pawn Код:
new DynamicCars[100][Cars];
funciona tudo direitinho,so que os carros do stand,nгo se pode mudar o modelo e meter em faction. Mas quando estб assim no GM
pawn Код:
new DynamicCars[MAX_VEHICLES][Cars];
Assim,funciona tudo direitinho,e os carros do stand ja dгo para mudar o modelo,meter em faction e etc. So que isso gera um lag do caraзas,pois MAX_VEHICLES como o nome diz,veiculos maximos. So que em antes o tunning nгo era salvo,mas agora ja consegui por a salvar =). Os comandos sгo estes:
pawn Код:
if(strcmp(cmd, "/acarmodel", true) == 0)
        {
            if(IsPlayerConnected(playerid))
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_LIGHTORANGE, "[Comando]: /acarmodel [modelid]");
                    return 1;
                }
                new thecar = strval(tmp);
                new Float:PosXX, Float:PosYY, Float:PosZZ;
                GetVehicleVelocity(GetPlayerVehicleID(playerid), PosXX, PosYY, PosZZ);
                if (PlayerInfo[playerid][mstrvbcAdmin] >= 22)
                {
                    if(IsPlayerInAnyVehicle(playerid))
                    {
                        if(thecar > 400 && thecar < 612)
                        {
                        new IDVeiculo = GetPlayerVehicleID(playerid);
                        for(new x = 0; x < sizeof(ShopCar); x++)
                        {
                            if(IDVeiculo == ShopCar[x])
                           {
                           Car[IDVeiculo][CarModel] = thecar;
                           }
                        }
                            new car = GetPlayerVehicleID(playerid) - 1;
                            new vehicleid = GetPlayerVehicleID(playerid);
                            DynamicCars[car][CarModel] = thecar;
                            new wstring[128];
                            format(wstring, sizeof(wstring), "Tu escolheste o veiculo ID %d e alteras-te o modelo: %d.", vehicleid,thecar);
                            SendClientMessage(playerid,COLOR_ADMINCMD, wstring);
                            new Float:cx,Float:cy,Float:cz;
                            GetVehiclePos(vehicleid,cx,cy,cz);
                            new Float:angle;
                            GetVehicleZAngle(vehicleid, angle);
                            DestroyVehicle(vehicleid);
                            CreateVehicle(DynamicCars[car][CarModel],DynamicCars[car][CarX],DynamicCars[car][CarY],DynamicCars[car][CarZ],DynamicCars[car][CarAngle],DynamicCars[car][CarColor1],DynamicCars[car][CarColor2], -1);
                            PutPlayerInVehicle(playerid,vehicleid,0);
                            SetVehiclePos(vehicleid, cx, cy, cz);
                            SetVehicleZAngle(vehicleid, angle);
                            LoadComponents(vehicleid);
                            SaveDynamicCars();
                            if(EngineStatus[GetPlayerVehicleID(playerid)] == 1)
                            {
                                SetVehicleEngineOn(GetPlayerVehicleID(playerid));
                            }
                            if(LuzesStatus[GetPlayerVehicleID(playerid)] == 1)
                            {
                                SetVehicleLightsOn(GetPlayerVehicleID(playerid));
                            }
                            if(vehicleid <= 10)
                            {
                                format(string, sizeof(string), "0%d-%s-%d", vehicleid, MatriculasNames[vehicleid], vehicleid+15);
                                SetVehicleNumberPlate(vehicleid,string);
                            }
                            else if(vehicleid <= 100 && vehicleid >= 10)
                            {
                                format(string, sizeof(string), "%d-%s-%d", vehicleid, MatriculasNames[vehicleid], vehicleid+15);
                                SetVehicleNumberPlate(vehicleid,string);
                            }
                            else
                            {
                                format(string, sizeof(string), "%d-%s-%d", vehicleid-100, MatriculasNames[vehicleid], vehicleid-85);
                                SetVehicleNumberPlate(vehicleid,string);
                            }
                            SetVehicleVelocity(GetPlayerVehicleID(playerid), PosXX, PosYY, PosZZ);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_DARKRED, "[ERRO:] Incorrecto Modelo ID, Model ID's: 400-611.");
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_DARKRED, "[ERRO:]Nгo estas dentro de um veiculo!");
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_DARKRED, "[ERRO:] Nгo tens nivel suficiente para usufruires deste comando.");
                }
            }
            return 1;
        }
pawn Код:
if(strcmp(cmd, "/acarfaction", true) == 0)
        {
            if(IsPlayerConnected(playerid))
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_LIGHTORANGE, "[Comando]: /acarfaction [faction]");
                    return 1;
                }
                new thecar = strval(tmp);
                if (PlayerInfo[playerid][mstrvbcAdmin] >= 21)
                {
                    if(IsPlayerInAnyVehicle(playerid))
                    {
                        if(thecar < 11|| 255)
                        {
                            new car = GetPlayerVehicleID(playerid) - 1;
                            new vehicleid = GetPlayerVehicleID(playerid);
                            DynamicCars[car][FactionCar] = thecar;
                            new wstring[128];
                            format(wstring, sizeof(wstring), "Tu escolheste o veiculo ID %d's para a faction: %d.", vehicleid,thecar);
                            SendClientMessage(playerid,COLOR_ADMINCMD, wstring);
                            SaveDynamicCars();
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_DARKRED, "[ERRO:] Incorrecta faciton ID, Faction ID's: 1-10.");
                        }
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_DARKRED, "[ERRO:] Nгo tens nivel suficiente para usufruires deste comando.");
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_DARKRED, "[ERRO:] Nгo tens nivel suficiente para usufruires deste comando.");
                }
            }
            return 1;
        }
e o cmd de comprar no stand
pawn Код:
if(strcmp(cmd, "/comprarveiculo", true) == 0)
        {
            if(PlayerInfo[playerid][msNCarKey] != 4)
            {
                for(new i = 1; i < sizeof(Businesses); i++)
                {
                    if (PlayerToPoint(25.0, playerid,Businesses[i][ExitX], Businesses[i][ExitY], Businesses[i][ExitZ]))
                    {
                        if(GetPlayerVirtualWorld(playerid) == i)
                        {
                            if(Businesses[i][BizType] == 9)
                            {
                                if(PlayerToPoint(10.0, playerid,345.5447,160.1090,1014.1875))
                                {
                                    tmp = strtok(cmdtext, idx);
                                    if(!strlen(tmp))
                                    {
                                        SendClientMessage(playerid, COLOR_WHITE, "Comando: /comprarveiculo [modelo]");
                                        return 1;
                                    }
                                    new TCarModel = strval(tmp);
                                    ShopCar[playerid] = CreateVehicle(TCarModel, -538.8217, 2599.4775, 53.0267, 271.4271, 1, 1, 1);
                                    if(IsValidModel(TCarModel))
                                    {
                                        new valor= TCarModel-400;
                                        new price = VehiclePrices[valor][0];
                                        new ctill = VehiclePrices[valor][0]/4;
                                        new vprice;
                                        if(PlayerInfo[playerid][msVipActive] != 0)
                                        {
                                            vprice = VehiclePrices[valor][0]/2;
                                        }
                                        else
                                        {
                                            vprice = VehiclePrices[valor][0];
                                        }
                                        if (vprice <= GetPlayerEuros(playerid))
                                        {
                                            PlayerActionMessage(playerid,15.0,"entrega um cheque ao gerente do Stand, que dб em troca a chave do carro");
                                            SendClientMessage(playerid, COLOR_YELLOW2, "Compraste o carro com sucesso.");
                                            Car[ShopCar[playerid]][CarModel] = TCarModel;
                                            Car[ShopCar[playerid]][CarID] = ShopCar[playerid];
                                            Car[ShopCar[playerid]][ParkX] = 2461.6431;
                                            Car[ShopCar[playerid]][ParkY] = -41.9446;
                                            Car[ShopCar[playerid]][ParkZ] = 26.1095;
                                            Car[ShopCar[playerid]][ParkAngle] = 0.0;
                                            Car[ShopCar[playerid]][CarColor1] = 1;
                                            Car[ShopCar[playerid]][CarColor2] = 1;
                                            Car[ShopCar[playerid]][Owned] = 1;
                                            Car[ShopCar[playerid]][Materials] = 0;
                                            Car[ShopCar[playerid]][cCocaina] = 0;
                                            Car[ShopCar[playerid]][cHeroina] = 0;
                                            Car[ShopCar[playerid]][cExtasy] = 0;
                                            Car[ShopCar[playerid]][cErva] = 0;
                                            Car[ShopCar[playerid]][cPolen] = 0;
                                            Car[ShopCar[playerid]][Sell] = 0;
                                            Car[ShopCar[playerid]][Locked] = 0;
                                            new Matri = random(sizeof(MatriculasNames));
                                            if(Car[ShopCar[playerid]][Matriculed]==0)
                                            {
                                                if(ShopCar[playerid] <= 10)
                                                {
                                                    format(string, sizeof(string), "0%d-%s-%d", ShopCar[playerid], MatriculasNames[Matri], ShopCar[playerid]+15);
                                                    strmid(Car[ShopCar[playerid]][Matricula], string, 0, strlen(string), 999);
                                                    Car[ShopCar[playerid]][Matriculed]= 1;
                                                }
                                                else if(ShopCar[playerid] <= 80 && ShopCar[playerid] >= 10)
                                                {
                                                    format(string, sizeof(string), "%d-%s-%d", ShopCar[playerid], MatriculasNames[Matri], ShopCar[playerid]+15);
                                                    strmid(Car[ShopCar[playerid]][Matricula], string, 0, strlen(string), 999);
                                                    Car[ShopCar[playerid]][Matriculed]= 1;
                                                }
                                                else if(ShopCar[playerid] <= 100 && ShopCar[playerid] >= 80)
                                                {
                                                    format(string, sizeof(string), "%d-%s-%d", ShopCar[playerid], MatriculasNames[Matri], ShopCar[playerid]-15);
                                                    strmid(Car[ShopCar[playerid]][Matricula], string, 0, strlen(string), 999);
                                                    Car[ShopCar[playerid]][Matriculed]= 1;
                                                }
                                                else
                                                {
                                                    format(string, sizeof(string), "%d-%s-%d", ShopCar[playerid]-90, MatriculasNames[Matri], ShopCar[playerid]-85);
                                                    strmid(Car[ShopCar[playerid]][Matricula], string, 0, strlen(string), 999);
                                                    Car[ShopCar[playerid]][Matriculed]= 1;
                                                }
                                            }
                                            format(string, sizeof(string), "%s", Car[ShopCar[playerid]][Matricula]);
                                            SetVehicleNumberPlate(ShopCar[playerid],string);
                                            ShowMenuForPlayer(Colors, playerid);
                                            SaveCars();
                                            if(PlayerInfo[playerid][msVipActive] != 0)
                                            {
                                                GivePlayerEuros(playerid, -price/2);
                                                Businesses[i][Products]--;
                                                Businesses[i][Till]+=price/2-ctill;
                                            }
                                            else
                                            {
                                                GivePlayerEuros(playerid, -price);
                                                Businesses[i][Products]--;
                                                Businesses[i][Till]+=price-ctill;
                                            }
                                            for(new h = 0; h < sizeof(Car); h++)
                                            {
                                                new playername[MAX_PLAYER_NAME];
                                                GetPlayerName(playerid,playername,sizeof(playername));
                                                strmid(Car[ShopCar[playerid]][Owner], playername, 0, strlen(playername), 999);
                                            }
                                            if(PlayerInfo[playerid][msNCarKey] == 0)
                                            {
                                                PlayerInfo[playerid][msCarKey1] = ShopCar[playerid];
                                                PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
                                                OnPlayerDataSave(playerid);
                                            }
                                            else if(PlayerInfo[playerid][msNCarKey] == 1)
                                            {
                                                if(PlayerInfo[playerid][msCarKey1] == 255)
                                                {
                                                    PlayerInfo[playerid][msCarKey1] = ShopCar[playerid];
                                                    PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
                                                    OnPlayerDataSave(playerid);
                                                }
                                                else if(PlayerInfo[playerid][msCarKey2] == 255)
                                                {
                                                    PlayerInfo[playerid][msCarKey2] = ShopCar[playerid];
                                                    PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
                                                    OnPlayerDataSave(playerid);
                                                }
                                                else if(PlayerInfo[playerid][msCarKey3] == 255)
                                                {
                                                    PlayerInfo[playerid][msCarKey3] = ShopCar[playerid];
                                                    PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
                                                    OnPlayerDataSave(playerid);
                                                }
                                                else if(PlayerInfo[playerid][msCarKey4] == 255)
                                                {
                                                    PlayerInfo[playerid][msCarKey4] = ShopCar[playerid];
                                                    PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
                                                    OnPlayerDataSave(playerid);
                                                }
                                            }
                                            else if(PlayerInfo[playerid][msNCarKey] == 2)
                                            {
                                                if(PlayerInfo[playerid][msCarKey1] == 255)
                                                {
                                                    PlayerInfo[playerid][msCarKey1] = ShopCar[playerid];
                                                    PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
                                                    OnPlayerDataSave(playerid);
                                                }
                                                else if(PlayerInfo[playerid][msCarKey2] == 255)
                                                {
                                                    PlayerInfo[playerid][msCarKey2] = ShopCar[playerid];
                                                    PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
                                                    OnPlayerDataSave(playerid);
                                                }
                                                else if(PlayerInfo[playerid][msCarKey3] == 255)
                                                {
                                                    PlayerInfo[playerid][msCarKey3] = ShopCar[playerid];
                                                    PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
                                                    OnPlayerDataSave(playerid);
                                                }
                                                else if(PlayerInfo[playerid][msCarKey4] == 255)
                                                {
                                                    PlayerInfo[playerid][msCarKey4] = ShopCar[playerid];
                                                    PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
                                                    OnPlayerDataSave(playerid);
                                                }
                                            }
                                            else if(PlayerInfo[playerid][msNCarKey] == 3)
                                            {
                                                if(PlayerInfo[playerid][msCarKey1] == 255)
                                                {
                                                    PlayerInfo[playerid][msCarKey1] = ShopCar[playerid];
                                                    PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
                                                    OnPlayerDataSave(playerid);
                                                }
                                                else if(PlayerInfo[playerid][msCarKey2] == 255)
                                                {
                                                    PlayerInfo[playerid][msCarKey2] = ShopCar[playerid];
                                                    PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
                                                    OnPlayerDataSave(playerid);
                                                }
                                                else if(PlayerInfo[playerid][msCarKey3] == 255)
                                                {
                                                    PlayerInfo[playerid][msCarKey3] = ShopCar[playerid];
                                                    PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
                                                    OnPlayerDataSave(playerid);
                                                }
                                                else if(PlayerInfo[playerid][msCarKey4] == 255)
                                                {
                                                    PlayerInfo[playerid][msCarKey4] = ShopCar[playerid];
                                                    PlayerInfo[playerid][msNCarKey] = 1 + PlayerInfo[playerid][msNCarKey];
                                                    OnPlayerDataSave(playerid);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            SendClientMessage(playerid, COLOR_WHITE, "ERRO: Nгo tens dinheiro!");
                                            DestroyVehicle(ShopCar[playerid]);
                                        }
                                    }
                                    else
                                    {
                                        SendClientMessage(playerid, COLOR_WHITE, "ERRO: Modelo invбlido.");
                                        DestroyVehicle(ShopCar[playerid]);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_WHITE, "ERRO: Jб tens carros sufecientes!");
            }
            return 1;
        }
O que eu queria mesmo,era que quando tivesse assim
pawn Код:
new DynamicCars[100][Cars];
deve para usar o cmd de meter em faction e alterar o modelo.
Enum dos carros
pawn Код:
enum Cars
{
    CarModel,
    Float:CarX,
    Float:CarY,
    Float:CarZ,
    Float:CarAngle,
    CarColor1,
    CarColor2,
    FactionCar,
    CarType,
    cPaintjob,
    Matricula[MAX_PLAYER_NAME],
    Matriculed,
    Neon,
};
new DynamicCars[100][Cars];
Quem me conseguir ajudar agradecia bues =) ++REP SE FOR PRESICO,tou desesperado,ando a tentar resolver isso perto dum mкs
Reply
#2

alguem me ajuda?
Reply
#3

veja quantos veiculos tem o seu server e mude o MAX_VEHICLES pelo numero de veiculos.

http://forum.sa-mp.com/showpost.php?...postcount=1434
Reply
#4

eu tenho outro GM,e reparei,que tem o dynamic definido como 600,so que no meu server,quando defino o maximo de veiculos,tipos
pawn Код:
new DynamicCars[600];
os carros do stand,vem com os ids 601,602 por ai fora :S
Reply
#5

MAX_VEHICLES = 2000.

Entгo tente deixar como 1000, ou o maximo de veiculos q o seu sv tem!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)