DJ System Issue
#1

Howdy, Im using the PlayAudioStreamForPlayer function and im coming up with an issue.

Код:
CMD:dj(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
		new text,pName[MAX_PLAYER_NAME],string[128];
		if(sscanf(params, "s[125]",text)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /dj [Dropbox ID] [Filename]");
	  	else
	  	{
	  	
	  	    PlayAudioStreamForPlayer(playerid,"%s",text);
		}
	}
	return 1;
}
Thats the code i just made

But the problem is, %s is not being replaced with the text i would like to use, as it is thinking that the audio file is %s.

Any suggestions?
Reply
#2

pawn Код:
CMD:dj(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        new text,pName[MAX_PLAYER_NAME],string[128],url[50];
        if(sscanf(params, "s[125]",text)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /dj [Dropbox ID] [Filename]");
        else
        {
            format(url,sizeof(url),"%s",text);
            PlayAudioStreamForPlayer(playerid,url);
        }
    }
    return 1;
}
Reply
#3

how about
pawn Код:
CMD:dj(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        new text,pName[MAX_PLAYER_NAME],string[128];
        if(sscanf(params, "s[125]",text)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /dj [Dropbox ID] [Filename]");
                    format(string,sizeof(string),"%s",text);
            PlayAudioStreamForPlayer(playerid,string);
    }
    return 1;
}
Reply
#4

cool avatar OP
Reply
#5

Tanush, Your command gives me Unkown Command error. Coole, Yours crashes the server.


I was able to fix it, and here is what i have.

Код:
CMD:dj(playerid,params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 2)
    {
        new text[60],pName[MAX_PLAYER_NAME],string[128];
		new songid[40];
        if(sscanf(params, "ds[125]",songid,text)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /dj [Dropbox ID] [Filename]");
        for(new i = 0; i < MAX_PLAYERS; i++)
		{
			format(string,sizeof(string),"http://dl.dropbox.com/u/""%d""/""%s"".mp3",songid,text);
        	PlayAudioStreamForPlayer(i,string);
		}
    }
    return 1;
}
It works and all, Expect if i have a song lets say Kayne West Power, The Spaces = %s but SAMP places it at # Any way i can fix that?
Reply
#6

oh shit sorry bro, i forgot to add [ ] for text
Reply
#7

No problem, And are you able to assist me with this issue,

http://dl.dropbox.com/u/54396459/You...ild%20Free.mp3

That is a song, But, SA-MP Replaces the % with #
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)