Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // h_format include by Hauke Marquardt alias |-|auke - 01.10.2012
- /*
- License:
- This code is free: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- This code is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- You´re not allowed to copy any code from this, into your code without
- naming authors name in credits!
- - SendClientMessagef(playerid, color, format, { Float , _ } : ... );
- - SendClientMessageToAllf(color, format, { Float , _ } : ... );
- - SetGameModeTextf(format, { Float , _ } : ... );
- - UpdatePlayer3DTextLabelTextf(playerid, 3dTextLabel, color, format, { Float , _ } : ... );
- - Update3DTextLabelTextf(3dTextLabel, color, format, { Float , _ } : ... );
- - TextDrawSetStringf(textdraw, format, { Float , _ } : ... );
- - SetPVarStringf(playerid,"varname", format, { Float , _ } : ... );
- */
- stock SendClientMessagef ( playerid , color , output[ 256 ] , { Float , _ } : ... ) {
- new c = numargs ( ) , idx;
- for ( new i = 3; i < c; i ++ ) {
- new Arg[ 32 ] , p , bool:iI , bool:iF;
- for ( new x; x < strlen ( output ); x ++ ) {
- if ( output[ x ] == '%' ) {
- if ( output[ x + 1 ] == 'd' || output[ x + 1 ] == 'i' )
- iI = true;
- if ( output[ x + 1 ] == 'f' )
- iF = true;
- strdel ( output , x , x + 2 );
- p = x;
- break;
- }
- }
- while ( getarg ( i , idx ) ) {
- Arg[ idx ] = getarg ( i , idx );
- idx ++;
- }
- if ( iI == true )
- format ( Arg , 32 , "%d" , Arg );
- if ( iF == true )
- format ( Arg , 32 , "%f" , Arg );
- idx = 0;
- strins ( output , Arg , p );
- }
- SendClientMessage ( playerid , color , output );
- }
- stock SendClientMessageToAllf ( color , output[ 256 ] , { Float , _ } : ... ) {
- new c = numargs ( ) , idx;
- for ( new i = 2; i < c; i ++ ) {
- new Arg[ 32 ] , p , bool:iI , bool:iF;
- for ( new x; x < strlen ( output ); x ++ ) {
- if ( output[ x ] == '%' ) {
- if ( output[ x + 1 ] == 'd' || output[ x + 1 ] == 'i' )
- iI = true;
- if ( output[ x + 1 ] == 'f' )
- iF = true;
- strdel ( output , x , x + 2 );
- p = x;
- break;
- }
- }
- while ( getarg ( i , idx ) ) {
- Arg[ idx ] = getarg ( i , idx );
- idx ++;
- }
- if ( iI == true )
- format ( Arg , 32 , "%d" , Arg );
- if ( iF == true )
- format ( Arg , 32 , "%f" , Arg );
- idx = 0;
- strins ( output , Arg , p );
- }
- SendClientMessageToAll ( color , output );
- }
- stock SetGameModeTextf ( output[ 256 ] , { Float , _ } : ... ) {
- new c = numargs ( ) , idx;
- for ( new i = 1; i < c; i ++ ) {
- new Arg[ 32 ] , p , bool:iI , bool:iF;
- for ( new x; x < strlen ( output ); x ++ ) {
- if ( output[ x ] == '%' ) {
- if ( output[ x + 1 ] == 'd' || output[ x + 1 ] == 'i' )
- iI = true;
- if ( output[ x + 1 ] == 'f' )
- iF = true;
- strdel ( output , x , x + 2 );
- p = x;
- break;
- }
- }
- while ( getarg ( i , idx ) ) {
- Arg[ idx ] = getarg ( i , idx );
- idx ++;
- }
- if ( iI == true )
- format ( Arg , 32 , "%d" , Arg );
- if ( iF == true )
- format ( Arg , 32 , "%f" , Arg );
- idx = 0;
- strins ( output , Arg , p );
- }
- SetGameModeText ( output );
- }
- stock UpdatePlayer3DTextLabelTextf ( playerid , PlayerText3D:id , color , output[ 256 ] , { Float , _ } : ... ) {
- new c = numargs ( ) , idx;
- for ( new i = 4; i < c; i ++ ) {
- new Arg[ 32 ] , p , bool:iI , bool:iF;
- for ( new x; x < strlen ( output ); x ++ ) {
- if ( output[ x ] == '%' ) {
- if ( output[ x + 1 ] == 'd' || output[ x + 1 ] == 'i' )
- iI = true;
- if ( output[ x + 1 ] == 'f' )
- iF = true;
- strdel ( output , x , x + 2 );
- p = x;
- break;
- }
- }
- while ( getarg ( i , idx ) ) {
- Arg[ idx ] = getarg ( i , idx );
- idx ++;
- }
- if ( iI == true )
- format ( Arg , 32 , "%d" , Arg );
- if ( iF == true )
- format ( Arg , 32 , "%f" , Arg );
- idx = 0;
- strins ( output , Arg , p );
- }
- UpdatePlayer3DTextLabelText ( playerid , id , color , output );
- }
- stock Update3DTextLabelTextf ( PlayerText3D:id , color , output[ 256 ] , { Float , _ } : ... ) {
- new c = numargs ( ) , idx;
- for ( new i = 3; i < c; i ++ ) {
- new Arg[ 32 ] , p , bool:iI , bool:iF;
- for ( new x; x < strlen ( output ); x ++ ) {
- if ( output[ x ] == '%' ) {
- if ( output[ x + 1 ] == 'd' || output[ x + 1 ] == 'i' )
- iI = true;
- if ( output[ x + 1 ] == 'f' )
- iF = true;
- strdel ( output , x , x + 2 );
- p = x;
- break;
- }
- }
- while ( getarg ( i , idx ) ) {
- Arg[ idx ] = getarg ( i , idx );
- idx ++;
- }
- if ( iI == true )
- format ( Arg , 32 , "%d" , Arg );
- if ( iF == true )
- format ( Arg , 32 , "%f" , Arg );
- idx = 0;
- strins ( output , Arg , p );
- }
- Update3DTextLabelText ( id , color , output );
- }
- stock TextDrawSetStringf ( Text:text , output[ 256 ] , { Float , _ } : ... ) {
- new c = numargs ( ) , idx;
- for ( new i = 2; i < c; i ++ ) {
- new Arg[ 32 ] , p , bool:iI , bool:iF;
- for ( new x; x < strlen ( output ); x ++ ) {
- if ( output[ x ] == '%' ) {
- if ( output[ x + 1 ] == 'd' || output[ x + 1 ] == 'i' )
- iI = true;
- if ( output[ x + 1 ] == 'f' )
- iF = true;
- strdel ( output , x , x + 2 );
- p = x;
- break;
- }
- }
- while ( getarg ( i , idx ) ) {
- Arg[ idx ] = getarg ( i , idx );
- idx ++;
- }
- if ( iI == true )
- format ( Arg , 32 , "%d" , Arg );
- if ( iF == true )
- format ( Arg , 32 , "%f" , Arg );
- idx = 0;
- strins ( output , Arg , p );
- }
- TextDrawSetString ( text , output );
- }
- stock SetPVarStringf ( playerid , varname[ ] , output[ 256 ] , { Float , _ } : ... ) {
- new c = numargs ( ) , idx;
- for ( new i = 3; i < c; i ++ ) {
- new Arg[ 32 ] , p , bool:iI , bool:iF;
- for ( new x; x < strlen ( output ); x ++ ) {
- if ( output[ x ] == '%' ) {
- if ( output[ x + 1 ] == 'd' || output[ x + 1 ] == 'i' )
- iI = true;
- if ( output[ x + 1 ] == 'f' )
- iF = true;
- strdel ( output , x , x + 2 );
- p = x;
- break;
- }
- }
- while ( getarg ( i , idx ) ) {
- Arg[ idx ] = getarg ( i , idx );
- idx ++;
- }
- if ( iI == true )
- format ( Arg , 32 , "%d" , Arg );
- if ( iF == true )
- format ( Arg , 32 , "%f" , Arg );
- idx = 0;
- strins ( output , Arg , p );
- }
- SetPVarString ( playerid , varname , output );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement