Skip to content

Commit cc62484

Browse files
author
Y_Less
committed
HasGameText and GetGameText natives.
1 parent a7e851e commit cc62484

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

Server/Components/Pawn/Scripting/Player/Natives.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,26 @@ SCRIPT_API(HideGameTextForPlayer, bool(IPlayer& player, int style))
10111011
return true;
10121012
}
10131013

1014+
SCRIPT_API(HasGameText, bool(IPlayer& player, int style))
1015+
{
1016+
return player.hasGameText(style);
1017+
}
1018+
1019+
SCRIPT_API(GetGameText, bool(IPlayer& player, int style, OutputOnlyString& message, int time, int remaining))
1020+
{
1021+
Milliseconds mt;
1022+
Milliseconds mr;
1023+
String ms;
1024+
if (player.getGameText(style, ms, mt, mr))
1025+
{
1026+
message = ms;
1027+
time = (int)mt.count();
1028+
remaining = (int)mr.count();
1029+
return true;
1030+
}
1031+
return false;
1032+
}
1033+
10141034
SCRIPT_API(GameTextForPlayerf, bool(IPlayer& player, int time, int style, cell const* format))
10151035
{
10161036
auto string = svprintf(format, GetAMX(), GetParams(), 4);

Server/Source/player_impl.hpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,25 @@ struct Player final : public IPlayer, public PoolIDProvider, public NoCopy
15021502
}
15031503
}
15041504

1505+
bool hasGameText(int style) override
1506+
{
1507+
if (IPlayerFixesData* data = queryExtension<IPlayerFixesData>(*this))
1508+
{
1509+
return data->hasGameText(style);
1510+
}
1511+
return false;
1512+
}
1513+
1514+
bool getGameText(int style, Impl::String& message, Milliseconds& time, Milliseconds& remaining) override
1515+
{
1516+
if (IPlayerFixesData* data = queryExtension<IPlayerFixesData>(*this))
1517+
{
1518+
data->getGameText(style, message, time, remaining);
1519+
return true;
1520+
}
1521+
return false;
1522+
}
1523+
15051524
int getVirtualWorld() const override
15061525
{
15071526
return virtualWorld_;

0 commit comments

Comments
 (0)