Adding to the Dialogs - 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: Adding to the Dialogs (
/showthread.php?tid=606523)
Adding to the Dialogs -
Jaev - 05.05.2016
PHP код:
if(dialogid == DIALOG_INPUT)
{
if(response)
{
if(addRCON[playerid] == true)
{
new id[24];
if(strcmp(inputtext, id, false) == 0)
{
dfile_Open(PlayerPath(inputtext[id]));
}
return 0;
}
}
}
-
PHP код:
stock PlayerPath(playerid)
{
new path[128];
format(path, sizeof(path), ACC_PATH"%s.ini", NazwaGracza(playerid));
return path;
}
-
PHP код:
stock NazwaGracza(playerid)//playername
{
new nazwa[MAX_PLAYER_NAME];
GetPlayerName(playerid, nazwa, sizeof(nazwa));
return nazwa;
}
error 033: array must be indexed (variable "id")
lane 320:
dfile_Open(PlayerPath(inputtext[id]));
What the fu*k is wrong with this? :v
Re: Adding to the Dialogs -
BiosMarcel - 05.05.2016
id is an array, so you have to tell the programm which index of id it should access like id[0] (just an example),
otherwise if it is suppossed to be a string you cant use it as an index on another variable
actually i dont even get what u are trying ^^, do you want to filter an id ?
that code is pretty much bullshit xD
Re: Adding to the Dialogs -
Jaev - 05.05.2016
PHP код:
new id[24];
dfile_Open(PlayerPath(id));
I do not understand how am I supposed to do
Re: Adding to the Dialogs -
Dayrion - 05.05.2016
I don't get it too. What are you trying to do?
Why don't you get the player's name in your 'Playerpath'? Like this :
PHP код:
#define PATH "/Players/%s.ini" // Put your folder.
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername)); // Get the player's name
format(string,sizeof(string),PATH,playername); // Replace %s of the PATH by the player's name
return string; // Return the string (Ex: /Players/Dayrion.ini)
}
I don't think if this helped you.