Music Error
#9

Instead of trying to create a new folder, why don't you try and use underscores instead?

pawn Код:
COMMAND:addmusic(playerid,params[])
{
    new name[50],link[70],pname[MAX_PLAYER_NAME],fstring[256];
    if(sscanf(params,"s[50]s[70]",name,link)) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"USAGE: /addmusic [Name] [Link");
    GetPlayerName(playerid,pname,sizeof(pname));
    indexsong[playerid] = GetPlayerMusicCount(playerid);
    format(fstring,sizeof(fstring),"/Songs/%s_%d.music",pname,indexsong[playerid]);
    dini_Create(fstring);
    dini_Set(fstring,"Name",name);
    dini_Set(fstring,"Link",link);
    SendClientMessage(playerid,COLOR_GREEN,"Added to your mp3. Use /mp3 to hear it");
    return 1;
}

COMMAND:mp3(playerid,params[])
{
    new pname[50],mstring[2000],str1[256],str2[260],file[100];
    GetPlayerName(playerid,pname,sizeof(pname));
    for(new i = 0; i <= MAX_SONGS; i++)
    {
        format(file,sizeof(file),"/Songs/%s_%d.music",pname,i);
        if(dini_Exists(file))
        {
            str1 = dini_Get(file,"Name");
            format(str2,sizeof(str2),"%s\n",str1);
            strcat(mstring,str2);
        }
    }
    ShowPlayerDialog(playerid,DIALOG_MUSIC,DIALOG_STYLE_LIST,"Song List",mstring,"Hear","Cancel");
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_MUSIC)
    {
        if(response)
        {
            new pname[50],file[200],link[256],send[128],name[256];
            GetPlayerName(playerid,pname,sizeof(pname));
            format(file,sizeof(file),"/Songs/%s_%d.music",pname,listitem);
            link = dini_Get(file,"Link");
            name = dini_Get(file,"Name");
            PlayAudioStreamForPlayer(playerid,link);
            format(send,sizeof(send),"You have play song name %s",name);
            SendClientMessage(playerid,COLOR_GREEN,send);
        }
    }
    return 1;
}

stock GetPlayerMusicCount(playerid)
{
    new file[100],pname[50];
    GetPlayerName(playerid,pname,sizeof(pname));
    for(new i = 0; i <= MAX_SONGS; i++)
    {
        format(file,sizeof(file),"/Songs/%s_%d.music",pname,i);
        if(!dini_Exists(file))
        {
            return i;
        }
    }
    return 1;
}
I don't think that you can create folders in scriptfiles from within Pawno unfortunately.
Reply


Messages In This Thread
Music Error - by xganyx - 28.08.2013, 03:37
Re: Music Error - by PrinceKumar - 28.08.2013, 03:51
Re: Music Error - by xganyx - 28.08.2013, 04:00
Re: Music Error - by Squash - 28.08.2013, 04:02
Re: Music Error - by xganyx - 28.08.2013, 04:09
Re: Music Error - by PrinceKumar - 28.08.2013, 04:17
Re: Music Error - by xganyx - 29.08.2013, 03:51
Re: Music Error - by xganyx - 29.08.2013, 09:27
Re: Music Error - by lewismichaelbbc - 29.08.2013, 11:43
Re: Music Error - by xganyx - 29.08.2013, 13:36

Forum Jump:


Users browsing this thread: 2 Guest(s)