Jump to content
  • 0

Problema /savetuning


fytza

Question

Nick:fytza

Problema:ma duc tunez masina si cand ii dau /savetuning imi zice : Gabii si-a salvat componentele tuningului de la masina , si cand dau /parcheaza zice: Ai parcat masina personala aici! si numai ramane tuningul .. cum pot face sa ramana tuningul salvat ?

Erori / warnings: -

Lini/script:-

Ai incercat sa rezolvi singur ?:da

[pawn]    if(strcmp(cmd, "/parcheaza", true) == 0)

{

    if(IsPlayerConnected(playerid))

    {

        new Float:x,Float:y,Float:z;

new Float:a;

new carid;

new getcarid;

if(GetPlayerVehicleID(playerid) == PlayerData[playerid][pPcarkey]+PreVehicle)

{

carid = PlayerData[playerid][pPcarkey];

}

else if(GetPlayerVehicleID(playerid) == PlayerData[playerid][pPcarkey1]+PreVehicle)

{

carid = PlayerData[playerid][pPcarkey1];

}

else if(GetPlayerVehicleID(playerid) == PlayerData[playerid][pPcarkey2]+PreVehicle)

{

carid = PlayerData[playerid][pPcarkey2];

}

else if(GetPlayerVehicleID(playerid) == PlayerData[playerid][pPcarkey3]+PreVehicle)

{

carid = PlayerData[playerid][pPcarkey3];

}

else { return 1; }

getcarid = GetPlayerVehicleID(playerid)-PreVehicle;

GetPlayerName(playerid, playername, sizeof(playername));

GetVehiclePos(carid+PreVehicle, x, y, z);

GetVehicleZAngle(carid+PreVehicle, a);

if(IsPlayerInVehicle(playerid,carid+PreVehicle) && CarData[carid][cOwned] == 1)

{

  if(PlayerData[playerid][pPcarkey] == 999 && PlayerData[playerid][pPcarkey1] == 999 && PlayerData[playerid][pPcarkey2] == 999 && PlayerData[playerid][pPcarkey3] == 999)

{

SendClientMessage(playerid, COLOR_GREY, "Nu detii o masina personala.");

return 1;

}

if(getcarid == carid)

{

CarData[carid][cLocationx] = x;

CarData[carid][cLocationy] = y;

CarData[carid][cLocationz] = z;

CarData[carid][cAngle] = a;

SendClientMessage(playerid, COLOR_GRAD2, "Ai parcat masina personala aici!");

SendClientMessage(playerid, COLOR_GRAD2, "De acum masina ta se va respama aici!");

DestroyVehicle(carid+PreVehicle);

CreateVehicle(CarData[carid][cModel],CarData[carid][cLocationx],CarData[carid][cLocationy],CarData[carid][cLocationz]+1.0,CarData[carid][cAngle],CarData[carid][cColorOne],CarData[carid][cColorTwo],60000);

TogglePlayerControllable(playerid, 1);

      format(string, sizeof(string), "%s",CarData[carid][cNum]);

      SetVehicleNumberPlate(carid+PreVehicle, string);

      format(string, sizeof(string), "UPDATE cars SET Locationx='%f' WHERE id=%d", CarData[carid][cLocationx], carid);

mysql_query(string);

format(string, sizeof(string), "UPDATE cars SET Locationy='%f' WHERE id=%d", CarData[carid][cLocationy], carid);

mysql_query(string);

format(string, sizeof(string), "UPDATE cars SET Locationz='%f' WHERE id=%d", CarData[carid][cLocationz], carid);

mysql_query(string);

format(string, sizeof(string), "UPDATE cars SET Angle='%f' WHERE id=%d", CarData[carid][cAngle], carid);

mysql_query(string);

return 1;

  }

}

}

  }[/pawn]

[pawn] if(strcmp(cmd, "/savetuning", true)==0)

