PDA

View Full Version : Making a stock


MarinacMrcina
08/06/2012, 02:09 PM
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"

HuSs3n
08/06/2012, 02:13 PM
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;
}

FalconX
08/06/2012, 02:13 PM
[QUOTE=MarinacMrcina;1911224]Hi,I want to make a stock that I m using to get the playername.txt in the registering system

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.
}

CptK
08/06/2012, 02:14 PM
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
}
}