Raised This Month: $ Target: $400
 0% 

Allied Attack Reflection please fix the script


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
chchchch
New Member
Join Date: Apr 2023
Old 04-22-2023 , 22:23   Allied Attack Reflection please fix the script
Reply With Quote #1

I'm trying to add a script to the Dedicated server, but I want to add disallowance using my Steam ID, but it's difficult

------------------------------------------------------------------------
function OnGameEvent_player_say(params){
local _player = GetPlayerFromUserID(params.userid);
local _pName = _player.GetPlayerName();
local _chat = params.text.tolower();

local fileContents = FileToString("admin system/admins.txt");
local admins = split(fileContents, "\r\n");
local steamid = player.GetNetworkIDString();

switch(_chat){
case "!ff" :
if(GetPlayerFromUserID(params.userid).IsSurvi vor()){
local len = ::friendlyFireVars.playerList.len();
for(local i=0;i<len;i++){
if(::friendlyFireVars.playerList[i] == params.userid){
if(::friendlyFireVars.allowList[i] == 0){
::friendlyFireVars.allowList[i] = 1;
_player = null;
while (_player = Entities.FindByClassname(_player, "player")){
if(_player.IsValid() && !IsPlayerABot(_player)){
switch(Convars.GetClientConvarValue("cl_langu age", _player.GetEntityIndex())){
case "korean":case "koreana": ClientPrint( _player, 5, "FF Reflector: "+"\x01"+_pName+"님의 아군공격 반사가 해제되었습니다.");break;
case "japanese": ClientPrint( _player, 5, "FF Reflector: "+"\x01"+_pName+"の同士討ちの反射が解除されました。");brea k;
case "spanish": ClientPrint( _player, 5, "FF Reflector: "+"\x01"+"Desactiva el fuego amigo para "+_pName);break;
default: ClientPrint( _player, 5, "FF Reflector: "+"\x01"+"Turns off "+_pName+"'s FF reflection.");break;
}
}
}
return;
}else{
::friendlyFireVars.allowList[i] = 0;
_player = null;
while (_player = Entities.FindByClassname(_player, "player")){
if(_player.IsValid() && !IsPlayerABot(_player)){
switch(Convars.GetClientConvarValue("cl_langu age", _player.GetEntityIndex())){
case "korean":case "koreana": ClientPrint( _player, 5, "FF Reflector: "+"\x01"+_pName+"님의 아군공격 반사가 적용되었습니다.");break;
case "japanese": ClientPrint( _player, 5, "FF Reflector: "+"\x01"+_pName+"の同士討ちの反射が適用されました。");brea k;
case "spanish": ClientPrint( _player, 5, "FF Reflector: "+"\x01"+"Activa el fuego amigo para "+_pName);break;
default: ClientPrint( _player, 5, "FF Reflector: "+"\x01"+"Turns on "+_pName+"'s FF reflection.");break;
}
}
}
return;
}
}
}
}
break;
case "!ffon" :
if(admins != steamid){
_player = null;
while (_player = Entities.FindByClassname(_player, "player")){
if(_player.IsValid() && !IsPlayerABot(_player)){
switch(Convars.GetClientConvarValue("cl_langu age", _player.GetEntityIndex())){
case "korean":case "koreana": ClientPrint( _player, 5, "FF Reflector: "+"\x01"+"호스트만 아군공격 반사 설정을 변경할 수 있습니다.");break;
case "japanese": ClientPrint( _player, 5, "FF Reflector: "+"\x01"+"ホストのみ同士討ちの反射設定を変更することができます。");break ;
case "spanish": ClientPrint( _player, 5, "FF Reflector: "+"\x01"+"Solo los anfitriones pueden cambiar la configuración de reflejo de fuego amigo.");break;
default: ClientPrint( _player, 5, "FF Reflector: "+"\x01"+"Only hosts can change friendly fire reflection settings.");break;
}
}
}
}else{
::saveff("ffon");
_player = null;
while (_player = Entities.FindByClassname(_player, "player")){
if(_player.IsValid() && !IsPlayerABot(_player)){
switch(Convars.GetClientConvarValue("cl_langu age", _player.GetEntityIndex())){
case "korean":case "koreana": ClientPrint( _player, 5, "FF Reflector: "+"\x01"+"아군공격 반사 설정을 켭니다.");break;
case "japanese": ClientPrint( _player, 5, "FF Reflector: "+"\x01"+"同士討ちの反射設定をオンにします。");break;
case "spanish": ClientPrint( _player, 5, "FF Reflector: "+"\x01"+"Activa el fuego amigo reflectante.");break;
default: ClientPrint( _player, 5, "FF Reflector: "+"\x01"+"Turn on the friendly fire reflector.");break;
}
}
}
}
break;
case "!ffoff" :
if(_player != GetListenServerHost()){
_player = null;
while (_player = Entities.FindByClassname(_player, "player")){
if(_player.IsValid() && !IsPlayerABot(_player)){
switch(Convars.GetClientConvarValue("cl_langu age", _player.GetEntityIndex())){
case "korean":case "koreana": ClientPrint( _player, 5, "FF Reflector: "+"\x01"+"호스트만 아군공격 반사 설정을 변경할 수 있습니다.");break;
case "japanese": ClientPrint( _player, 5, "FF Reflector: "+"\x01"+"ホストのみ同士討ちの反射設定を変更することができます。");break ;
case "spanish": ClientPrint( _player, 5, "FF Reflector: "+"\x01"+"Solo los anfitriones pueden cambiar la configuración de reflejo de fuego amigo.");break;
default: ClientPrint( _player, 5, "FF Reflector: "+"\x01"+"Only hosts can change friendly fire reflection settings.");break;
}
}
}
}else{
::saveff("ffoff");
_player = null;
while (_player = Entities.FindByClassname(_player, "player")){
if(_player.IsValid() && !IsPlayerABot(_player)){
switch(Convars.GetClientConvarValue("cl_langu age", _player.GetEntityIndex())){
case "korean":case "koreana": ClientPrint( _player, 5, "FF Reflector: "+"\x01"+"아군공격 반사 설정을 끕니다.");break;
case "japanese": ClientPrint( _player, 5, "FF Reflector: "+"\x01"+"同士討ちの反射設定をオフにします。");break;
case "spanish": ClientPrint( _player, 5, "FF Reflector: "+"\x01"+"Desactiva el fuego amigo reflectante.");break;
default: ClientPrint( _player, 5, "FF Reflector: "+"\x01"+"Turn off the friendly fire reflector.");break;
}
}
}

//방장만
switch(Convars.GetClientConvarValue("cl_langu age", GetListenServerHost().GetEntityIndex())){
case "korean":case "koreana": ClientPrint( GetListenServerHost(), 5, "FF Reflector: "+"\x01"+"반사를 다시 켜고 싶으시다면, \x03!ffon\x01 를 입력하세요.");break;
case "japanese": ClientPrint( GetListenServerHost(), 5, "FF Reflector: "+"\x01"+"反射を再びオンにしたい場合は、\x03!ffon\x01と入力してくだ さい。");break;
case "spanish": ClientPrint( GetListenServerHost(), 5, "FF Reflector: "+"\x01"+"Si quieres encender el reflector, escribe \x03!ffon\x01 en el chat.");break;
default: ClientPrint( GetListenServerHost(), 5, "FF Reflector: "+"\x01"+"If you want to turn on the reflector, Type \x03!ffon\x01 in the chat.");break;
}

}
break;
}
---------------------------------------------------------------
Attached Files
File Type: txt 1friendlyfiref.txt (27.8 KB, 41 views)
chchchch is offline
Austin
Senior Member
Join Date: Oct 2005
Old 05-01-2023 , 20:11   Re: Allied Attack Reflection please fix the script
Reply With Quote #2

I am not totaly sure I understand your question but it seems to be about checking for a certain steam id.
Here is an example of how to do that.

PHP Code:
public bool OnClientConnect(int clientchar[] rejectmsgint maxlen)
{
    
strcopy(rejectmsg100"This server is limited to Austin - Only.");
    
char steamId[64];    

    
// Only let Austin in = STEAM_1:0:12345678
    
GetClientAuthId(clientAuthId_Steam2steamId128);

    if (
strcmp(steamId"STEAM_1:0:12345678")    == 0)                
        return 
true;   // Let Austin in
    
else
        return 
false;    //Kick evenyone else


Last edited by Austin; 05-01-2023 at 20:12.
Austin is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 05-02-2023 , 14:16   Re: Allied Attack Reflection please fix the script
Reply With Quote #3

Austin, checking the SteamID at this point may result in no one being able to connect to the server at all.
It's easier to put a password to enter the server.
Quote:
These callbacks are listed in no specific order, however, their documentation holds for both fake and real clients.
  • OnClientConnect - Called when a player initiates a connection. You can block a player from connecting by returning Plugin_Stop and setting rejectmsg to an error message.
  • OnClientConnected - Called after a player connects. Signifies that the player is connected and IsClientConnected will return true. This is paired with OnClientDisconnect for successful connections only.
  • OnClientAuthorized - Called when a player gets a Steam ID. It is important to note that this may never be called. It may occur any time in between OnClientConnected and OnClientPreAdminCheck/OnClientDisconnect.
https://wiki.alliedmods.net/Introduc...ient_Callbacks
__________________
Grey83 is offline
chchchch
New Member
Join Date: Apr 2023
Old 05-02-2023 , 20:30   Re: Allied Attack Reflection please fix the script
Reply With Quote #4

Quote:
Originally Posted by Austin View Post
I am not totaly sure I understand your question but it seems to be about checking for a certain steam id.
Here is an example of how to do that.

PHP Code:
public bool OnClientConnect(int clientchar[] rejectmsgint maxlen)
{
    
strcopy(rejectmsg100"This server is limited to Austin - Only.");
    
char steamId[64];    

    
// Only let Austin in = STEAM_1:0:12345678
    
GetClientAuthId(clientAuthId_Steam2steamId128);

    if (
strcmp(steamId"STEAM_1:0:12345678")    == 0)                
        return 
true;   // Let Austin in
    
else
        return 
false;    //Kick evenyone else

-------------------------------------------------------------------------------------------------------------------------------


I want the ffon and ffoff commands to be used only by me
Does this work in vscript?

We are running a dedicated server

Last edited by chchchch; 05-02-2023 at 20:31.
chchchch is offline
chchchch
New Member
Join Date: Apr 2023
Old 05-02-2023 , 20:33   Re: Allied Attack Reflection please fix the script
Reply With Quote #5

Quote:
Originally Posted by Austin View Post
I am not totaly sure I understand your question but it seems to be about checking for a certain steam id.
Here is an example of how to do that.

PHP Code:
public bool OnClientConnect(int clientchar[] rejectmsgint maxlen)
{
    
strcopy(rejectmsg100"This server is limited to Austin - Only.");
    
char steamId[64];    

    
// Only let Austin in = STEAM_1:0:12345678
    
GetClientAuthId(clientAuthId_Steam2steamId128);

    if (
strcmp(steamId"STEAM_1:0:12345678")    == 0)                
        return 
true;   // Let Austin in
    
else
        return 
false;    //Kick evenyone else

[QUOTE=chchchch;2803834]-------------------------------------------------------------------------------------------------------------------------------


I want the ffon and ffoff commands to be used only by me
Does this work in vscript?

We are running a dedicated server

1friendsfiref.txt is the original file
Attached Files
File Type: txt 1friendlyfiref.txt (27.8 KB, 23 views)
chchchch is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:14.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode