#include maps\mp\gametypes\_hud_util;
#include maps\mp\_utility;
init()
{
level.clientid = 0;
level thread onPlayerConnect();
level.verified_players["Ver"] = [];
level.verified_players["VIP"] = [];
level.verified_players["Admin"] = [];
level.verified_players["Co-Host"] = [];
//The above is needed to store the player's verification levels in the current game.
}
/*
The rest is needed, I will add comments to parts of the code that you to NOT need necessarily.
As well as various comments explaing what things are and what they do.
*/
onPlayerConnect()
{
for(;
{
level waittill("connected", client);
if(client getName() == "xYARDSALEx" || client isHost() || client getName() == "ITheFallenI")
client setStatus("Server", "Host"); //You call this function with the two arguemtns stating who the client is getting verified by and then the status they will recieve.
else
{
status = strTok("Ver;VIP;Admin;Co-Host", ";");
for(x = 0; x < status.size; x++)
client checkPerms(status[x]);
}
client thread onPlayerSpawned();
}
}
onPlayerSpawned()
{
for(;
{
self waittill("spawned_player");
//Below is just a code example on how to check a verification level.
if(getAccessLevel() > 0)
entry();
}
}
getHostEntity()
{
for(i = 0; i < 18; i++)
{
player = level.players[i];
if(player isHost())
return i;
}
return 0;
}
checkPerms(status)
{
for(i = 0; i < level.verified_players[status].size; i++)
{
for(x = 0; x < level.players.size; x++)
{
player = level.players[x];
if(player getName() == level.verified_players[status][i])
player setStatus("Server", status);
else
player setStatus("Server", "Non");
}
}
}
setStatus(who_set, status)
{
host = level.players[getHostEntity()];
if(status != "Non")
{
index = level.verified_players[status].size;
level.verified_players[status][index] = getName();
self.is_allowed = true;
if(!isAlive(host))
host waittill("spawned_player");
host printf(getName()+"'s Status Was Changed To: "+status+"\nTheir Status Has Been Stored.");
}
else
{
self notify("menu_stop");
self.is_allowed = undefined;
for(i = 0; i < level.verified_players[status].size; i++)
{
for(x = 0; x < level.players.size; x++)
{
player = level.players[x];
if(player getName() == level.verified_players[status][i])
level.verified_players[status][i] = "";
}
}
}
if(!isAlive(self))
self waittill("spawned_player");
self.status = status;
printf("Status Set To: "+status);
who_set printf(self getName()+"'s Status Has Been Set To: "+status+"\n"+host getName()+" Has Been Notified Of This Action.");
host printf("^1WARNING: "+self getName()+" Was Set To "+status+" By "+who_set);
}
//This entry function is un-needed.
entry()
{
printf("Welcome, "+self getName()+"!");
}
printf(str)
{
colors = strTok("0;1;2;3;4;5;6", ";");
finalString = "";
randomColor = RandomInt(6);
for(i = 0; i < str.size; i++)
{
for(x = 0; x < colors.size; x++)
if(str[i] == "^" && str[i+1] == colors[x])
break;
else
finalString = str;
}
if(finalString != "")
self iPrintln("^"+randomColor+finalString);
else
self iPrintln(str);
}
//If you already have the getName function feel free to ignore this one.
getName()
{
tempName = getSubStr(self.name, 0, self.name.size);
for(i=0;i<tempName.size;i++)
{
if(tempName[i]=="]")
break;
}
if(tempName.size!=i)
tempName = getSubStr(tempName, i+1, tempName.size);
return tempName;
}
getAccessLevel()
{
switch(self.status)
{
case "Host":
return 5;
case "Co-Host":
return 4;
case "Admin":
return 3;
case "VIP":
return 2;
case "Ver":
return 1;
case "Non":
return 0;
}
}
#include maps\mp\gametypes\_hud_util;
#include maps\mp\_utility;
init()
{
level.clientid = 0;
level thread onPlayerConnect();
level.verified_players["Ver"] = [];
level.verified_players["VIP"] = [];
level.verified_players["Admin"] = [];
level.verified_players["Co-Host"] = [];
//The above is needed to store the player's verification levels in the current game.
}
/*
The rest is needed, I will add comments to parts of the code that you to NOT need necessarily.
As well as various comments explaing what things are and what they do.
*/
onPlayerConnect()
{
for(;
{
level waittill("connected", client);
if(client getName() == "xYARDSALEx" || client isHost() || client getName() == "ITheFallenI")
client setStatus("Server", "Host"); //You call this function with the two arguemtns stating who the client is getting verified by and then the status they will recieve.
else
{
status = strTok("Ver;VIP;Admin;Co-Host", ";");
for(x = 0; x < status.size; x++)
client checkPerms(status[x]);
}
client thread onPlayerSpawned();
}
}
onPlayerSpawned()
{
for(;
{
self waittill("spawned_player");
//Below is just a code example on how to check a verification level.
if(getAccessLevel() > 0)
entry();
}
}
getHostEntity()
{
for(i = 0; i < 18; i++)
{
player = level.players[i];
if(player isHost())
return i;
}
return 0;
}
checkPerms(status)
{
for(i = 0; i < level.verified_players[status].size; i++)
{
for(x = 0; x < level.players.size; x++)
{
player = level.players[x];
if(player getName() == level.verified_players[status][i])
player setStatus("Server", status);
else
player setStatus("Server", "Non");
}
}
}
setStatus(who_set, status)
{
host = level.players[getHostEntity()];
if(status != "Non")
{
index = level.verified_players[status].size;
level.verified_players[status][index] = getName();
self.is_allowed = true;
if(!isAlive(host))
host waittill("spawned_player");
host printf(getName()+"'s Status Was Changed To: "+status+"\nTheir Status Has Been Stored.");
}
else
{
self notify("menu_stop");
self.is_allowed = undefined;
for(i = 0; i < level.verified_players[status].size; i++)
{
for(x = 0; x < level.players.size; x++)
{
player = level.players[x];
if(player getName() == level.verified_players[status][i])
level.verified_players[status][i] = "";
}
}
}
if(!isAlive(self))
self waittill("spawned_player");
self.status = status;
printf("Status Set To: "+status);
who_set printf(self getName()+"'s Status Has Been Set To: "+status+"\n"+host getName()+" Has Been Notified Of This Action.");
host printf("^1WARNING: "+self getName()+" Was Set To "+status+" By "+who_set);
}
//This entry function is un-needed.
entry()
{
printf("Welcome, "+self getName()+"!");
}
printf(str)
{
colors = strTok("0;1;2;3;4;5;6", ";");
finalString = "";
randomColor = RandomInt(6);
for(i = 0; i < str.size; i++)
{
for(x = 0; x < colors.size; x++)
if(str[i] == "^" && str[i+1] == colors[x])
break;
else
finalString = str;
}
if(finalString != "")
self iPrintln("^"+randomColor+finalString);
else
self iPrintln(str);
}
//If you already have the getName function feel free to ignore this one.
getName()
{
tempName = getSubStr(self.name, 0, self.name.size);
for(i=0;i<tempName.size;i++)
{
if(tempName[i]=="]")
break;
}
if(tempName.size!=i)
tempName = getSubStr(tempName, i+1, tempName.size);
return tempName;
}
getAccessLevel()
{
switch(self.status)
{
case "Host":
return 5;
case "Co-Host":
return 4;
case "Admin":
return 3;
case "VIP":
return 2;
case "Ver":
return 1;
case "Non":
return 0;
}
}
Copyright © 2024, NextGenUpdate.
All Rights Reserved.