Check For Owner
#9

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:

Код:
Paul.ini
And inside the file
Код:
Owner=Paul
Owned=1
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))
Reply


Messages In This Thread
Check For Owner - by HondaCBR - 25.11.2011, 22:18
Re: Check For Owner - by Rob_Maate - 25.11.2011, 22:53
Re: Check For Owner - by HondaCBR - 25.11.2011, 23:06
Re: Check For Owner - by Rob_Maate - 25.11.2011, 23:26
Re: Check For Owner - by HondaCBR - 25.11.2011, 23:57
Re: Check For Owner - by Rob_Maate - 26.11.2011, 00:07
Re: Check For Owner - by HondaCBR - 26.11.2011, 00:29
Re: Check For Owner - by Rob_Maate - 26.11.2011, 01:40
Re: Check For Owner - by HondaCBR - 26.11.2011, 09:57

Forum Jump:


Users browsing this thread: 1 Guest(s)