01.10.2012, 21:10
(
Последний раз редактировалось [LoD]Hauke; 01.10.2012 в 21:17.
Причина: new headline
)
H_Format
H_Format is a simple include that makes your coding simpler and faster.H_Format changes this functions
- SendClientMessage(playerid, color, text[])
- SendClientMessageToAll(color, text[])
- SetGameModeText(text[])
- UpdatePlayer3DTextLabelText(playerid, 3dTextLabel, color, text[])
- Update3DTextLabelText(3dTextLabel, color, text[])
- TextDrawSetString(textdraw, text[])
- SetPVarString(playerid,"varname",text[])
So the formate options are pre-implemented and you dont need to use format(...).
You know it from functions like printf(...)
Functions:
- SendClientMessagef
pawn Код:SendClientMessagef(playerid, color, format, { Float , _ } : ... ); - SendClientMessageToAllf
pawn Код:SendClientMessageToAllf(color, format, { Float , _ } : ... ); - SetGameModeTextf
pawn Код:SetGameModeTextf(format, { Float , _ } : ... ); - UpdatePlayer3DTextLabelTextf
pawn Код:UpdatePlayer3DTextLabelTextf(playerid, 3dTextLabel, color, format, { Float , _ } : ... ); - Update3DTextLabelTextf
pawn Код:Update3DTextLabelTextf(3dTextLabel, color, format, { Float , _ } : ... ); - TextDrawSetStringf
pawn Код:TextDrawSetStringf(textdraw, format, { Float , _ } : ... ); - SetPVarStringf
pawn Код:SetPVarStringf(playerid,"varname", format, { Float , _ } : ... );
Welcome message
pawn Код:
public OnPlayerSpawn(playerid)
{
new Playername[ MAX_PLAYER_NAME ];
GetPlayerName(playerid, Playername, MAX_PLAYER_NAME);
SendClientMessagef(playerid,0xFFFFFFFF,"Hello %s!.", Playername);
}
pawn Код:
#define VERSION "v.1.0.1.2"
public OnGameModeInit(){
SetGameModeTextf("XYZ-Reallife %s",VERSION);
}
pawn Код:
public OnPlayerSpawn(playerid)
{
new Playername[ MAX_PLAYER_NAME ];
GetPlayerName(playerid, Playername, MAX_PLAYER_NAME);
SendClientMessageToAllf(0xFFFFFFFF,"%s logged in.", Playername);
}
This placeholders are implemented in the h_format include:
- %s = String
- %d = Integer
- %i = Integer
- %f = Float
- Move h_format.inc in your include folder
- Write #include <h_format.inc> on top of your script under #include <a_samp>
- Now youґre ready!