AmirSafavi
Новичок
Well, here I have a system to detect the player's device connected to the server, but there is a problem
For example, if a player with the name Amir_Safavi connects to the server and is a PC player, his name will be changed to Amir_Safavi[PC]
Well, now the same person can connect to the server with another device named Amir_Safavi, actually two devices with one account
So now I need an If in OnPlayerConnect to prevent a player with this name from re-entering the server and kick him.
But I don't know what if to write for it
Can anyone advise?
If yes, please write it to me so that I can copy and paste it in the game mode
For example, if a player with the name Amir_Safavi connects to the server and is a PC player, his name will be changed to Amir_Safavi[PC]
Well, now the same person can connect to the server with another device named Amir_Safavi, actually two devices with one account
So now I need an If in OnPlayerConnect to prevent a player with this name from re-entering the server and kick him.
PHP:
public OnPlayerConnect(playerid)
{
for(new i = 0; i < AC_MAX_CODES; i++)
pAntiCheatLastCodeTriggerTime[playerid][i] = -1;
pAntiCheatSettingsPage{playerid} = 0;
pAntiCheatSettingsEditCodeId[playerid] = -1;
p_info[playerid][pMember] = 0;
p_t_info[playerid][pSelectBusinessID] = -1;
report_cooldown[playerid] = 0;
p_t_info[playerid][plveh] = -1;
p_info[playerid][pSkin] = -1;
ClearPlayerOffer(playerid);
player_news_live[playerid] = false;
for(new i; i < MAX_PLAYER_VEHICLES; i++) CarInfo[playerid][cModel][i] = 0;
gun_skill_up{playerid} = 0;
admin_level[playerid] = 0;
beg_quest_info[playerid][b_quest_id] = 0;
beg_quest_info[playerid][b_quest_status] = 0;
beg_quest_info[playerid][b_quest_progress] = 0;
p_info[playerid][family] = 0;
p_info[playerid][family_rang] = 0;
p_info[playerid][family_mute] = 0;
if(p_info[playerid][family_text] != Text3D:INVALID_3DTEXT_ID)
{
DestroyDynamic3DTextLabel(p_info[playerid][family_text]);
p_info[playerid][family_text] = Text3D:INVALID_3DTEXT_ID;
}
p_info[playerid][family_text] = Text3D:INVALID_3DTEXT_ID;
StartFarm[playerid] = 0;
player_search_player[playerid] = -1;
delivery_state_id[playerid] = 0;
p_info[playerid][pJob] = 0;
if(bonus_exp) SendClientMessage(playerid, col_white, !""c_serv"The X2 EXP promotion on PayDay is enabled on the server.");
if(bonus_donate) SendClientMessage(playerid, col_white, !""c_serv"Promotion X2 replenishment is enabled on the server.");
player_bag[playerid] = false;
player_gag[playerid] = false;
player_tie[playerid] = false;
new hour, minute, second;
gettime(hour, minute, second);
GetPlayerIp(playerid, GetPlayerIpEx(playerid), 16);
SetPlayerTime(playerid, hour, minute);
player_ship_worked[playerid] = false;
player_taxi_passanger[playerid] = INVALID_PLAYER_ID;
follow_id[playerid] = INVALID_PLAYER_ID;
gSpectateID[playerid] = INVALID_PLAYER_ID;
p_t_info[playerid][uborka_text] = Text3D:INVALID_3DTEXT_ID;
p_t_info[playerid][uborka_timer] = 0;
player_call_police[playerid] = player_call_hospital[playerid] = player_call_mechanic[playerid] = false;
player_call_taxi[playerid] = 0;
SetPlayerWeather(playerid, weather_id);
player_rob_progress[playerid] = 0;
rob_offer[playerid] = INVALID_PLAYER_ID;
player_rob_id[playerid] = -1;
p_t_info[playerid][bus_text] = Text3D:INVALID_3DTEXT_ID;
player_quest_info[playerid][quest_pickup_id] = 0;
graffiti_player_id[playerid] = -1;
duel_offer[playerid] = INVALID_PLAYER_ID;
player_reg_pb[playerid] = -1;
player_hotel_id[playerid] = -1;
player_race_reg{playerid} = 0;
player_race_vehicle[playerid] = INVALID_VEHICLE_ID;
player_race_mark[playerid] = -1;
for(new i; i< MAX_ZONES; i++) GangZoneShowForPlayer(playerid,GZInfo[i][gID], GetGangZoneColor(i));
for(new i; i< 18; i++) GangZoneShowForPlayer(playerid,vip_zone[i], 0xFF0000DF);
for(new i; i< 3; i++) GangZoneShowForPlayer(playerid,public_zone[i], 0xCDB78775);
player_road_school[playerid] = 0;
player_road_id[playerid] = -1;
player_fuel_steal[playerid] = 0;
steal_timer[playerid] = -1;
GetPlayerName(playerid, Name(playerid), MAX_PLAYER_NAME);
new name[24];
if(strfind(p_info[playerid][pName],"_",true,1) == -1)
{
SendClientMessage(playerid, COLOR_RED, "You were kicked by the server, Reason: NonRP nickname. Please come up with an RP nickname.");
SendClientMessage(playerid, COLOR_RED, "An example of a RP nickname: Amir_Safavi");
NewKick(playerid);
return 1;
}
GetPlayerName(playerid,name,24);
for(new i=0;i<strlen(name);i++)
{
if( !((name[i]>='a'&&name[i]<='z') || (name[i]>='A'&&name[i]<='Z') || name[i]=='_'))
{
SendClientMessage(playerid, COLOR_RED,"Invalid characters were found in your nickname.");
SendClientMessage(playerid, COLOR_RED, "An example of a RP nickname: Amir_safavi");
NewKick(playerid);
return true;
}
}
gpci(playerid, p_info[playerid][pGPCI], 40);
player_mobile[playerid] = false;
if(strfind(p_info[playerid][pGPCI], "ED40ED0E8089CC44C08EE9580F4C8C44EE8EE990") != -1) player_mobile[playerid] = true;
ClearConnect(playerid);
ClearConnectMySQL(playerid);
LoadPlayerTextDraw(playerid);
RemoveBilding(playerid);
SetPlayerScore(playerid, 1), SetPlayerToTeamColor(playerid);
return 1;
}
PHP:
stock UpdatePlayerName(playerid) // User Names
{
new new_nick[MAX_PLAYER_NAME + 12];
new mobile_text[6];
format(mobile_text, 6, IsPlayerMobile(playerid) ? ("") : ("[PC]"));
new status_text[6];
format(status_text, 6, admin_level[playerid] ? ("[A]") : p_info[playerid][pLeader] ? ("[L]") : p_info[playerid][pVip] ? ("[V]") : (""));
format(status_text, 6, p_info[playerid][pVip] ? ("[V]") : (""));
strins(new_nick, Name(playerid), strlen(new_nick));
strins(new_nick, mobile_text, strlen(new_nick));
strins(new_nick, status_text, strlen(new_nick));
printf("%s %d", new_nick, SetPlayerName(playerid, new_nick));
}
Can anyone advise?
If yes, please write it to me so that I can copy and paste it in the game mode
