Violt 3 Posted November 13, 2018 Hello, I am reworking a script i found on this forum (Not Copyrighted) So the purpose of this script if a player's SteamID64 is in the admin list that if he uses any of these commands thing will happen for example: /offroad = spawns a offroad car. Here's a list off all the available commands. /offroad /heal [playername] /killall /kill [playername] /time [hour] [minute] /allhere /here [playername] /allgoto [player] /goto [playername] /spawn [object] The Problem is that i am new to scripting and don't have any experience yet. I don't know the steps how to do something like this. Could someone please help me with this? Thanks! Here is the script i was working on there's still a lot of things that are missing / not right at all. // Admin Tools string cmd_prefix = "/"; // Must be special character string SteamId_adminlist = { "76561198122914475", //Violt "76561198155447330" //Sidemavv }; if (player.GetIdentity().GetPlainId() == SteamId_admin1) { isAdmin = true; { found=true; break; } } return found; } void SendMessageToPlayer(PlayerBase player, string message) { Param1<string> param = new Param1<string>( message ); GetGame().RPCSingleParam(player, ERPCs.RPC_USER_ACTION_MESSAGE, param, true, player.GetIdentity()); } bool IsPlayer(string name) { PlayerBase p; array<Man> players = new array<Man>; GetGame().GetPlayers(players); for ( int i = 0; i < players.Count(); ++i ) { p = players.Get(i); if(p.GetIdentity().GetName() == name) return true; } return false; } PlayerBase GetPlayer(string name) { PlayerBase p; array<Man> players = new array<Man>; GetGame().GetPlayers(players); for ( int i = 0; i < players.Count(); ++i ) { p = players.Get(i); if(p.GetIdentity().GetName() == name) return p; } return NULL; } override void OnEvent(EventType eventTypeId, Param params) { super.OnEvent(eventTypeId,params); int i; PlayerBase player, temp_player; array<Man> players = new array<Man>; GetGame().GetPlayers(players); if(eventTypeId != ChatMessageEventTypeID) return; // Is chat message ChatMessageEventParams chat_params = ChatMessageEventParams.Cast( params ); if(chat_params.param1 != 0 || chat_params.param2 == "") return; player = GetPlayer(chat_params.param2); if(player == NULL) return; string message = chat_params.param3, prefix, param0, command; TStringArray tokens = new TStringArray; message.Split(" ", tokens); int count = tokens.Count(); param0 = tokens.Get(0); param0.ParseStringEx(prefix); if(prefix != cmd_prefix) return; param0.ParseStringEx(command); GetGame().AdminLog("[ADMCMD] PLAYER: "+ player.GetIdentity().GetName() +" ("+player.GetIdentity().GetPlainId()+", "+player.GetIdentity().GetId()+") CMD: "+ command); switch(command) { case "spawn": { if(count != 2) { SendMessageToPlayer(player, "/spawn [object]"); return; } GetGame().CreateObject(tokens[1], player.GetPosition(), false, true ); SendMessageToPlayer(player, "[ObjectSpawn] Object spawned: " + tokens[1]); break; } case "goto": { if(count != 2) { SendMessageToPlayer(player, "/goto [player]"); return; } temp_player = GetPlayer(tokens[1]); if(temp_player == NULL) { SendMessageToPlayer(player, "[Teleport] Can't find player called: '"+tokens[1]+"'"); } else { player.SetPosition(temp_player.GetPosition()); SendMessageToPlayer(player, "[Teleport] You teleported to " + temp_player.GetIdentity().GetName()); } break; } case "allgoto": { PlayerBase allgoto_target; if(count != 2) { SendMessageToPlayer(player, "/allgoto [player]"); return; } allgoto_target = GetPlayer(tokens[1]); if(allgoto_target == NULL) { SendMessageToPlayer(player, "[Teleport] Can't find player called: '"+tokens[1]+"'"); } else { SendMessageToPlayer(player, "[Teleport] You teleported everyone to your location"); for (i = 0; i < players.Count(); i++) { temp_player = players.Get(i); SendMessageToPlayer(temp_player, "[Teleport] You have been teleported to player " + allgoto_target.GetIdentity().GetName()); temp_player.SetPosition(allgoto_target.GetPosition()); } } break; } case "here": { if(count != 2) { SendMessageToPlayer(player, "/here [player]"); return; } temp_player = GetPlayer(tokens[1]); if(temp_player == NULL) { SendMessageToPlayer(player, "[Teleport] Can't find player called: '"+tokens[1]+"'"); } else { temp_player.SetPosition(player.GetPosition()); SendMessageToPlayer(temp_player, "[Teleport] You have been teleported to admin " + player.GetIdentity().GetName()); SendMessageToPlayer(player, "[Teleport] You teleported " + temp_player.GetIdentity().GetName() + " to your location"); } break; } case "allhere": { SendMessageToPlayer(player, "[Teleport] You teleported everyone to your location"); for (i = 0; i < players.Count(); i++) { temp_player = players.Get(i); SendMessageToPlayer(temp_player, "[Teleport] You have been teleported to admin " + player.GetIdentity().GetName()); temp_player.SetPosition(player.GetPosition()); } break; } case "time": { if(count != 3) { SendMessageToPlayer(player, "/time [hour] [minute]"); return; } GetGame().GetWorld().SetDate( 2018, 1, 7, tokens[1].ToInt(), tokens[2].ToInt()); SendMessageToPlayer(player, "[Servertime] You have set the servertime to " + tokens[1] + ":"+tokens[2]); break; } case "kill": { if(count == 2) { temp_player = GetPlayer(tokens[1]); if(temp_player == NULL) { SendMessageToPlayer(player, "[Kill] Can't find player called: '"+tokens[1]+"'"); } else { temp_player.SetHealth(0); SendMessageToPlayer(player, "[Kill] You killed " + temp_player.GetIdentity().GetName()); } } else { player.SetHealth(0); SendMessageToPlayer(player, "[Kill] You killed yourself"); } break; } case "killall": { SendMessageToPlayer(player, "[Kill] You killed everyone"); for (i = 0; i < players.Count(); i++) { temp_player = players.Get(i); if(temp_player.GetIdentity().GetId() == player.GetIdentity().GetId()) continue; temp_player.SetHealth(0); } break; } case "heal": { PlayerBase heal_target; if(count == 2) { heal_target = GetPlayer(tokens[1]); if(heal_target == NULL) { SendMessageToPlayer(player, "[Heal] Can't find player called: '"+tokens[1]+"'"); } else { SendMessageToPlayer(player, "[Heal] You healed " + heal_target.GetIdentity().GetName()); } } else { heal_target = player; SendMessageToPlayer(player, "[Heal] You healed yourself"); } if(heal_target != NULL) { heal_target.SetHealth(heal_target.GetMaxHealth("", "")); heal_target.SetHealth("", "Blood", heal_target.GetMaxHealth("", "Blood")); heal_target.GetStatStamina().Set(1000); heal_target.GetStatEnergy().Set(1000); heal_target.GetStatWater().Set(1000); } break; } case "offroad": { SendMessageToPlayer(player, "[Offroad] Vehicled spawned"); EntityAI v; v = GetGame().CreateObject( "OffroadHatchback", player.GetPosition() + "1.5 0 1.5"); v.GetInventory().CreateAttachment("SparkPlug"); v.GetInventory().CreateAttachment("EngineBelt"); v.GetInventory().CreateAttachment("CarBattery"); v.GetInventory().CreateAttachment("HatchbackHood"); v.GetInventory().CreateAttachment("HatchbackTrunk"); v.GetInventory().CreateAttachment("HatchbackDoors_CoDriver"); v.GetInventory().CreateAttachment("HatchbackWheel"); v.GetInventory().CreateAttachment("HatchbackWheel"); v.GetInventory().CreateAttachment("HatchbackWheel"); v.GetInventory().CreateAttachment("HatchbackWheel"); v.GetInventory().CreateAttachment("HatchbackWheel"); // spare break; } default: { SendMessageToPlayer(player, "Unknown command: " + command); break; } } } // End of Admin Tools Share this post Link to post Share on other sites
philippj 103 Posted November 13, 2018 5 minutes ago, Violt said: Hello, I am reworking a script i found on this forum (Not Copyrighted) So the purpose of this script if a player's SteamID64 is in the admin list that if he uses any of these commands thing will happen for example: /offroad = spawns a offroad car. Here's a list off all the available commands. The Problem is that i am new to scripting and don't have any experience yet. I don't know the steps how to do something like this. Could someone please help me with this? Thanks! Here is the script i was working on there's still a lot of things that are missing / not right at all. Yeah thats my script. You just need to modify bool IsPlayerAnAdmin(PlayerBase player) { bool found = false; for ( int i = 0; i < admins.Count(); ++i ) { if(player.GetIdentity().GetId() == admins[i]) { found=true; break; } } return found; } To take SteamIDs instead of BI UIDs. (GetIdentity().GetPlainId()) On a side note: Copyright laws completely apply to the script I just dont give a f*** about what is done with it 3 Share this post Link to post Share on other sites
eggy785 8 Posted November 13, 2018 16 minutes ago, philippj said: Yeah thats my script. You just need to modify bool IsPlayerAnAdmin(PlayerBase player) { bool found = false; for ( int i = 0; i < admins.Count(); ++i ) { if(player.GetIdentity().GetId() == admins[i]) { found=true; break; } } return found; } To take SteamIDs instead of BI UIDs. (GetIdentity().GetPlainId()) On a side note: Copyright laws completely apply to the script I just dont give a f*** about what is done with it i tried runing your script it has issues with Bi UIDS alot of errors, so i am using DaOne, i want to use yours cleaner but keep getting errors Share this post Link to post Share on other sites
philippj 103 Posted November 14, 2018 The way EnforceScript handles array definitions are misterious. Just define every ID in one line and you should be fine. Share this post Link to post Share on other sites
Violt 3 Posted November 14, 2018 (edited) 14 hours ago, philippj said: Yeah thats my script. You just need to modify bool IsPlayerAnAdmin(PlayerBase player) { bool found = false; for ( int i = 0; i < admins.Count(); ++i ) { if(player.GetIdentity().GetId() == admins[i]) { found=true; break; } } return found; } To take SteamIDs instead of BI UIDs. (GetIdentity().GetPlainId()) On a side note: Copyright laws completely apply to the script I just dont give a f*** about what is done with it Question, does it require you to login with admin password? As the whole server will see that i use commands because if you logged in everything an admin types will be send globaly Edited November 14, 2018 by Violt Share this post Link to post Share on other sites
eh chaser 0 Posted November 14, 2018 1 hour ago, Violt said: Question, does it require you to login with admin password? As the whole server will see that i use commands because if you logged in everything an admin types will be send globaly +1 Share this post Link to post Share on other sites
Violt 3 Posted November 14, 2018 17 hours ago, philippj said: Yeah thats my script. You just need to modify bool IsPlayerAnAdmin(PlayerBase player) { bool found = false; for ( int i = 0; i < admins.Count(); ++i ) { if(player.GetIdentity().GetId() == admins[i]) { found=true; break; } } return found; } To take SteamIDs instead of BI UIDs. (GetIdentity().GetPlainId()) On a side note: Copyright laws completely apply to the script I just dont give a f*** about what is done with it oh and Btw, how do you find your BI UID? Thats the reason why i wanted to use my SteamID64 just because i couldn't find my BI UID. Share this post Link to post Share on other sites
philippj 103 Posted November 14, 2018 (edited) https://omegax.cftools.de Log in and click on My Profile and click on Show IDs @Violt Edited November 14, 2018 by philippj Share this post Link to post Share on other sites
Sy8282 21 Posted November 15, 2018 Yep all commands are in global chat so every player sees that svd and the m4 etc, it's a great way to prevent badmins plus it ruins the game for you as you lose the main point of the game if you just spawn yourself stuff Share this post Link to post Share on other sites
Vegbruiser 0 Posted November 15, 2018 This admin script looks handy as a last resort, but where would it pull a list of admins from? A Whitelist file of some sort I presume? Share this post Link to post Share on other sites