Jump to content

Recommended Posts

Posted (edited)

Salut grup am si eu o problema mica/mare dar pentru mine e mare si nu inteleg ce are. Am un gamemode da la un prieten cu clan vehicles pornit de la burned si cand cumpar o masina la clan si dupa cand cumpar a 2-a masina se pune in locul primei masini si prima masina dispare dupa restart dispar ambele din Clan Vehicles si in locul unde a fost creata masina pentru clan se pune o masina depe server (Factiune)

poftim codul:

function insert_clan_vehicle(playerid, modelid, price) {
    new 
        Float: Pos[3], Float: Angle,
        szQuery[256],
        string[128],
        carid = GetServerVehicles()+1,
        clanid = PlayerInfo[playerid][pClan];

    GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
    GetPlayerFacingAngle(playerid, Angle);


    ServerVehicles[carid][vSpawned] = CreateVehicle(modelid, Pos[0], Pos[1], Pos[2], Angle, 1, 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] = 1;
    ServerVehicles[carid][vColor][1] = 1;
    ServerVehicles[carid][vClan] = clanid;

    mysql_format(SQL, szQuery, sizeof(szQuery),
    "INSERT INTO `svehicles` (vID, vModel, LocationX, LocationY, LocationZ, Angle, Clan) VALUES ('%d', '%d', '%f', '%f', '%f', '%f', '%d')", carid, modelid, Pos[0], Pos[1], Pos[2], ServerVehicles[carid][vAngle], PlayerInfo[playerid][pClan]);
    mysql_query(SQL, szQuery);

    ClanInfo[clanid][clMoney] -= price;

    format(szQuery, sizeof(szQuery), "UPDATE `clans` SET `Money`='%d' WHERE `ID`='%d'", clan_money(clanid), clanid);
    mysql_tquery(SQL, szQuery, "", "");

    format(string, sizeof(string), "{%s}[CLAN] %s a cumparat vehiculul %s pentru clan (-$%s, total: $%s).", ClanInfo[clanid][clColor], GetName(playerid), aVehicleNames[modelid-400], FormatNumber(price), clan_money(clanid));
    SendClanMessage(clanid, string);
    return 1;
}

Edited by Exaton

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.