PDA

View Full Version : YCMD to ZCMD? +REP


TheMightyEddy
01/04/2012, 03:15 PM
I don't know if that's possible but can someone please convert this:

stock PlayAudioStreamForAll(url[])
{
for(new i; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected( i ))
{
PlayAudioStreamForPlayer(i, url, x, y, z, distance);
}
}
return 1;

}
stock StopAudioStreamForAll(url[])
{
for(new i; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected( i ))
{
StopAudioStreamForPlayer(playerid);
}
}
return 1;

}
YCMD:stopmusic(playerid, params[], help)
{
#pragma unused params
if (help)
{
SendClientMessage(playerid, 0xFF0000AA, "Stops audio for everyone.");
}
else
{
new
str[32];
if (isnull(params))
{
format(str, sizeof (str), "Usage: \"/stopmusic\"";
SendClientMessage(playerid, 0xFF0000AA, str);
}
else
{
StopAudioStreamForPlayer(playerid);
}
}
return 1;
}
YCMD:music(playerid, params[], help)
{
if (help)
{
SendClientMessage(playerid, 0xFF0000AA, "Plays audio for everyone.");
}
else
{
new
str[32];
if (isnull(params))
{
format(str, sizeof (str), "Usage: \"/music [url]\"";
SendClientMessage(playerid, 0xFF0000AA, str);
}
else
{
PlayAudioStreamForAll(params);
}
}
return 1;
}

+REP!

Jonny5
01/04/2012, 03:25 PM
i tried let me know if it works


stock PlayAudioStreamForAll(url[])
{
for(new i; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected( i ))
{
PlayAudioStreamForPlayer(i, url, x, y, z, distance);
}
}
return 1;

}
stock StopAudioStreamForAll(url[])
{
for(new i; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected( i ))
{
StopAudioStreamForPlayer(playerid);
}
}
return 1;

}
CMD:stopmusic(playerid, params[])
{
#pragma unused params
StopAudioStreamForPlayer(playerid);
return 1;
}

