%s Issue in my script. -
Shockey HD - 30.01.2012
Im working on an Advanced DJ system in my script..
When they enter the File URL in the my Input Dialog, It sets new FILEONE[MAX_PLAYERS];
to
FILEONE[playerid] = file;
Heres the coding for it.
Код:
switch( dialogid )
{
case DIALOG_FILEONE:
{
if ( !response ) return SendClientMessage(playerid,COLOR_RED,"Gone Back.");
if( response )
{
new file = (strval(inputtext));
FILEONE[playerid] = file;
ShowPlayerDialog(playerid,DIALOG_SLOTONE,DIALOG_STYLE_LIST,"Slot One","File\nSong Name\nPlay Song","Select", "Cancel");
}
}
}
When FILONE[playeripd] = file: is called in the main command,
Код:
switch(dialogid)
{
case DIALOG_SLOTONE:
{
switch(listitem)
{
case 0:
{
ShowPlayerDialog(playerid,DIALOG_FILEONE,DIALOG_STYLE_INPUT,"File URL.","Enter your file URL below:","Select","Cancel");
}
case 1:
{
ShowPlayerDialog(playerid,DIALOG_NAMEONE,DIALOG_STYLE_INPUT,"Song Name","Enter The Name Of The Song Below:","Select","Cancel");
}
case 2:
{
new string[128],string2[128];
for(new i = 0; i < MAX_PLAYERS; i++)
{
format(string,sizeof(string),"http://dl.dropbox.com/u/""%d""/""%s"".mp3",DROPBOX[playerid],FILEONE[playerid]);
PlayAudioStreamForPlayer(i,string);
}
}
}
}
}
%s is not being replaced with FILEONE's Variable. (The URL Link)
But, The setup is the same for the DROPBOX, But its using %d instead of %s. Any idea?
AW: %s Issue in my script. -
Rimeau - 30.01.2012
You are handling FILEONE[playerid] as an integer, if you want to store a piece of text, you have to use a string
Re: %s Issue in my script. -
Shockey HD - 31.01.2012
Mind assisting me with such?
Re: %s Issue in my script. -
Snowman12 - 31.01.2012
Well thats incorrect, you can use such as a string, however file just = inputtext, strval is getting the value from a string ie an int. I believe, give it a go and tell me :P
Re: %s Issue in my script. -
Shockey HD - 31.01.2012
as coming back to scripting,
Heres what i got:
Код:
switch( dialogid )
{
case DIALOG_FILEONE:
{
if ( !response ) return SendClientMessage(playerid,COLOR_RED,"Gone Back.");
if( response )
{
new file = inputtext;
FILEONE[playerid] = file;
ShowPlayerDialog(playerid,DIALOG_SLOTONE,DIALOG_STYLE_LIST,"Slot One","File\nSong Name\nPlay Song","Select", "Cancel");
}
}
}
Heres the errors i got.
Код:
error 033: array must be indexed (variable "-unknown-")
Re: %s Issue in my script. -
Snowman12 - 31.01.2012
which line is the error? Also why are you using switchs/cases?
Re: %s Issue in my script. -
iggy1 - 31.01.2012
%s is for strings.
pawn Код:
new file = (strval(inputtext));
FILEONE[playerid] = file;//FILEONE is now an integer (string value of the inputtext string)
Didn't see the post two above mine.
You can't do this.
pawn Код:
new file = inputtext;//'file' is an int and inputtext is an array of unknown size
AW: %s Issue in my script. -
Rimeau - 31.01.2012
pawn Код:
new FILEONE[MAX_PLAYERS][32]; //You can also use more, dunno how long a song URL is
format(FILEONE[playerid], 32, inputtext);
Not sure if format is the best solution for this, but that's how I would do it