How to load Float from .ini with Y_ini
#6

Quote:
Originally Posted by Kush
View Post
This makes no sense what you are doing. You are attempting to open and close a file locally through the process of executing a command. This is not how y_ini is supposed to be used. I'm not saying that it will not work, but values are supposed to be saved through variables.
new code:
pawn Code:
//          +++++++++++++++++++++++++++++++++++++++++++++++++
//          +       Car Rental System by Horrible           +
//          +-----------------------------------------------+
//          +    =   = = = =  = == = =  +  =     =    [==== +
//          +    = = = =   =  =    =    =  ====) =    [===  +
//          +    =   = = = =  =    =    =  =---) ==== [==== +
//          +------------------Version 1.4----------------- +
//          +++++++++++++++++++++++++++++++++++++++++++++++++
#define FILTERSCRIPT

#include <a_samp>
#include <ZCMD>
#include <sscanf2>
#include <y_ini>

#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_WHITE 0xFFFFFFAA
#define price 1000
#define time 600000// 600000 Milisecond = 10 minute, You Can Change It
#define OFF 0
#define ON  1

enum nstation
{
s1,
s2,
s3,
s4,
s5,
}
new station[nstation];
enum posinfo6
{
    Float:posx,
    Float:posy,
    Float:posz,
};
new PosInfo6[posinfo6];
enum posinfo0
{
    Float:posx,
    Float:posy,
    Float:posz,
};
new PosInfo0[MAX_PLAYERS][posinfo0];
enum posinfo1
{
    Float:posx,
    Float:posy,
    Float:posz,
};
new PosInfo1[MAX_PLAYERS][posinfo1];
enum posinfo2
{
    Float:posx,
    Float:posy,
    Float:posz,
};
new PosInfo2[MAX_PLAYERS][posinfo2];
enum posinfo3
{
    Float:posx,
    Float:posy,
    Float:posz,
};
new PosInfo3[MAX_PLAYERS][posinfo3];
new rentcar1[MAX_PLAYERS];
new rentcar2[MAX_PLAYERS];
new rentcar3[MAX_PLAYERS];
new Locked[MAX_PLAYERS], IsLocked[MAX_VEHICLES];
new engine, lights, alarm, doors, bonnet, boot, objective;
new Float:x, Float:y, Float:z;
new timer1;
new timer2;
new timer3;
new slot;
new Float:x1, Float:y1, Float:z1;
new Float:x2, Float:y2, Float:z2;
new Float:x3, Float:y3, Float:z3;
new Float:x4, Float:y4, Float:z4;
new Float:x5, Float:y5, Float:z5;
new file1;

forward car1(playerid);
forward car2(playerid);
forward car3(playerid);
forward load_user_data_basic(playerid, name[], value[]);

public OnFilterScriptInit()
{
        print("\n--------------------------------------");
        print(" Car Rental System by Horrible");
        print("--------------------------------------\n");
        print(" =   = = = =  = == = =  +  =     =    [====");
        print(" = = = =   =  =    =    =  ====) =    [=== ");
        print(" =   = = = =  =    =    =  =---) ==== [==== ");
        print(" ----------------Version 1.4-----------------");
        DisableInteriorEnterExits();
        for(new v = 0; v < MAX_VEHICLES; v++) IsLocked[v] = 0;
        return 1;
}
public OnFilterScriptExit()
{
        print("\n--------------------------------------");
        print(" Car Rental System by Horrible");
        print("--------------------------------------\n");
        print(" =   = = = =  = == = =  +  =     =    [====");
        print(" = = = =   =  =    =    =  ====) =    [=== ");
        print(" =   = = = =  =    =    =  =---) ==== [==== ");
        print(" ----------------Version 1.4-----------------");
        return 1;
}
public OnPlayerConnect(playerid)
{
        INI_ParseFile( "/h-rental/rental.ini", "load_user_data_basic" ,.bExtra = true, .extra = playerid);
        Locked[playerid] = 0;
        return 1;
}
public load_user_data_basic(playerid, name[], value[])
{
    INI_Float("X1", PosInfo6[posx]);
    INI_Float("Y1", PosInfo6[posy]);
    INI_Float("Z1", PosInfo6[posz]);
    station[s1] = CreatePickup(1318, 1, PosInfo6[posx],PosInfo6[posy],PosInfo6[posz], 0);
    return 1;
}
CMD:createrental(playerid, params[])
{
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFF0000AA,"You can't use this command.");
        if(sscanf(params, "i", slot)) return SendClientMessage(playerid, COLOR_GREEN, "Usage: /createrental <slot>");
        if(slot < 1 || slot > 5) return SendClientMessage(playerid, COLOR_GREEN, "Invalid slot Id, (1 - 5)");
        if(slot == 1)
        {
        new file;
        file = INI_Open("/h-rental/rental.ini");
        DestroyPickup(station[s1]);
        GetPlayerPos(playerid, x1, y1, z1);
        PosInfo6[posx] = x1;
        PosInfo6[posy] = y1;
        PosInfo6[posz] = z1;
        INI_SetTag(file1, "basic");
        INI_WriteFloat(file1, "X1", PosInfo6[posx]);
        INI_WriteFloat(file1, "Y1", PosInfo6[posy]);
        INI_WriteFloat(file1, "Z1", PosInfo6[posz]);
        station[s1] = CreatePickup(1318, 1, x1,y1,z1, 0);
        INI_Close(file);
        }
return 1;
}
Float saved but can't load (create pickup)
Reply


Messages In This Thread
How to load Float from .ini with Y_ini - by Horrible - 22.08.2011, 08:46
Re: How to load Float from .ini with Y_ini - by [MWR]Blood - 22.08.2011, 08:54
Re: How to load Float from .ini with Y_ini - by Horrible - 22.08.2011, 09:00
Re: How to load Float from .ini with Y_ini - by Basicz - 22.08.2011, 12:03
Re: How to load Float from .ini with Y_ini - by Kush - 22.08.2011, 20:15
Re: How to load Float from .ini with Y_ini - by Horrible - 23.08.2011, 00:12
Re: How to load Float from .ini with Y_ini - by Kush - 23.08.2011, 00:29
Re: How to load Float from .ini with Y_ini - by Horrible - 23.08.2011, 00:37
Re: How to load Float from .ini with Y_ini - by iPLEOMAX - 23.08.2011, 00:43
Re: How to load Float from .ini with Y_ini - by Horrible - 23.08.2011, 00:45

Forum Jump:


Users browsing this thread: 3 Guest(s)