Help loading and fomatting name..
#3

BUMP!!
Ok, here is the code fixed a little bit:

pawn Код:
stock AddPVehiclesFromFile(FileName[])
{
    if(!fexist(FileName)) return 0;

    new File:VehicleFile, vModel, Float:VX, Float:VY, Float:VZ, Float:VA, vTotal, Line[128], vOwner[MAX_PLAYER_NAME+6], C1, C2, vID;

    VehicleFile = fopen(FileName, io_read);
    while(fread(VehicleFile, Line))
    {
        if(Line[0] == '/' || isnull(Line)) continue;
        unformat(Line, "iffffiis[24]", vModel, VX, VY, VZ, VA, C1, C2, vOwner[24]);
        vID = AddStaticVehicleEx(vModel, VX, VY, VZ, VA, -1, -1, (30*60));
        format(VEHICLE_OWNER[vID][VEHOWNER], MAX_PLAYER_NAME, vOwner[24]);
        vTotal++;
    }
    fclose(VehicleFile);
    return vTotal;
}
Ok, the vehicles now load and formats the name, but somehow its formatting it wrong :S

, here is the function i use to check if the names match:

pawn Код:
stock VehicleOwner(playerid, VehicleID)
{
    if(strlen(VEHICLE_OWNER[VehicleID][VEHOWNER]) == 0)
    {
        return -1;    
    }
    if(!StringCompare(VEHICLE_OWNER[VehicleID][VEHOWNER],pName(playerid)))
    {
        return 0;
    }
    return 1;    
}
and i use this to test it:
pawn Код:
stock StringCompare(String1[], String2[])
{
    if(strlen(String1) == 0 || strlen(String2) == 0)
    {
        return false;
    }
    if(strcmp(String1 ,String2, true ) == 0 )
    {
        printf("\"%s\" is the same as \"%s\"", String1, String2);
        return true;
    }
    else
    {
        printf("\"%s\" is different from \"%s\"", String1, String2);
        return false;
    }
}
The output of the above function is :
pawn Код:
[16:12:05] `U214

` is different from `U214`
[16:12:05] `U214

` is different from `U214`
So the problem is when it creates the function, its not getting the correct name
Reply


Messages In This Thread
Help loading and fomatting name.. - by [L3th4l] - 15.08.2010, 01:14
Re: Help loading and fomatting name.. - by PotH3Ad - 15.08.2010, 03:41
Re: Help loading and fomatting name.. - by [L3th4l] - 15.08.2010, 21:20

Forum Jump:


Users browsing this thread: 4 Guest(s)