Make the property system
#1

How to get the data from file?

I test it:

Код:
#include <a_samp>
#include <sscanf2>
#include <streamer>

#define MAX_PROPERTYS 1000
#define FILE_PROPERTYS "Propertys/"

enum PropertyMain
{
	PropertyName[50],
	PropertyFile[100],
	PropertyIncome,
	PropertyPrice,
	PropertyOwned,
	PropertyOwner[MAX_PLAYER_NAME],
	Float:PropertyX,
	Float:PropertyY,
	Float:PropertyZ
}
new Property[PropertyMain];

public OnFilterScriptInit()
{
	for(new P = 0; P < MAX_PROPERTYS; P++)
	{
	    format(Property[PropertyFile],100,"%s%d.ini",FILE_PROPERTYS,P);
	    if(fexist(Property[PropertyFile]))
	    {
	        new File:File = fopen(Property[PropertyFile],io_read);
	        new Name[50],Income,Price,Owned,Owner[MAX_PLAYER_NAME],Float:X,Float:Y,Float:Z;
	        sscanf(File,"siiisfff",Name,Income,Price,Owned,Owner,X,Y,Z);
		}
	}
	return 1;
}
Quote:

C:\Documents and Settings\user\Pulpit\Serwer\filterscripts\Skrypt1. pwn(31) : error 035: argument type mismatch (argument 1)
C:\Documents and Settings\user\Pulpit\Serwer\filterscripts\Skrypt1. pwn(29) : warning 204: symbol is assigned a value that is never used: "File"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#2

What lines,there are no 31 line in this piece of code.
Reply
#3

this is your error in sscanf specifiers
pawn Код:
sscanf(File,"ssiiisfff",Name,Income,Price,Owned,Owner,X,Y,Z);
you using the old sscanf?
i ask because the new one expects a string len also.
Reply
#4

Try it now:

pawn Код:
#include <a_samp>
#include <sscanf2>
#include <streamer>

#define MAX_PROPERTYS 1000
#define FILE_PROPERTYS "Propertys/"

enum PropertyMain
{
    PropertyName[50],
    PropertyFile[100],
    PropertyIncome,
    PropertyPrice,
    PropertyOwned,
    PropertyOwner[MAX_PLAYER_NAME],
    Float:PropertyX,
    Float:PropertyY,
    Float:PropertyZ
}
new Property[PropertyMain];

public OnFilterScriptInit()
{
    for(new P = 0; P < MAX_PROPERTYS; P++)
    {
        format(Property[PropertyFile],100,"%s%d.ini",FILE_PROPERTYS,P);
        if(fexist(Property[PropertyFile]))
        {
            new File:File = fopen(Property[PropertyFile],io_read);
            new Name[50],Income,Price,Owned,Owner[MAX_PLAYER_NAME],Float:X,Float:Y,Float:Z;
            sscanf(File,"s[50]iiis[40]fff",Name,Income,Price,Owned,Owner,X,Y,Z);
        }
    }
    return 1;
}
I simply did what Jonny said, not sure if you are using an old one or the newest one. Newest one requires this.
Reply
#5

@up Big thx
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)