Server Vehicles
#1

Why does my server only load 53 vehicles ?

ScreenShot :

http://imgur.com/Hmbt4

Reply
#2

Probably because you have only 53 vehicles xD
Reply
#3

can teach me how to make it to many?
Reply
#4

2 ways:

1.:
  • Download MTA
  • Go in MTA
  • Create vehicle
  • Save your map
  • C:\Program Files\MTA San Andreas\server\deathmatch\resources\[Your Save Name]\[Your Save Name].map
  • Open that file and copy what's in
  • http://convertffs.com
  • Convert your vehicle(s)
  • Add in OnGameModeInit()
  • You are done
2.:
  • Go in your GTA:SA folder
  • Open samp-debug.exe
  • Go to that place you want to place a vehicle
  • Type /vsel
  • Select your vehicle
  • Now exit
  • Go in Documents\GTA:SA folder
  • Look for savedpositions.txt
  • Copy what's inside
  • Now place it in OnGameModeInit()
  • You are done
I can't remember clearly, but I think this is the way.
Good luck!
Reply
#5

what is OnGameModeInit()
Reply
#6

I'll tell you the best way to have a lot of vehicles with almost no work(FOLLOW THIS STEP):

At the top of your gamemode add this:

pawn Код:
#include "../include/gl_common.inc"
Go to OnGameModeInit(while in pawn do CTRL+F) and add this:

pawn Код:
new total_vehicles_from_files=0;
and also this:

pawn Код:
// LAS VENTURAS
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_law.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_airport.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_gen.txt");

    // SAN FIERRO
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/sf_law.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/sf_airport.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/sf_gen.txt");

    // LOS SANTOS
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_law.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_airport.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_gen_inner.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_gen_outer.txt");

    // OTHER AREAS
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/whetstone.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/bone.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/flint.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/tierra.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/red_county.txt");
   


    printf("Total vehicles from files: %d",total_vehicles_from_files);
And at bottom of your gamemode add this:

pawn Код:
stock LoadStaticVehiclesFromFile(const filename[])
{
    new File:file_ptr;
    new line[256];
    new var_from_line[64];
    new vehicletype;
    new Float:SpawnX;
    new Float:SpawnY;
    new Float:SpawnZ;
    new Float:SpawnRot;
    new Color1, Color2;
    new index;
    new vehicles_loaded;

    file_ptr = fopen(filename,filemode:io_read);
    if(!file_ptr) return 0;

    vehicles_loaded = 0;

    while(fread(file_ptr,line,256) > 0)
    {
        index = 0;

        // Read type
        index = token_by_delim(line,var_from_line,',',index);
        if(index == (-1)) continue;
        vehicletype = strval(var_from_line);
        if(vehicletype < 400 || vehicletype > 611) continue;

        // Read X, Y, Z, Rotation
        index = token_by_delim(line,var_from_line,',',index+1);
        if(index == (-1)) continue;
        SpawnX = floatstr(var_from_line);

        index = token_by_delim(line,var_from_line,',',index+1);
        if(index == (-1)) continue;
        SpawnY = floatstr(var_from_line);

        index = token_by_delim(line,var_from_line,',',index+1);
        if(index == (-1)) continue;
        SpawnZ = floatstr(var_from_line);

        index = token_by_delim(line,var_from_line,',',index+1);
        if(index == (-1)) continue;
        SpawnRot = floatstr(var_from_line);

        // Read Color1, Color2
        index = token_by_delim(line,var_from_line,',',index+1);
        if(index == (-1)) continue;
        Color1 = strval(var_from_line);

        index = token_by_delim(line,var_from_line,';',index+1);
        Color2 = strval(var_from_line);

        //printf("%d,%d,%f,%f,%f,%f,%d,%d",total_vehicles_from_files+vehicles_loaded+1,vehicletype,SpawnX,SpawnY,SpawnZ,SpawnRot,Color1,Color2);

        AddStaticVehicleEx(vehicletype,SpawnX,SpawnY,SpawnZ,SpawnRot,Color1,Color2,(30*60)); // respawn 30 minutes

        /*new numplate_test[32+1];
        format(numplate_test,32,"GRLC{44AA33}%d",vid);
        SetVehicleNumberPlate(vid, numplate_test);*/


        vehicles_loaded++;
    }

    fclose(file_ptr);
    printf("Loaded %d vehicles from: %s",vehicles_loaded,filename);
    return vehicles_loaded;
}

stock token_by_delim(const string[], return_str[], delim, start_index)
{
    new x=0;
    while(string[start_index] != EOS && string[start_index] != delim) {
        return_str[x] = string[start_index];
        x++;
        start_index++;
    }
    return_str[x] = EOS;
    if(string[start_index] == EOS) start_index = (-1);
    return start_index;
}
Reply
#7

It loads 54 vehicle models, not vehicles.
Reply
#8

Quote:
Originally Posted by Sergei
Посмотреть сообщение
It loads 54 vehicle models, not vehicles.
Wow, at least one person out of this whole thread can read

My server only loads (currently) 10 vehicle MODELS - just to let you know
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)