08.07.2014, 14:07
Hey. I have one problem with ZCMD and vehicles. First, code:
Now sometimes if vehicle is DESTROYED (anInfo[playerid][destroyed] == 1) this command gets bugged and it recieves me a message SERVER: Unknown command. But now why am I sayin' that's something with vehicles? Because other commands which do something with DESTROYED vehicles gets bugged also (e.g. I want to sell destroyed vehicle). I just posted a code above exactly with the command I faced first. Any help?
pawn Код:
CMD:manomasinos(playerid)
{
UpdatePlayerVehiclesInfo(playerid);
new skaic[3][] =
{
"Pirma", // eng. "First"
"Antra", // eng. "Second"
"Trecia" // eng. "Third"
};
new s[300], sfin[900]; // two new vars
for(new i = 0; i < 3; i++) // looping through player's private vehicles
{
if(anInfo[playerid][i][ID] != -1) // if player has a certain vehicle
{
new Float:kaina = anInfo[playerid][i][pard_kaina] / 2; // calculatings....
if(anInfo[playerid][i][destroyed] == 1) {format(s, 300, "{FFFFFF}%s transp. priemone: {AB6CC6}%s{FFFFFF}. HP: {55B1C6}%.1f{FFFFFF}. Kaina parduodant serveriui: {785B25}%i{FFFFFF} Lt. Numeriai: {BBD623}%s {CE0000}( SUNAIKINTA! )\n", skaic[i], VehNames[GetVehicleModel(anInfo[playerid][i][real_vehid])-400], anInfo[playerid][i][health], floatround(kaina, floatround_round), anInfo[playerid][i][veh_numplate]);} // if player's vehicle is destroyed, we format string 's' in one way.
else {format(s, 300, "{FFFFFF}%s transp. priemone: {AB6CC6}%s{FFFFFF}. HP: {55B1C6}%.1f{FFFFFF}. Kaina parduodant serveriui: {785B25}%i{FFFFFF} Lt. Numeriai: {BBD623}%s\n", skaic[i], VehNames[GetVehicleModel(anInfo[playerid][i][real_vehid])-400], anInfo[playerid][i][health], floatround(kaina, floatround_round), anInfo[playerid][i][veh_numplate]);} // else if it's not, we format string 's' in another way.
strcat(sfin, s); // then we merge 's' into 'sfin'
}
}
if(isnull(sfin)) {SPMB(playerid, "Tu neturi transp. priemoniu!");} // if player has no vehicles (var 'sfin' is empty), he will recieve a message.
else SPD(playerid, DIALOG_SHOW_VEHS, DIALOG_STYLE_MSGBOX, "Nuosavos transp. priemones", sfin, "Gerai",""); // else we send player a dialog with full player vehicles info.
return 1;
}