{

new masina = GetPlayerVehicleID(playerid);

    if(masina > PreVehicle)

    {

        if(PlayerData[playerid][pPcarkey] == masina-PreVehicle || PlayerData[playerid][pPcarkey1] == masina-PreVehicle || PlayerData[playerid][pPcarkey2] == masina-PreVehicle ||PlayerData[playerid][pPcarkey3] == masina-PreVehicle)

{

new component;

new query[256];

    component = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), 0);

    format(query, sizeof(query), "UPDATE cars SET Component00='%d' WHERE id=%d",component,masina-PreVehicle);

mysql_query(query);

CarData[masina-PreVehicle][cComponent00] = component;

    component = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), 1);

    format(query, sizeof(query), "UPDATE cars SET Component01='%d' WHERE id=%d",component,masina-PreVehicle);

mysql_query(query);

CarData[masina-PreVehicle][cComponent01] = component;

    component = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), 2);

    format(query, sizeof(query), "UPDATE cars SET Component02='%d' WHERE id=%d",component,masina-PreVehicle);

mysql_query(query);

CarData[masina-PreVehicle][cComponent02] = component;

    component = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), 3);

    format(query, sizeof(query), "UPDATE cars SET Component03='%d' WHERE id=%d",component,masina-PreVehicle);

mysql_query(query);

CarData[masina-PreVehicle][cComponent03] = component;

    component = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), 4);

    format(query, sizeof(query), "UPDATE cars SET Component04='%d' WHERE id=%d",component,masina-PreVehicle);

mysql_query(query);

CarData[masina-PreVehicle][cComponent04] = component;

    component = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), 5);

    format(query, sizeof(query), "UPDATE cars SET Component05='%d' WHERE id=%d",component,masina-PreVehicle);

mysql_query(query);

CarData[masina-PreVehicle][cComponent05] = component;

    component = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), 6);

    format(query, sizeof(query), "UPDATE cars SET Component06='%d' WHERE id=%d",component,masina-PreVehicle);

mysql_query(query);

CarData[masina-PreVehicle][cComponent06] = component;

    component = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), 7);

    format(query, sizeof(query), "UPDATE cars SET Component07='%d' WHERE id=%d",component,masina-PreVehicle);

mysql_query(query);

CarData[masina-PreVehicle][cComponent07] = component;

    component = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), 8);

    format(query, sizeof(query), "UPDATE cars SET Component08='%d' WHERE id=%d",component,masina-PreVehicle);

mysql_query(query);

CarData[masina-PreVehicle][cComponent08] = component;

    component = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), 9);

    format(query, sizeof(query), "UPDATE cars SET Component09='%d' WHERE id=%d",component,masina-PreVehicle);

mysql_query(query);

CarData[masina-PreVehicle][cComponent09] = component;

    component = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), 10);

    format(query, sizeof(query), "UPDATE cars SET Component10='%d' WHERE id=%d",component,masina-PreVehicle);

mysql_query(query);

CarData[masina-PreVehicle][cComponent10] = component;

        component = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), 11);

    format(query, sizeof(query), "UPDATE cars SET Component11='%d' WHERE id=%d",component,masina-PreVehicle);

mysql_query(query);

CarData[masina-PreVehicle][cComponent11] = component;

    component = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), 12);

    format(query, sizeof(query), "UPDATE cars SET Component12='%d' WHERE id=%d",component,masina-PreVehicle);

mysql_query(query);

CarData[masina-PreVehicle][cComponent12] = component;

    component = GetVehicleComponentInSlot(GetPlayerVehicleID(playerid), 13);

    format(query, sizeof(query), "UPDATE cars SET Component13='%d' WHERE id=%d",component,masina-PreVehicle);

mysql_query(query);

CarData[masina-PreVehicle][cComponent13] = component;

    format(string, sizeof(string), "* %s si-a salvat componentele tuningului de la masina.", PlayerData[playerid][pNume]);

ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

printf("%s", string);

return 1;

}

return 1;

}

return 1;

}[/pawn]

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

Topic inchis , 48h+ fara reply.

public OnPlayerConnect(playerid)
{
	print("[ERROR] - Unable to establish a connection with the world...");
	SendRconCommand("exit");
	return 1;
}

 

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.