Show list , help - 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: Show list , help (
/showthread.php?tid=547591)
Show list , help -
Slicebook - 23.11.2014
Hello! How can I solve this?
if you type the command /savename, save the name of a text document..
if you type the command /namelist, list the names who enter the command (/savename)
Problem: Saves the name ,but /namelist command does not add up
Photo:
Save:
http://www.kephost.com/image/f4M
Server:
http://www.kephost.com/image/f4C
Code:
Код:
#define RFILES "namelist.txt"
CMD:savename(playerid,params[])
{
new pname[24], File:ftw=fopen("namelist.txt", io_write);
if(ftw)
{
GetPlayerName(playerid, pname, 24);
fwrite(ftw, pname);
fclose(ftw);
}
return 1;
}
CMD:namelist(playerid,params[])
{
new str[256];
new oldrecord = dini_Int(RFILES,"namelist");
format(str,sizeof(str),"[Name-ALL List]: %s ",oldrecord);
SCM(playerid,COLOR_SYSTEM,str);
return 1;
}
Re: Show list , help -
UltraScripter - 23.11.2014
Try With Dini
Code :
pawn Код:
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, size(pName));
dini_Create(yourfile);
dini_IntSet(yourfile, "Name", pName);
Re: Show list , help -
UltraScripter - 23.11.2014
sorry my bad
delete
pawn Код:
dini_IntSet(yourfile, "Name", pName);
And Relpace :
pawn Код:
dini_Set(yourfile, "Name", pName);
Instead !

.!!!!!!!!!
Re: Show list , help -
Slicebook - 23.11.2014
?? I do not understand
Re: Show list , help -
UltraScripter - 23.11.2014
pawn Код:
new pName[MAX_PLAYER_NAME]; //player name
GetPlayerName(playerid, pName, sizeof(pName)); // get player name
dini_Create(yourfile); //creates your file
dini_Set(yourfile, "Name", pName); // sets name to the ini file remembering player name
Well hope that helped !

.!
Re: Show list , help -
Slicebook - 23.11.2014
I do not think so .. name all in one place and the command will list all. save the good! Get the bad
Код:
CMD:namelist(playerid,params[])
{
new str[256];
new oldrecord = dini_Int(RFILES,"namelist");
format(str,sizeof(str),"[Name-ALL List]: %s ",oldrecord);
SCM(playerid,COLOR_SYSTEM,str);
return 1;
}
Re: Show list , help -
UltraScripter - 23.11.2014
Try to add
new NameMAX_PLAYER_NAME];
for(new i; i<MAX_PLAYERS; i++)
{
GetPlayerName(I, Name, sizeof(Name))
}