forked from citizenfx/fivem
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathServerCommand.h
More file actions
48 lines (43 loc) · 1.11 KB
/
ServerCommand.h
File metadata and controls
48 lines (43 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once
#include "SerializableComponent.h"
#include "SerializableProperty.h"
#include "SerializableStorageType.h"
namespace net::packet
{
class ClientServerCommand : public SerializableComponent
{
public:
// the command string
SerializableProperty<std::string_view, storage_type::ConstrainedBytesArray<1, 4096>> command;
// the command string hash, unused can be removed in a future net version
SerializableProperty<uint32_t> commandHash;
template<typename T>
bool Process(T& stream)
{
return ProcessPropertiesInOrder<T>(
stream,
command,
commandHash
);
}
};
/// <summary>
/// msgServerCommand is a packet that is sent to the server to execute a command.
/// This packet is sent from the client to the server.
/// </summary>
class ClientServerCommandPacket : public SerializableComponent
{
public:
SerializableProperty<uint32_t> type{ net::force_consteval<uint32_t, HashRageString("msgServerCommand")> };
ClientServerCommand data;
template<typename T>
bool Process(T& stream)
{
return ProcessPropertiesInOrder<T>(
stream,
type,
data
);
}
};
}