/createpayphone <-- Check this!
#2

pawn Код:
SavePhones()
{
    new coordsstring[50],idx = -1;
    new File:file = fopen("payphones.cfg", io_write);
    while(++idx < sizeof(GarageInfo))
    {
        format(coordsstring, sizeof(coordsstring), "%d|%.4f|%.4f|%.4f\r\n",GarageIDTaken[idx],PhoneInfo[idx][PhoneX],PhoneInfo[idx][PhoneY],PhoneInfo[idx][PhoneZ]);
        fwrite(file, coordsstring);
    }
    fclose(file);
    return;
}

LoadPhones()
{
    new arrCoords[4][64];
    new strFromFile[100];
    new File:file = fopen("payphones.cfg", io_read);
    if(file)
    {
        new idx = -1;
        while(++idx < sizeof(PhoneInfo) && fread(file, strFromFile))
        {
            split(strFromFile, arrCoords, '|');
            PhoneIDTaken[idx] = strval(arrCoords[0]);
            PhoneInfo[idx][PhoneX] = floatstr(arrCoords[1]);
            PhoneInfo[idx][PhoneY] = floatstr(arrCoords[2]);
            PhoneInfo[idx][PhoneZ] = floatstr(arrCoords[3]);
            printf("%s = %d, %.4f, %.4f, %.4f",strFromFile,PhoneIDTaken[idx],PhoneInfo[idx][PhoneX],PhoneInfo[idx][PhoneY],PhoneInfo[idx][PhoneZ]);
            if(HouseIDTaken[idx])
            {
                CreateStreamed3DTextLabel(PAYPHONE_LABEL, HOUSE_COLOR, PhoneInfo[idx][PhoneX], PhoneInfo[idx][PhoneY], PhoneInfo[idx][PhoneZ], 10.0, idx);
                phones++;
            }
        }
    }
    return;
}

if(strcmp(cmd, "/createphone", true) == 0)
{
    if(PlayerInfo[playerid][pAdmin] >= 1337)
    {
        new id = GetAvailableID(TYPE_PHONE); // must returns 0 - sizeof(PhoneInfo)-1
        PhoneIDTaken[id] = 1;
        GetPlayerPos(playerid, PhoneInfo[id][PhoneX], PhoneInfo[id][PhoneY], PhoneInfo[id][PhoneZ]);
        CreateStreamed3DTextLabel(PAYPHONE_LABEL, HOUSE_COLOR, PhoneInfo[id][PhoneX], PhoneInfo[id][PhoneY], PhoneInfo[id][PhoneZ], 10.0, 0);
        SavePhones();
    }
    return 1;
}
and show printf in load and why is GarageIDTaken then PhoneIDTaken[idx] and HouseIDTaken[idx] ? 3 different arrays ?
Reply


Messages In This Thread
/createpayphone <-- Check this! - by hewittpro - 01.11.2013, 01:54
Re: /createpayphone <-- Check this! - by Jefff - 01.11.2013, 02:13
Re: /createpayphone <-- Check this! - by hewittpro - 01.11.2013, 02:15
Re: /createpayphone <-- Check this! - by Jefff - 01.11.2013, 02:17
Re: /createpayphone <-- Check this! - by hewittpro - 01.11.2013, 02:39
Re: /createpayphone <-- Check this! - by hewittpro - 01.11.2013, 10:47
Re: /createpayphone <-- Check this! - by Jefff - 01.11.2013, 15:13
Re: /createpayphone <-- Check this! - by BlackHorse - 01.11.2013, 15:47
Re: /createpayphone <-- Check this! - by hewittpro - 01.11.2013, 16:21
Re: /createpayphone <-- Check this! - by Jefff - 01.11.2013, 16:26

Forum Jump:


Users browsing this thread: 3 Guest(s)