Making a stock
#1

Hi,I want to make a stock that I m using to get the playername.txt in the registering system

Код:
stock getfile(playerid)//idk what to put here in the ( )
{
	new file[64];
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid,name,sizeof(name));
	format(file,sizeof(file),"/users/%s.txt",name);
	return 1;// what needs to be returned here?
}
Код:
public OnPlayerConnect(playerid)
{
getfile(playerid);
	if(dini_Exists(file))
	{
//do something here
	}
	else 
	{
// do somthing here...
	}
	return 1;
}
I get this errors

error 017: undefined symbol "file"
error 017: undefined symbol "name"
Reply
#2

pawn Код:
stock getfile(playerid)
{
    new file[64];
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    format(file,sizeof(file),"/users/%s.txt",name);
    return file;
}

public OnPlayerConnect(playerid)
{
    if(dini_Exists(getfile(playerid)))
    {
//do something here
    }
    else
    {
// do somthing here...
    }
    return 1;
}
Reply
#3

[QUOTE=MarinacMrcina;1911224]Hi,I want to make a stock that I m using to get the playername.txt in the registering system

pawn Код:
stock getfile(playerid)
{
    new file[64], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), "/users/%s.txt", name);
    return file;// not sure but give it a try.
}
Reply
#4

pawn Код:
stock getfile(playerid)
{
    new file[64], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    format(file,sizeof(file),"/users/%s.txt",name);
    return file;
}

public OnPlayerConnect(playerid)
{
    if (dini_Exists(getfile(playerid)))
    {
        // exists
    }
    else
    {
        // not exists
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)