Jump to content
  • 0

Problema /lock


VaNu

Question

Problema intalnita (descriere): Cumpar o masina din DS daca ii dau /lock nu apare niciun fel de problema, daca dau restart la server imi spune ca : "Nu esti in masina ta!" insa mi-o recunoaste la /v pot face orice cu ea totul inafara de /lock
Ero(area / rile) / warning-(ul / urile): -
Liniile de cod / sursa / script-ul(obligatoriu):    if(newkeys & KEY_NO)
    {
        new string[128];
        new idd, car;
        new valid = PlayerInfo[playerid][CarKey1] + PlayerInfo[playerid][CarKey2] + PlayerInfo[playerid][CarKey3] + PlayerInfo[playerid][CarKey4] + PlayerInfo[playerid][CarKey5];
        if(valid == 0) return SendClientMessage(playerid, COLOR_WHITE, "{ff0000}Error: {ffffff}Nu detii o masina!");
        car = GetCloseVehicle(playerid);
        idd = FindSpawnID(car);
        if(idd == 0 || CarInfo[idd][Userid] != PlayerInfo[playerid][pSQLID]) return SendClientMessage(playerid, COLOR_WHITE, "{ff0000}Error: {ffffff}Nu esti in masina ta!");
        if(CarInfo[idd][cLock] == 0)
        {
            CarInfo[idd][cLock] = 1;
            GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(car,engine,lights,alarm,1,bonnet,boot,objective);
            format(string,sizeof(string),"~w~%s ~r~Locked",vehName[CarInfo[idd][cModel]-400]);
            GameTextForPlayer(playerid, string, 5000, 6);
            mysql_format(handle, string, sizeof(string), "UPDATE cars SET Lockk='%d' WHERE ID=%d", CarInfo[idd][cLock], idd);
            mysql_tquery(handle, string, "", "");
        }
        else
        {
            CarInfo[idd][cLock] = 0;
            GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(car,engine,lights,alarm,0,bonnet,boot,objective);
            format(string,sizeof(string),"~w~%s ~g~Unlocked",vehName[CarInfo[idd][cModel]-400]);
            GameTextForPlayer(playerid, string, 5000, 6);
            mysql_format(handle, string, sizeof(string), "UPDATE cars SET Lockk='%d' WHERE ID=%d", CarInfo[idd][cLock], idd);
            mysql_tquery(handle, string, "", "");
        }

Imagini / Video (optional):-
Ati incercat sa rezolvati singur?: Da.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
1 minute ago, VaNu said:

Problema intalnita (descriere): Cumpar o masina din DS daca ii dau /lock nu apare niciun fel de problema, daca dau restart la server imi spune ca : "Nu esti in masina ta!" insa mi-o recunoaste la /v pot face orice cu ea totul inafara de /lock
Ero(area / rile) / warning-(ul / urile): -
Liniile de cod / sursa / script-ul(obligatoriu):    if(newkeys & KEY_NO)
    {
        new string[128];
        new idd, car;
        new valid = PlayerInfo[playerid][CarKey1] + PlayerInfo[playerid][CarKey2] + PlayerInfo[playerid][CarKey3] + PlayerInfo[playerid][CarKey4] + PlayerInfo[playerid][CarKey5];
        if(valid == 0) return SendClientMessage(playerid, COLOR_WHITE, "{ff0000}Error: {ffffff}Nu detii o masina!");
        car = GetCloseVehicle(playerid);
        idd = FindSpawnID(car);
        if(idd == 0 || CarInfo[idd][Userid] != PlayerInfo[playerid][pSQLID]) return SendClientMessage(playerid, COLOR_WHITE, "{ff0000}Error: {ffffff}Nu esti in masina ta!");
        if(CarInfo[idd][cLock] == 0)
        {
            CarInfo[idd][cLock] = 1;
            GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(car,engine,lights,alarm,1,bonnet,boot,objective);
            format(string,sizeof(string),"~w~%s ~r~Locked",vehName[CarInfo[idd][cModel]-400]);
            GameTextForPlayer(playerid, string, 5000, 6);
            mysql_format(handle, string, sizeof(string), "UPDATE cars SET Lockk='%d' WHERE ID=%d", CarInfo[idd][cLock], idd);
            mysql_tquery(handle, string, "", "");
        }
        else
        {
            CarInfo[idd][cLock] = 0;
            GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
            SetVehicleParamsEx(car,engine,lights,alarm,0,bonnet,boot,objective);
            format(string,sizeof(string),"~w~%s ~g~Unlocked",vehName[CarInfo[idd][cModel]-400]);
            GameTextForPlayer(playerid, string, 5000, 6);
            mysql_format(handle, string, sizeof(string), "UPDATE cars SET Lockk='%d' WHERE ID=%d", CarInfo[idd][cLock], idd);
            mysql_tquery(handle, string, "", "");
        }

Imagini / Video (optional):-
Ati incercat sa rezolvati singur?: Da.

Arată GetCloseVehicle

**********************************

Servicii Scripting de calitate:

*********************************

Future Project: ExpertGame

*********************************

Link to comment
Share on other sites

  • 0

stock GetCloseVehicle(playerid)
{
    new closestdist = 999999999, closestvehicle = -1;
    new Float:x[2],Float:y[2],Float:z[2],distance;
    for(new i; i < MAX_VEHICLES; i++)
    {
        GetVehiclePos(i,x[0],y[0],z[0]);
        //if(x[0] == 0.0 && y[0] == 0.0 && z[0] == 0.0) return -1;
        GetPlayerPos(playerid,x[1],y[1],z[1]);
        distance = floatround(GetDistanceBetweenPoints(x[0],y[0],z[0],x[1],y[1],z[1]));
        if(distance < closestdist) {
            closestdist = distance;
            closestvehicle = i;
        }
    }
    return closestvehicle;
}

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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.