mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-07 16:53:21 +00:00
Extract cvar recorder to own inc
This commit is contained in:
parent
bd6526f85d
commit
57e922f1bc
2 changed files with 75 additions and 39 deletions
|
@ -40,50 +40,15 @@ bool FindSpawnPosition(float pos[3], bool includePlayers = true) {
|
|||
return false;
|
||||
}
|
||||
|
||||
static char buffer[64];
|
||||
|
||||
methodmap GameConVar < ConVar {
|
||||
public GameConVar(const char[] name) {
|
||||
return view_as<GameConVar>(FindConVar(name));
|
||||
}
|
||||
|
||||
public void RecordInt(int value, bool record = false) {
|
||||
if(record) {
|
||||
this.GetName(buffer, sizeof(buffer));
|
||||
previousCvarValues.SetValue(buffer, float(value));
|
||||
}
|
||||
this.IntValue = value;
|
||||
}
|
||||
|
||||
public void RecordFloat(float value, bool record = false) {
|
||||
if(record) {
|
||||
this.GetName(buffer, sizeof(buffer));
|
||||
previousCvarValues.SetValue(buffer, value);
|
||||
}
|
||||
this.FloatValue = value;
|
||||
}
|
||||
|
||||
public void RecordString(const char[] value, bool record = false) {
|
||||
if(record) {
|
||||
char prevValue[32];
|
||||
this.GetName(buffer, sizeof(buffer));
|
||||
this.GetString(prevValue, sizeof(prevValue));
|
||||
previousCvarValues.SetString(buffer, prevValue);
|
||||
}
|
||||
this.SetString(value);
|
||||
}
|
||||
}
|
||||
|
||||
static char buffer[128];
|
||||
|
||||
methodmap GuessWhoGame {
|
||||
|
||||
property int Seeker {
|
||||
public get() {
|
||||
if(currentSeeker > 0 && IsClientConnected(currentSeeker)) {
|
||||
return currentSeeker;
|
||||
} else {
|
||||
return this._FindSeeker();
|
||||
}
|
||||
if(currentSeeker <= 0 || !IsClientConnected(currentSeeker))
|
||||
currentSeeker = this._FindSeeker();
|
||||
return currentSeeker;
|
||||
}
|
||||
public set(int client) {
|
||||
for(int i = 1; i <= MaxClients; i++) {
|
||||
|
@ -258,6 +223,13 @@ methodmap GuessWhoGame {
|
|||
}
|
||||
}
|
||||
|
||||
public void SetPoints(MovePoints points) {
|
||||
if(movePoints != null) {
|
||||
delete movePoints;
|
||||
}
|
||||
movePoints = points;
|
||||
}
|
||||
|
||||
// Ignores seeker
|
||||
property int AlivePlayers {
|
||||
public get() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue