-
Notifications
You must be signed in to change notification settings - Fork 2
/
mobile-checker.inc
170 lines (121 loc) · 4.31 KB
/
mobile-checker.inc
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
// -*- coding: utf-8 -*-
/*
Legal:
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 the "License"; you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is the SA-MP Mobile Checker Include.
The Initial Developer of the Original Code is Adib "adib_yg".
Portions created by the Initial Developer are Copyright (c) 2023
the Initial Developer. All Rights Reserved.
Contributor(s):
-
Special Thanks to:
-
-----------------------------------------------------------------------------
Author:
Adib
Contact:
Telegram:
@adib_yg
Discord:
@adib_yg
Created:
2 October 2023
Updated:
2 October 2023
Version:
1.0
Github Repository:
https://github.com/adib-yg/SAMP-Mobile-Checker
-----------------------------------------------------------------------------
Description:
This includes detects players who are connected to the server with these SA-MP Mobile clients:
https://play.google.com/store/apps/details?id=ru.unisamp_mobile.launcher
https://play.google.com/store/apps/details?id=ro.alynsampmobile.launcher&hl=en&gl=US&pli=1
-----------------------------------------------------------------------------
Functions:
native bool: IsPlayerUsingSampMobile(playerid);
Callbacks:
native OnPlayerConnectViaSampMobile(playerid);
-----------------------------------------------------------------------------
Use:
#include <samp_mobile_checker>
public OnPlayerSpawn(playerid)
{
if(IsPlayerUsingSampMobile(playerid))
{
SendClientMessage(playerid, -1, "You are using SA-MP Mobile client!");
}
}
public OnPlayerConnectViaSampMobile(playerid)
{
SendClientMessage(playerid, -1, "You are using SA-MP Mobile client!");
}
-----------------------------------------------------------------------------
*/
// -----------------------------------------------------------------------------
#if defined _samp_mobile_checker_included
#endinput
#endif
#define _samp_mobile_checker_included
#define _samp_mobile_checker_version 10 // 1.0
#if !defined _INC_open_mp
#if !defined gpci
native gpci(playerid, serial[], len);
#endif
#endif
// -----------------------------------------------------------------------------
#define SAMP_MOBILE_CI_SERIAL "ED40ED0E8089CC44C08EE9580F4C8C44EE8EE990"
#define IsPlayerUsingSampMobile(%0) s_SampMobilePlayer[%0]
// -----------------------------------------------------------------------------
forward OnPlayerConnectViaSampMobile(playerid);
// -----------------------------------------------------------------------------
new
bool: s_SampMobilePlayer[MAX_PLAYERS];
// -----------------------------------------------------------------------------
/*stock bool: IsPlayerUsingSampMobile(playerid) {
return (s_SampMobilePlayer[playerid]);
}*/
// -----------------------------------------------------------------------------
//Hook: OnPlayerConnect
public OnPlayerConnect(playerid) {
new
ciSerial[41];
#if !defined _INC_open_mp
gpci(playerid, ciSerial, sizeof(ciSerial));
#else
GPCI(playerid, ciSerial, sizeof(ciSerial));
#endif
if(!strcmp(SAMP_MOBILE_CI_SERIAL, ciSerial, true))
{
s_SampMobilePlayer[playerid] = true; // Android SA-MP Mobile
CallLocalFunction("OnPlayerConnectViaSampMobile", "i", playerid);
}
else
{
s_SampMobilePlayer[playerid] = false; // PC or other clients
}
#if defined _SMC_OnPlayerConnect
return _SMC_OnPlayerConnect(playerid);
#else
return 1;
#endif
}
#if defined _ALS_OnPlayerConnect
#undef OnPlayerConnect
#else
#define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect _SMC_OnPlayerConnect
#if defined _SMC_OnPlayerConnect
forward _SMC_OnPlayerConnect(playerid);
#endif
// -----------------------------------------------------------------------------
#undef SAMP_MOBILE_CI_SERIAL