Jump to content
Autentificarea cu Google și Facebook nu mai este disponibilă. ×

Question

Posted

Salut All. 

Am o problema.

Cand Vreau sa creez o masina pentru o factiune cu comanda /Createvehicle

Mi-o creaza direct intr-o factiune de ce?

Si cand dau restart la server masina dispare. si nici in baza de date nu se salveaza, de la ce o fi problema asta?

2 answers to this question

Recommended Posts

  • 0
Posted
Acum 2 minute, VLM a spus:

Arata comanda createvehicle

YCMD:createvehicle(playerid, params[], help) {    
    new Float: Pos[3], Float: Angle, string[256], szQuery[500], modelid, color[2];
    if(PlayerInfo[playerid][pAdmin] < 6) return 1;
    if(sscanf(params, "iii", modelid, color[0], color[1])) return SCM(playerid, COLOR_GREY, "USAGE: {FFFFFF}/createvehicle <model> <color1> <color2>");
    if(400 <= modelid >= 611) return SCM(playerid, COLOR_GREY, "Invalid vehicle id. (400 - 611)");
    if(!(0 <= color[0] <= 255 && 0 <= color[1] <= 255)) return SCM(playerid, COLOR_GREY, "Invalid color id. (0 - 255)");
    if(IsPlayerInAnyVehicle(playerid)) return 1;

    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    GetPlayerFacingAngle(playerid, Angle);
    new carid = GetServerVehicles()+1;
    ServerVehicles[carid][vSpawned] = CreateVehicle(modelid, Pos[0], Pos[1], Pos[2], Angle, color[0], color[1], -1);
    SetVehicleNumberPlate(ServerVehicles[carid][vSpawned], "NewCar");
    PutPlayerInVehicleEx(playerid, ServerVehicles[carid][vSpawned], 0);
    ServerVehicles[carid][vID] = carid;
    ServerVehicles[carid][vModel] = modelid;
    ServerVehicles[carid][vLocation][0] = Pos[0];
    ServerVehicles[carid][vLocation][1] = Pos[1];
    ServerVehicles[carid][vLocation][2] = Pos[2];
    ServerVehicles[carid][vAngle] = Angle;
    ServerVehicles[carid][vColor][0] = color[0];
    ServerVehicles[carid][vColor][1] = color[1];

    mysql_format(SQL, szQuery, sizeof(szQuery),
    "INSERT INTO `svehicles` (vID, vModel, LocationX, LocationY, LocationZ, Angle, Color1, Color2) VALUES ('%d', '%d', '%f', '%f', '%f', '%f', '%d', '%d')", carid, modelid, Pos[0], Pos[1], Pos[2], ServerVehicles[carid][vAngle], color[0], color[1]);
    mysql_query(SQL, szQuery);
    format(string, sizeof(string), "Ai creat cu succes un %s (vID: %d).", aVehicleNames[modelid - 400], carid);
    SCM(playerid, COLOR_LGREEN, string);
    format(string, sizeof(string), "Acesta a fost adaugat cu succes in baza de date iar acum sunt in total %d vehicule!", GetServerVehicles());
    SCM(playerid, COLOR_LGREEN, string);
    SCM(playerid, COLOR_LGREEN, "Daca vrei sa modifici acest vehicul, foloseste comanda /editvehicle.");
    return 1;
}
function GetServerVehicles() {
    new maryus[256], vehicles;
    format(maryus, sizeof(maryus), "SELECT * FROM `svehicles`");
    new Cache: result = mysql_query(SQL, maryus);
    vehicles = cache_get_row_count ();
    cache_delete(result);
    return vehicles;
}
 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.