16.03.2013, 21:03
i need help,i posted this,i want in log to be vehicle name,not vehicle id.
here:
PHP код:
if(strcmp(x_nr,"sell",true) == 0)
{
if(IsAtDealership(playerid))
{
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2] || GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3])
{
GetPlayerName(playerid, sendername, sizeof(sendername));
new ownvehkey;
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { ownvehkey = PlayerInfo[playerid][pPcarkey]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { ownvehkey = PlayerInfo[playerid][pPcarkey2]; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3]) { ownvehkey = PlayerInfo[playerid][pPcarkey3]; }
else { return 1; }
if(strcmp(sendername, CarInfo[ownvehkey][cOwner], true) == 0)
{
new carsellprice = CarInfo[ownvehkey][cValue] / 4 * 3;
new Float:x,Float:y,Float:z;
new Float:a;
CarInfo[ownvehkey][cOwned] = 0;
strmid(CarInfo[ownvehkey][cOwner], "Dealership", 0, strlen("Dealership"), 999);
GivePlayerCash(playerid,carsellprice);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~You have sold your car for: ~n~~g~$%d", carsellprice);
GameTextForPlayer(playerid, string, 10000, 3);
GetVehiclePos(ownvehkey, x, y, z);
GetVehicleZAngle(ownvehkey, a);
CarInfo[ownvehkey][cLocationx] = x; CarInfo[ownvehkey][cLocationy] = y; CarInfo[ownvehkey][cLocationz] = z; CarInfo[ownvehkey][cAngle] = a;
CarInfo[ownvehkey][mod1] = 0; CarInfo[ownvehkey][mod2] = 0; CarInfo[ownvehkey][mod3] = 0; CarInfo[ownvehkey][mod4] = 0;
CarInfo[ownvehkey][mod5] = 0; CarInfo[ownvehkey][mod6] = 0; CarInfo[ownvehkey][mod7] = 0; CarInfo[ownvehkey][mod8] = 0;
CarInfo[ownvehkey][mod9] = 0; CarInfo[ownvehkey][mod10] = 0; CarInfo[ownvehkey][mod11] = 0; CarInfo[ownvehkey][mod12] = 0;
CarInfo[ownvehkey][mod13] = 0; CarInfo[ownvehkey][mod14] = 0; CarInfo[ownvehkey][mod15] = 0; CarInfo[ownvehkey][mod16] = 0;
CarInfo[ownvehkey][mod17] = 0; CarInfo[ownvehkey][paintjob] = -1;
if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey]) { PlayerInfo[playerid][pPcarkey] = -1; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey2]) { PlayerInfo[playerid][pPcarkey2] = -1; }
else if(GetPlayerVehicleID(playerid) == PlayerInfo[playerid][pPcarkey3]) { PlayerInfo[playerid][pPcarkey3] = -1; }
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid, 1);
format(CarInfo[vehid][cLicense], 32 ,"Dealership");
SetVehicleNumberPlate(vehid,CarInfo[vehid][cLicense]);
OnPropUpdate(); SavePlayerData(playerid);
DestroyVehicle(ownvehkey);
new thiscar = CreateVehicle(CarInfo[ownvehkey][cModel],CarInfo[ownvehkey][cLocationx],CarInfo[ownvehkey][cLocationy],CarInfo[ownvehkey][cLocationz]+1.0,CarInfo[ownvehkey][cAngle],CarInfo[ownvehkey][cColorOne],CarInfo[ownvehkey][cColorTwo],-1);
LoadComponents(thiscar);
new t, m, d;
new h,mi,s;
getdate(t,m,d);
gettime(h,mi,s);
format(string, sizeof(string), "[%d/%d/%d](%d:%d:%d) %s a vandut masina [%d] inapoi la dealer.",d,m,t,h,mi,s,sendername,ownvehkey);
MasiniLog(string);
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, " You have to sit at your own car to sell it! ");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not at a dealership");
return 1;
}
}
PHP код:
format(string, sizeof(string), "[%d/%d/%d](%d:%d:%d) %s a vandut masina [%d] inapoi la dealer.",d,m,t,h,mi,s,sendername,ownvehkey); == Vehicle name,no vehicle id!