No message?
#1

Код:
CMD:setjingle(playerid, params[])
{
	new input;
	if(IsRadioMember(playerid))
	{
		if(sscanf(params, "s", input)) return SendUsageMessage(playerid, "/setjingle [jingle stream url] - Abusing will get you punished!");
		{
		    SendClientMessage(playerid, COLOR_UPDATED, "The jingle URL has successfully been updated!");
		    format(jingle, sizeof(jingle), "%s", input);
		    PlayAudioStreamForPlayer(playerid, newsjingle);
		}
	}
	else return SCM(playerid, COLOR_GREY, "You are not a member of RSF.");
	return 1;
}
Only way I can see the sendclientmessage and the "Audio Stream:" is when the input is only letters, any other characters such as http://************/LINKTOTHEJINGLE doesn't actually show, but it does update..

yelp, help please, I don't know which specifier to use for this one ( And I NEED the sendclientmessage to be sent )
Reply
#2

Is the player supposed to enter a url? If so, then sscanf should have given a warning for not specifying a length using "s" specifier but it's also wrong because input is integer and not a string as it should have.
sscanf is not needed though:
PHP код:
CMD:setjingle(playeridparams[])
{
    if(!
IsRadioMember(playerid)) return SCM(playeridCOLOR_GREY"You are not a member of RSF.");
    if(
isnull(params)) return SendUsageMessage(playerid"/setjingle [jingle stream url] - Abusing will get you punished!");
    
    
//strcat((jingle[0] = EOS, jingle), params, sizeof (jingle));
    
PlayAudioStreamForPlayer(playeridparams);
    
SendClientMessage(playeridCOLOR_UPDATED"The jingle URL has successfully been updated!");
    return 
1;

if "jingle" is a global string and you need to copy the url a player input to it, uncomment the line. Also "newsjingle" is not used for anything in the command.
Reply
#3

pawn Код:
CMD:setjingle(playerid, params[])
{
    new input[128];
    if(IsRadioMember(playerid))
    {
        if(sscanf(params, "s[128]", input)) return SendUsageMessage(playerid, "/setjingle [jingle stream url] - Abusing will get you punished!");
        {
            SendClientMessage(playerid, COLOR_UPDATED, "The jingle URL has successfully been updated!");
            format(jingle, sizeof(jingle), "%s", input);
            PlayAudioStreamForPlayer(playerid, newsjingle);
        }
    }
    else return SCM(playerid, COLOR_GREY, "You are not a member of RSF.");
    return 1;
}
This should work.
Reply
#4

Try this
PHP код:
CMD:setjingle(playeridparams[])
{
    new 
input[128];
    if(
IsRadioMember(playerid))
    {
        if(
sscanf(params"s[128]"input)) return SendUsageMessage(playerid"/setjingle [jingle stream url] - Abusing will get you punished!");
        {
            
SendClientMessage(playeridCOLOR_UPDATED"The jingle URL has successfully been updated!");
            
format(jinglesizeof(jingle), "%s"input);
            
PlayAudioStreamForPlayer(playeridnewsjingle);
        }
    }
    else return 
SCM(playeridCOLOR_GREY"You are not a member of RSF.");
    return 
1;

By the way, don't use format to pass on strings
Reply
#5

It is pretty funny how ignorance of the problem is contagious you don't need sscanf() or format() for a command like this the best solution was already posted.

@Konstintanos - You have 3 different SendClientMessage() commands going on there
Reply
#6

Quote:
Originally Posted by Pottus
Посмотреть сообщение
It is pretty funny how ignorance of the problem is contagious you don't need sscanf() or format() for a command like this the best solution was already posted.

@Konstintanos - You have 3 different SendClientMessage() commands going on there
#define SCM SendClientMessage

#define SendUsageMessage(%0,%1) \
SendClientMessage(%0, COLOR_YELLOW , "Usage:{FFFFFF} "%1)

#define SendErrorMessage(%0,%1) \
SendClientMessage(%0, COLOR_LIGHTRED, "Error:{FFFFFF} "%1)

those are mine

There's no need, it functions very well but the
Код:
SendClientMessage(playerid, COLOR_UPDATED, "The jingle URL has successfully been updated!");
isn't sent to the player when he has the link inserted, /playjingle works, I just need the successfully updated message to be sent to the player!
Reply
#7

Still need help with this, the code is fine, no errors or whatsoever, the jingle gets updated but there's no playerid once there's a special character like a semicolon in the input..
Reply
#8

You want this message
PHP код:
SendClientMessage(playeridCOLOR_UPDATED"The jingle URL has successfully been updated!"); 
to be sent to the player ?

Or this one ?
PHP код:
format(jinglesizeof(jingle), "%s"input); 
I'm asking because for the second one you're just formatting it but not sending it to anyone.
Reply
#9

Quote:
Originally Posted by rappy93
Посмотреть сообщение
You want this message
PHP код:
SendClientMessage(playeridCOLOR_UPDATED"The jingle URL has successfully been updated!"); 
to be sent to the player ?

Or this one ?
PHP код:
format(jinglesizeof(jingle), "%s"input); 
I'm asking because for the second one you're just formatting it but not sending it to anyone.
The formatting is used to change the url of the jingle, I need the SendClientMessage to be sent but if a player has inserted a special character the playerid is not being recognized, thus with an admin warning it shows no name but it does show the url, I'll take a screenshot in a little bit
Reply
#10

sigh fuck me why do i keep making such mistakes,
was on the wrong version of the gamemode and somehow it fixed now

cheers, thanks for the attempt
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)