Car owner on Enter vehicle.
#1

Hello. I am trying to make it says the owner of the vehicle when player enter it, but it's not working. All it says is: [SERVER]: This is Vehicle. instead of [SERVER]: This is OwnerName Vehicle.

My code of OnPlayerEnterVehicle is:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid)
{
    format(file, sizeof(file), "RRP/vehicles/%d.ini", vehicleid);
    if(fexist(file))
    {
        new string[128];
        format(string, sizeof(string), "[SERVER]: This is %s vehicle.", dini_Int(file, "Owner"));
        SendClientMessage(playerid, COLOR_LIGHTRED, string);
    }
}
The file of one of the vehicles i am trying to enter is:
Код:
X=1965.977661
Y=1289.736816
Z=10.525081
A=355.682922
Model=560
Color1=1
Color2=1
Price=10000
Owner=Ricardo_Rodrigues
Ownable=2
Lock=0
Weapon1=0
Weapon2=0
Weapon3=0
Weapon4=0
Weapon5=0
Materials=0
This is all self made codes.
Thank you.
Reply
#2

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid)
{
    format(file, sizeof(file), "RRP/vehicles/%d.ini", vehicleid);
    if(fexist(file))
    {
        new string[128];
        format(string, sizeof(string), "[SERVER]: This is %s vehicle.", dini_Get(file, "Owner"));
        SendClientMessage(playerid, COLOR_LIGHTRED, string);
    }
}

Name is a string, not integer
Reply
#3

Use this:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid)
{
    format(file, sizeof(file), "RRP/vehicles/%d.ini", vehicleid);
    if(fexist(file))
    {
        new string[128];
        format(string, sizeof(string), "[SERVER]: This is %s vehicle.", dini_Get(file, "Owner"));
        SendClientMessage(playerid, COLOR_LIGHTRED, string);
    }
}
You can not use 'dini_Int' since it's not an integer thus you'll have to use dini_Get.

Edit: person above has beaten me to it :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)