PDA

View Full Version : No message?


JaydenJason
14/05/2015, 04:01 PM
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 :( )

Konstantinos
14/05/2015, 04:06 PM
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:

CMD:setjingle(playerid, params[])
{
if(!IsRadioMember(playerid)) return SCM(playerid, COLOR_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(playerid, params);
SendClientMessage(playerid, COLOR_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.

AdHaM612
14/05/2015, 04:07 PM
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.

Sellize
14/05/2015, 04:07 PM
Try this
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;
}

By the way, don't use format to pass on strings ;)

Pottus
14/05/2015, 04:32 PM
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 ;)

JaydenJason
14/05/2015, 04:43 PM
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!

JaydenJason
15/05/2015, 10:29 AM
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..

rappy93
15/05/2015, 10:50 AM
You want this message SendClientMessage(playerid, COLOR_UPDATED, "The jingle URL has successfully been updated!"); to be sent to the player ?

Or this one ? format(jingle, sizeof(jingle), "%s", input);
I'm asking because for the second one you're just formatting it but not sending it to anyone.

JaydenJason
15/05/2015, 11:33 AM
You want this message SendClientMessage(playerid, COLOR_UPDATED, "The jingle URL has successfully been updated!"); to be sent to the player ?

Or this one ? format(jingle, sizeof(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

JaydenJason
15/05/2015, 02:10 PM
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