No message? -
JaydenJason - 14.05.2015
Код:
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
)
Re: No message? -
Konstantinos - 14.05.2015
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(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.
Re: No message? -
AdHaM612 - 14.05.2015
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.
Re: No message? -
Sellize - 14.05.2015
Try this
PHP код:
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
Re: No message? -
Pottus - 14.05.2015
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
Re: No message? -
JaydenJason - 14.05.2015
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!
Re: No message? -
JaydenJason - 15.05.2015
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..
Re: No message? -
rappy93 - 15.05.2015
You want this message
PHP код:
SendClientMessage(playerid, COLOR_UPDATED, "The jingle URL has successfully been updated!");
to be sent to the player ?
Or this one ?
PHP код:
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.
Re: No message? -
JaydenJason - 15.05.2015
Quote:
Originally Posted by rappy93
You want this message
PHP код:
SendClientMessage(playerid, COLOR_UPDATED, "The jingle URL has successfully been updated!");
to be sent to the player ?
Or this one ?
PHP код:
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
Re: No message? -
JaydenJason - 15.05.2015
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