10.08.2009, 18:51
(
Последний раз редактировалось [NoV]LaZ; 24.04.2011 в 11:30.
)
Hi all !
I'm making a text draw, who helps admins detecting cheaters.
The problem is that the TextDraw values are not updating, or the whole TextDraw is updating, making the values unreadable.
I'm trying to update the values, not the TextDraw, but I failed at doing this, so I ask you for help.
This is what i've done. Can you help me out ?
________
Zoloft settlements
I'm making a text draw, who helps admins detecting cheaters.
The problem is that the TextDraw values are not updating, or the whole TextDraw is updating, making the values unreadable.
I'm trying to update the values, not the TextDraw, but I failed at doing this, so I ask you for help.
This is what i've done. Can you help me out ?
pawn Код:
#include <a_samp>
#define FILTERSCRIPT
forward PlayerInfo( playerid );
new Text:Info[ MAX_PLAYERS ];
public OnFilterScriptInit()
{
SetTimer( "PlayerInfo", 1000, 1 );
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerCommandText( playerid, cmdtext[] )
{
new
PInfo,
idx,
cmd[ 128 ];
cmd = strtok( cmdtext, idx );
if(strcmp(cmd, "/info", true) == 0 )
{
new
tmp[ 128 ],
id;
tmp = strtok( cmdtext, idx );
id = strval( tmp );
if ( !strlen( tmp ) )
{
SendClientMessage( playerid, 0x000000, "-Info- USAGE: /info <id>" ); return true;
}
PInfo = strval( tmp );
if ( !IsPlayerConnected( PInfo ) )
{
SendClientMessage( playerid, 0x000000, "-Info- That player is not online." ); return true;
}
PlayerInfo( id );
return true;
}
return false;
}
stock Weapons( playerid )
{
new
count,
weapons,
ammo,
wepname[ 32 ],
string[ 128 ];
for ( new i = 0; i < 13; i++ )
{
GetPlayerWeaponData( playerid, i, weapons, ammo );
if ( weapons != 0 )
{
count++;
if ( weapons <= 15 || weapons == 46)
{
ammo = 1;
}
GetWeaponName( weapons, wepname, sizeof wepname );
if ( count == 1 )
{
format( string, sizeof string,"%s(%d)",wepname,ammo );
}
else
{
format( string, sizeof string, "%s, %s(%d)", string, wepname, ammo );
}
}
}
if ( !count )
{
string = "None";
}
return string;
}
stock GetName( playerid )
{
new name[ MAX_PLAYERS ];
GetPlayerName( playerid, name, sizeof name );
return name;
}
stock GetIp( playerid )
{
new Ip[ 20 ];
GetPlayerIp(playerid, Ip, sizeof Ip );
return Ip;
}
strtok( const string[], &index, seperator = ' ' )
{
new
length = strlen( string ),
offset = index,
result[128];
while ( ( index < length ) && ( string[ index ] != seperator ) && ( ( index - offset ) < ( sizeof( result ) - 1 ) ) )
{
result[ index - offset ] = string[ index ];
index++;
}
result[ index - offset ] = EOS;
if ( ( index < length ) && ( string[ index ] == seperator ) )
{
index++;
}
return result;
}
forward PlayerInfo( playerid );
public PlayerInfo( playerid )
{
if ( IsPlayerConnected( playerid ) )
{
for ( new i = 0; i <= MAX_PLAYERS; i++ )
{
new
string[ 256 ],
Float:PHealth,
Float:PArmour,
//Float:VHealth,
Money = GetPlayerMoney( i ),
Ping = GetPlayerPing( i );
//PVehicle = GetPlayerVehicleID( i );
GetPlayerHealth( i, PHealth );
GetPlayerArmour( i, PArmour );
//GetVehicleHealth( PVehicle, VHealth );
format( string, sizeof string, "%s (ID: %d) [ %s ]: ~n~Health/Armour: %.f/%.f | Ping: %d | Money: $%d ~n~Weapons: %s", GetName( i ), i, GetIp( i ), PHealth, PArmour, Ping, Money, Weapons( i ) );
Info[ i ] = TextDrawCreate( 150, 300, string );
TextDrawLetterSize( Info[ i ], 0.5, 1 );
TextDrawShowForPlayer( i, Info[ i ] );
}
}
}
Zoloft settlements