Making a add song command
#1

Is it possible to do something like this.

Player is in game and types /addsong "name of the song" "link of the song"

When he types the add song the song name saves into his saved file and the link also. so when he types /mysongs a dialog will dialog will pop up saying like

Eminem love the way you lie
Tijon Nightmares

etc

I know how to save the links and names to a file but don't no how to make it from numbers to like text and make the code where it is /addsong "name" "link"

thanks if any one can help.
Reply
#2

Yes you can.
Just make it save the link in the file, than read...
Like:

pawn Код:
new link;
link = dini_Int(file, "Music1")
PlayAudioStreamForPlayer(playerid, link, Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0)
Something similar to this should work.. Just gave you example, you have to check the file and that all.
Reply
#3

Quote:
Originally Posted by ricardo178
Посмотреть сообщение
Yes you can.
Just make it save the link in the file, than read...
Like:

pawn Код:
new link;
link = dini_Int(file, "Music1")
PlayAudioStreamForPlayer(playerid, link, Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0)
Something similar to this should work.. Just gave you example, you have to check the file and that all.
ye but how to make the command that will save the link in the file thats what im struggling on.
Reply
#4

You said you know how to do it lol...
By the way using dini is something like:
pawn Код:
CMD:savesong(playerid, params[])
{
    new musicname[128], link[128];
    if(!sscanf(params, "s[128]s[128]", musicname, link))
    {
        format(file, sizeof(file), "music/musics.ini");
        if(fexist(file))
        {
            dini_Set(file, "%s %s", musicname, link);
        }
        return 1;
    }
    else return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /savesong [Song Name] [Song Link]");
}
Didn't really test it and i am not sure if it's right done..
Reply
#5

i have code i use for loading other date from files,
im headed to work but if you dont have this fixed when i get home ill post,


basiclly you need to use either the raw file commands (fread fwrite)
and sscanf, or use an ini system, id say the raw file functions is your way to go.
Reply
#6

Quote:
Originally Posted by ricardo178
Посмотреть сообщение
You said you know how to do it lol...
By the way using dini is something like:
pawn Код:
CMD:savesong(playerid, params[])
{
    new musicname[128], link[128];
    if(!sscanf(params, "s[128]s[128]", musicname, link))
    {
        format(file, sizeof(file), "music/musics.ini");
        if(fexist(file))
        {
            dini_Set(file, "%s %s", musicname, link);
        }
        return 1;
    }
    else return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /savesong [Song Name] [Song Link]");
}
Didn't really test it and i am not sure if it's right done..
i want it so it can be done like this with out zcmd or what ever its called.

Quote:

if (strcmp("/savesong", cmdtext, true, 10) == 0)
{
new musicname[128], link[128];
if(!sscanf(params, "s[128]s[128]", musicname, link))
{
format(file, sizeof(file), "music/musics.ini");
if(fexist(file))
{
dini_Set(file, "%s %s", musicname, link);
}
return 1;
}
else return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /savesong [Song Name] [Song Link]");
}

but when i do that and compile i get these errors

Quote:

C:\Users\Desktop\New folder\pawno\rp.pwn(2642) : error 017: undefined symbol "params"
C:\Users\Desktop\New folder\pawno\rp.pwn(2644) : error 017: undefined symbol "file"
C:\Users\Desktop\New folder\pawno\rp.pwn(2644) : error 017: undefined symbol "file"
C:\Users\Desktop\New folder\pawno\rp.pwn(2644) : error 029: invalid expression, assumed zero
C:\Users\Desktop\New folder\pawno\rp.pwn(2644) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.

thanks for help tho.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)