Dakle radim osobna vozila, vec sam sve napravio, osim jedne stvari, osiguranja i da se osiguranja oduzimaju, znaci: Npr. vozilo ima 1 osiguranje, netko unisti vozilo, oduzme se 1 osiguranje i vozilu ostane 0 osiguranja, ako onda netko unisti(vozilo izgori, padne u more ili slicno), tada se vozilo jednostavno brise od tog igraca, znaci evo sta sam dosad napravio:
public OnVehicleDeath(vehicleid, killerid)
{
if(VehicleInfo[vehicleid][vOwned] == 1)
{
if(VehicleInfo[vehicleid][vInsurance] == 0)
{
new string[MAX_PLAYER_NAME+75];
new plname[MAX_PLAYER_NAME];
plname = VehicleInfo[vehicleid][vOwner];
format(string, sizeof(string), "Vehicles/Vehicles/%s.%s.cfg", plname, VehicleNames[GetVehicleModel(vehicleid)-400]);
new str[MAX_PLAYER_NAME+50];
format(str, sizeof(str), "%s.%s", plname, VehicleNames[GetVehicleModel(vehicleid)-400]);
new i2 = GetPlayerID(plname);
if(strfind(str, PlayerVehicle[i2][pVeh1], true) == 0)
{
//SetVehicleToRespawn(vehicleid);
DestroyVehicle(vehicleid);
veh1[i2] = 999; veh2[i2] = 999; veh3[i2] = 999; veh4[i2] = 999; veh5[i2] = 999;
dini_Remove(string);
strmid(PlayerVehicle[i2][pVeh1], "None", 0, strlen("None"), 255);
format(str, sizeof(str), "Vehicles/Players/%s.cfg", plname);
dini_Set(str, "Vehicle1", PlayerVehicle[i2][pVeh1]);
SendClientMessage(i2, COLOR_GREEN, "Vase vozilo je unisteno zauvijek, zbog nedostataka osiguranja");
return 1;
}
}
else
{
VehicleInfo[vehicleid][vInsurance] -= 1;
}
}
return 1;
}
stock GetPlayerID(const Name[])
{
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(i, pName, sizeof(pName));
if(strcmp(Name, pName, true)==0)
{
return i;
}
}
}
return -1;
}
Auto se unisti, insurance se ne oduzme, kao ni ne posalje igracu poruku.. Pa zato pomoc.
Molim da se oni koji se ne razumiju u DINI i slicno ne uplicu u ovu temu, hvala.
ID vjerojatno nisi dobio zobg ovog plname = VehicleInfo[vehicleid][vOwner];
Koristi strmid ili format !
strmid je brzi i bolji
A da.. joj nisam ni skuzio, probat cu sad pa vam javim :).. hvala