Post by Gaspatcho on Nov 2, 2021 9:02:15 GMT
Follow this and you can have your class Aura or any aura you have to be toggle-able for each player.
first we will use variable which will be used to show/hide the aura for our player, you can make it a normal variable or use a bool, that's up to you.
second we will make a function to switch the variable/bool for us.
third, we will use get_players function to retrieve our player list without the bots and then use the aura message.
That's all.
first we will use variable which will be used to show/hide the aura for our player, you can make it a normal variable or use a bool, that's up to you.
second we will make a function to switch the variable/bool for us.
third, we will use get_players function to retrieve our player list without the bots and then use the aura message.
That's all.
new OneVariable[33] // random named variable
const MAXPLAYERS = 32 // a constant with the max slots of the server
//Eyo here? throw this shit in plugin_init or do it your way, nobody cares.
register_clcmd("say /aura", "ShitFunction" )
//Our ShitFunction down bellow. I will just make a quick if case. you can use a menu if you want. I will use client_print to print in the chat.
//The variable is initially set to 0, but you know that, right? so we will make 0 as on and 1 as off
public ShitFunction(id)
{
if(OneVariable[id] == 0)
{
OneVariable = 1
client_print(id, print_chat, "Aura is off") // Because the aura should be on for players by default. you can however change that if you want.
}
else
{
OneVariable = 0
client_print(id, print_chat, "Aura is on")
}
}
//Now we will go with the third step as stated.
public ThisAura(id)
{
//This is the origin n colors for our auras, you can use a cvar or whatever the fuck you want. I will just slap some random numbers for the colors
//get_user_origin for the player origin
new org[3], color[3]
color[0] = 123 // <--- RED
color[1] = 100 // <--- GREEN
color[2] = 212 // <--- BLUE
get_user_origin(id, org)
//We need few more variables for the get_players which we will use.
new Players[MAXPLAYERS], i, PlayerCount, iPlayer
get_players(Players, PlayerCount, "c")
for (i = 0; i < PlayerCount; i++)
{
iPlayer = Players[i];
//Now we will add our if case to check if the player has the Aura off or on. and use continue not fucking return.
if(OneVariable[Player] == 1)
continue;
//Now we will slap our aura code
message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, .player = iPlayer)
write_byte(TE_DLIGHT) // TE id
write_coord(org[0]) // x
write_coord(org[1]) // y
write_coord(org[2]) // z
write_byte(20) // radius
write_byte(color[0]) // r
write_byte(color[1]) // g
write_byte(color[2]) // b
write_byte(2) // life
write_byte(0) // decay rate
message_end()
}
}