Music Error
#1

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 have made that pawn compiler but i'm addmusic done and i'm type /mp3 nothing happen please help me
Reply
#2

Check ur cmd that on which line adding it doesn't work , i think u have done a little things wrong in it, so it is not working . Delete some lines n check in which line its giving errors..
Reply
#3

I know the error but i don't know how to fix it...

How do i create a folder?
Reply
#4

Debugging is imperative. Check out this guide to debugging scripts on the SA-MP wiki.
Reply
#5

Please... I need the function to create a folder
Reply
#6

I think u can create a folder urself in scriptfiles coz compiler read all folders and userfiles from scriptfiles
Reply
#7

No i create folder name songs and i need a function to make a folder name player like name Fizz is /Songs/Fizz(folder)/name.ini
Reply
#8

Bump. Please i need the function to make a folder like this

Quote:

No i create folder name songs and i need a function to make a folder name player like name Fizz is /Songs/Fizz(folder)/name.ini

Reply
#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
#10

No. I mean oh shit remove....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)