Jump to content
  • 0

Problem #3



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?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
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 ();
    return vehicles;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • 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.