Quote:
Originally Posted by RedFusion
pawn Code:
stock GetPlayerPacketloss(playerid,&Float:packetloss) { /* Returns the packetloss percentage of the given playerid - Made by Fusez */
if(!IsPlayerConnected(playerid)) return 0;
new nstats[400+1], nstats_loss[20], start, end; GetPlayerNetworkStats(playerid, nstats, sizeof(nstats));
start = strfind(nstats,"packetloss",true); end = strfind(nstats,"%",true,start);
strmid(nstats_loss, nstats, start+12, end, sizeof(nstats_loss)); packetloss = floatstr(nstats_loss); return 1; }
|
Nice function!!!
____
And guys, use the Regex plugin. No need for some complex code when you can just make an expression:
pawn Code:
stock textContainsIP(const string[])
{
static
RegEx:rCIP
;
if ( !rCIP )
{
rCIP = regex_build("(.*?)([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})(.*?)");
}
return regex_match_exid(string, rCIP);
}