Right, I tested the code but whenever you enter as owner, notowner or enter other vehicle it goes through the last else, saying Other Car
pawn Код:
new CurrentDriver[64];
new CurrentVehicle;
GetPlayerName(playerid, CurrentDriver, sizeof(CurrentDriver));
CurrentVehicle = GetPlayerVehicleID(playerid);
if(VehicleInfo[CurrentVehicle][Owned] == 1)
{
if(strfind(VehicleInfo[CurrentVehicle][Owner], CurrentDriver, true) != -1)
{
SendClientMessage(playerid, COLOR_ORANGE, "Yours");
//This is where you place code affecting the owner of this vehicle
return 1;
}
else
{
SendClientMessage(playerid, COLOR_ORANGE, "Not yours.");
//This is where you place code affecting a player who entered the vehicle, but is NOT the owner
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_ORANGE, "Other Car.");
//This will occur when a player enters a non-owned car.
// return 1;
}
Just to let you know, I gave you wrong lines before it should be this, but I changed the code for this but it doesnt work. (Other Car Message whatever happens)
pawn Код:
enum car_info
{
Owner,
Owned
}
new VehicleInfo[MAX_PLAYERS][car_info];
And the file looks like this:
And inside the file
And also this is what I use to save/load the cars:
pawn Код:
new file[256], name[MAX_PLAYER_NAME];
GetPlayerName(OwnerID[vehicleid], name, sizeof(name));
format(file,sizeof(file),"Cars/%s.ini",name);
if(dini_Exists(file))