Help with making a new msg type -
[NRP]Blade - 25.03.2011
Well i have used many times
Код:
format(string, sizeof(string), "Stuff");
ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
And to me when using alot it just gets tiring. So i was wonder if the is anyway to do something like:
Код:
formatp(stringname, sizeof(stringname), "blah blah", distance, playerid, stringname, color);
Some of you may not like the idea, thats fine. Just wondering how to do this, mostly for quickness and well improving my skills. I tried but well....Failed Epicly.
Thanks in advance.
Re: Help with making a new msg type -
AK47317 - 25.03.2011
pawn Код:
new
string[ MAX_STRING ] ;
format( string, sizeof( string ), "Stuff" ) ;
SendClientMessage( playerid, COLOR, string ) ;
this one?
Re: Help with making a new msg type -
[NRP]Blade - 25.03.2011
Erm not quite, i meant like in one string
Re: Help with making a new msg type -
AK47317 - 25.03.2011
then
pawn Код:
SendClientMessage( playerid, COLOR, string... ) ;
xD
Re: Help with making a new msg type -
Mike Garber - 25.03.2011
Something like this? I just made it, i figured it could be useful for myself aswell.
I edited it to add a very important detail xD
pawn Код:
// USAGE/EXAMPLE: SendMessageToArea(playerid,30,COLOR_RED,"This message is RED and will be sent to all players within 30 meters.");
stock SendMessageToArea(playerid,distance,COLOR,const str[])
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
foreach(Player,i)
{
if(IsPlayerInRangeOfPoint(i,distance,X,Y,Z))
{
SendClientMessage(i,COLOR,str);
}
}
return 1;
}
Re: Help with making a new msg type -
Retardedwolf - 25.03.2011
@Mike, what is IsPlayerInCircle ( at least show the code so people who use the code can compile it without errors ) why not just simply use IsPlayerInRangeOfPoint?
Re: Help with making a new msg type -
Mike Garber - 25.03.2011
Edited my first post
Edited.
IsPlayerInRangeOfPoint is probably very similar, you can edit it to use that, it should be very simple..
I didn't know about that function, one i missed i guess.
Re: Help with making a new msg type -
THE_KNOWN - 25.03.2011
Код:
stock SndMsgToPlayersNearby(msg[],color,radius)
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(GetDistanceBetweenPlayers(playerid,i)<radius)
{
SendClientMessage(i,color,msg);
}
}
return 1;
}
stock GetDistanceBetweenPlayers(playerid,playerid2)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
new Float:tmpdis;
GetPlayerPos(playerid,x1,y1,z1);
GetPlayerPos(playerid2,x2,y2,z2);
tmpdis = floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
return floatround(tmpdis);
}
havent tested the first stock
Re: Help with making a new msg type -
Mike Garber - 25.03.2011
@THE_KNOWN I've already posted a function, which i edited for the better. There's no point to post a slower function.
Re: Help with making a new msg type -
[NRP]Blade - 25.03.2011
Quote:
Originally Posted by Mike Garber
Something like this? I just made it, i figured it could be useful for myself aswell.
I edited it to add a very important detail xD
pawn Код:
// USAGE/EXAMPLE: SendMessageToArea(playerid,30,COLOR_RED,"This message is RED and will be sent to all players within 30 meters.");
stock SendMessageToArea(playerid,distance,COLOR,const str[]) { new Float:X,Float:Y,Float:Z; GetPlayerPos(playerid,X,Y,Z); foreach(Player,i) { if(IsPlayerInRangeOfPoint(i,distance,X,Y,Z)) { SendClientMessage(i,COLOR,str); } } return 1; }
|
Thanks