[HELP] How to..
#1

Hello everyone, I don't know what to do in this situation...

Look at the code which goes under public OnPlayerConnect

Код:
format(string, sizeof(string), "users/%s.ini", playername);
	printf("%s", string); // debug
	if(fexist(string))
	{
		gPlayerAccount[playerid] = 1;
		return 1;
	}
	else
	{
		gPlayerAccount[playerid] = 0;
	}
	format(string, sizeof(string), "Vehicles/Players/%s.cfg", playername);
	printf("%s", string); // debug
	if(dini_Exists(string))
	{
	    strmid(PlayerVehicle[playerid][pVeh1], dini_Get(string, "Vehicle1"), 0, strlen(dini_Get(string, "Vehicle1")), 255);
	    strmid(PlayerVehicle[playerid][pVeh2], dini_Get(string, "Vehicle2"), 0, strlen(dini_Get(string, "Vehicle2")), 255);
	    strmid(PlayerVehicle[playerid][pVeh3], dini_Get(string, "Vehicle3"), 0, strlen(dini_Get(string, "Vehicle3")), 255);
	    strmid(PlayerVehicle[playerid][pVeh4], dini_Get(string, "Vehicle4"), 0, strlen(dini_Get(string, "Vehicle4")), 255);
	    strmid(PlayerVehicle[playerid][pVeh5], dini_Get(string, "Vehicle5"), 0, strlen(dini_Get(string, "Vehicle5")), 255);
		return 1;
	}
	else
	{
	    dini_Create(string);
	    strmid(PlayerVehicle[playerid][pVeh1], "None", 0, strlen("None"), 255);
	    strmid(PlayerVehicle[playerid][pVeh2], "None", 0, strlen("None"), 255);
	    strmid(PlayerVehicle[playerid][pVeh3], "None", 0, strlen("None"), 255);
	    strmid(PlayerVehicle[playerid][pVeh4], "None", 0, strlen("None"), 255);
	    strmid(PlayerVehicle[playerid][pVeh5], "None", 0, strlen("None"), 255);
	    //return 1;
	}
I know something is wrong right there, because when I connect, it doesn't load those files in Vehicles/Players/
In debug it loaded just *.ini files. How to load also Vehicles/Players/%s.cfg file?
Reply
#2

pawn Код:
format(string, sizeof(string), "/users/%s.ini", playername);
    printf("%s", string); // debug
    if(fexist(string))
    {
        gPlayerAccount[playerid] = 1;
        return 1;
    }
    else
    {
        gPlayerAccount[playerid] = 0;
    }
    format(string, sizeof(string), "/Vehicles/Players/%s.cfg", playername);
    printf("%s", string); // debug
    if(dini_Exists(string))
    {
        strmid(PlayerVehicle[playerid][pVeh1], dini_Get(string, "Vehicle1"), 0, strlen(dini_Get(string, "Vehicle1")), 255);
        strmid(PlayerVehicle[playerid][pVeh2], dini_Get(string, "Vehicle2"), 0, strlen(dini_Get(string, "Vehicle2")), 255);
        strmid(PlayerVehicle[playerid][pVeh3], dini_Get(string, "Vehicle3"), 0, strlen(dini_Get(string, "Vehicle3")), 255);
        strmid(PlayerVehicle[playerid][pVeh4], dini_Get(string, "Vehicle4"), 0, strlen(dini_Get(string, "Vehicle4")), 255);
        strmid(PlayerVehicle[playerid][pVeh5], dini_Get(string, "Vehicle5"), 0, strlen(dini_Get(string, "Vehicle5")), 255);
        return 1;
    }
    else
    {
        dini_Create(string);
        strmid(PlayerVehicle[playerid][pVeh1], "None", 0, strlen("None"), 255);
        strmid(PlayerVehicle[playerid][pVeh2], "None", 0, strlen("None"), 255);
        strmid(PlayerVehicle[playerid][pVeh3], "None", 0, strlen("None"), 255);
        strmid(PlayerVehicle[playerid][pVeh4], "None", 0, strlen("None"), 255);
        strmid(PlayerVehicle[playerid][pVeh5], "None", 0, strlen("None"), 255);
        //return 1;
    }
Try that, I am not sure if it will work..
Reply
#3

You just gave me the same code..

But I found out something strange.. When I start the server, buy car and relog, I still got that car, but when I restart the server, it show that I don't have a car, buy there is cfg file in folder, why is that?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)