SA-MP Forums Archive
Making a stock - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Making a stock (/showthread.php?tid=349276)



Making a stock - MarinacMrcina - 08.06.2012

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"


Re: Making a stock - HuSs3n - 08.06.2012

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



Re: Making a stock - FalconX - 08.06.2012

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



Re: Making a stock - CptK - 08.06.2012

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