CMD:music(playerid, params[])
{
new
str[32];
if (isnull(params))
{
format(str, sizeof (str), "Usage: \"/music [url]\"";
SendClientMessage(playerid, 0xFF0000AA, str);
}
else
{
PlayAudioStreamForAll(params);
}
return 1;
}



also note these dont check if a player is admin first before letting them use the commands.
maybe you want that too?

antonio112
01/04/2012, 03:29 PM
stock PlayAudioStreamForAll(url[])
{
for(new i; i<GetMaxPlayers(); i++)
if(IsPlayerConnected( i ))
PlayAudioStreamForPlayer(i, url, x, y, z, distance);
return 1;

}
stock StopAudioStreamForAll(url[])
{
for(new i; i<GetMaxPlayers(); i++)
if(IsPlayerConnected( i ))
StopAudioStreamForPlayer(playerid);
return 1;

}
CMD:stopmusic(playerid, params[])
{
#pragma unused params
StopAudioStreamForPlayer(playerid);
return 1;
}
YCMD:music(playerid, params[], help)
{
new str[32];
if(isnull(params))
{
format(str, sizeof (str), "Usage: \"/music [url]\"";
SendClientMessage(playerid, 0xFF0000AA, str);
}
else PlayAudioStreamForAll(params);
return 1;
}

TheMightyEddy
01/04/2012, 03:52 PM
i tried let me know if it works

also note these dont check if a player is admin first before letting them use the commands.
maybe you want that too?

Do you know how I can add that? I want it to be rcon admin only. Thanks so much. Added rep for you already.

Jonny5
01/04/2012, 03:56 PM
just add


if(!IsPlayerAdmin(playerid))return 0;


to the top of each zcmd
example


CMD:music(playerid, params[])
{
if(!IsPlayerAdmin(playerid))return 0;

TheMightyEddy
01/04/2012, 04:05 PM
stock PlayAudioStreamForAll(url[])
{
for(new i; i<GetMaxPlayers(); i++)
if(IsPlayerConnected( i ))
PlayAudioStreamForPlayer(i, url, x, y, z, distance);
return 1;

}
stock StopAudioStreamForAll(url[])
{
for(new i; i<GetMaxPlayers(); i++)
if(IsPlayerConnected( i ))
StopAudioStreamForPlayer(playerid);
return 1;

}
CMD:stopmusic(playerid, params[])
{
#pragma unused params
StopAudioStreamForPlayer(playerid);
return 1;
}
YCMD:music(playerid, params[], help)
{
new str[32];
if(isnull(params))
{
format(str, sizeof (str), "Usage: \"/music [url]\"";
SendClientMessage(playerid, 0xFF0000AA, str);
}
else PlayAudioStreamForAll(params);
return 1;
}


And did you make a typo? I see YCMD:music...

ivanVU
01/04/2012, 04:08 PM
This won't work..

stock PlayAudioStreamForAll(url[])
{
for(new i; i<GetMaxPlayers(); i++)
if(IsPlayerConnected( i ))
PlayAudioStreamForPlayer(i, url, x, y, z, distance);
return 1;

}

Put it like this

stock PlayAudioStreamForAll(url[])
{
new Float:X,Float:Y,Float:Z;
for(new i; i<GetMaxPlayers(); i++)
if(IsPlayerConnected( i ))
PlayAudioStreamForPlayer(i, url, X, Y, Z, distance);
return 1;

} Smilies


And the command

CMD:music(playerid, params[])
{
new str[32];
if(isnull(params))
{
format(str, sizeof (str), "Usage: \"/music [url]\"";
SendClientMessage(playerid, 0xFF0000AA, str);
}
else PlayAudioStreamForAll(params);
return 1;
}

TheMightyEddy
01/04/2012, 04:10 PM
This won't work..

stock PlayAudioStreamForAll(url[])
{
for(new i; i<GetMaxPlayers(); i++)
if(IsPlayerConnected( i ))
PlayAudioStreamForPlayer(i, url, x, y, z, distance);
return 1;

}

Put it like this

stock PlayAudioStreamForAll(url[])
{
new Float:X,Float:Y,Float:Z;
for(new i; i<GetMaxPlayers(); i++)
if(IsPlayerConnected( i ))
PlayAudioStreamForPlayer(i, url, X, Y, Z, distance);
return 1;

} Smilies


And the command

CMD:music(playerid, params[])
{
new str[32];
if(isnull(params))
{
format(str, sizeof (str), "Usage: \"/music [url]\"";
SendClientMessage(playerid, 0xFF0000AA, str);
}
else PlayAudioStreamForAll(params);
return 1;
}

Okay I'm so confused. Can you please give me the whole code combined with your code too? Thanks,

Jonny5
01/04/2012, 05:04 PM
heres the full code with edits,


stock PlayAudioStreamForAll(url[])
{
for(new i; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected( i )) PlayAudioStreamForPlayer(i, url);
}
return 1;

}
stock StopAudioStreamForAll(url[])
{
for(new i; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected( i )) StopAudioStreamForPlayer(playerid);
}
return 1;
}
CMD:stopmusic(playerid, params[])
{
#pragma unused params
if(!IsPlayerAdmin(playerid))return 0;
StopAudioStreamForPlayer(playerid);
return 1;
}

CMD:music(playerid, params[])
{
if(!IsPlayerAdmin(playerid))return 0;
new
str[32];
if (isnull(params))
{
format(str, sizeof (str), "Usage: \"/music [url]\"";
SendClientMessage(playerid, 0xFF0000AA, str);
}
else
{
PlayAudioStreamForAll(params);
}
return 1;
}



this should be fulling working now

regards,

TheMightyEddy
01/04/2012, 06:06 PM
Thank you so much Jonny! +rep again!

Jonny5
01/04/2012, 06:10 PM
ah you can only rep once but thanks, I dont help for rep anyways
I do it to learn, as me figuring out something for you that I dont know
also will teach me how to achieve the same thing in my GM

dont forget to rep ivanVU though
as they brought to the attention of needed/(i removed them but still) X,Y,Zvars

goodluck with ya GM Eddy

TheMightyEddy
01/04/2012, 06:59 PM
why thank you so nuch Jonny. i will rep him.