#define Test 1 //Good 2 Manger 3 .... Owner 5
public OnPlayerSpawn(playerid)
{
if(PlayerInfo[playerid][pRank] == Test)
{
//your things do here
}
else if(PlayerInfo[playerid][pRank] == Good)
{
//your things do here
}
//put others as you want
return 1;
}
pawn Код:
|
CMD:setrank(playerid, params[])
{
new lvl, player, string[128]; // Local variable
if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 5) // Checks if the player is a RCON admin or level 5 admin or more
{
if(sscanf(params,"ui", player, lvl)) return SendClientMessage(playerid, GREY, "Usage: /setadmin [id] [level]");
if(lvl > 6) return SendClientMessage(playerid, RED, "MAX. Admin level is 6!");// Checks if you put a level above 6 (You can change it to your own)
if(!IsPlayerConnected(player)) return SendClientMessage(playerid, RED, "Invalid player id!");
else
{
format(string,sizeof(string),"You have set "COL_LIGHTGREEN"%s (%d)"COL_WHITE" admin level to "COL_LIGHTGREEN"%d", GetName(player), player, lvl); // Sends message to player
SendClientMessage(playerid, WHITE, string);
format(string,sizeof(string),"Admin "COL_LIGHTGREEN"%s (%d)"COL_WHITE" has set your admin level to "COL_LIGHTGREEN"%d", GetName(playerid), playerid, lvl);
SendClientMessage(player, WHITE, string);
PlayerInfo[player][pAdmin] = lvl; // Adds the level to player status
}
}
else // If the player is neither a RCON admin or level 4, then he will get this message
{
SendClientMessage(playerid, RED, "You're not a level 4 admin");
}
return 1;
}
#define Trial_Admin 10 #define Junior_Administrator 11 #define General_Administrator 12 #define Senior_Administrator 13 #define Head_Administrator 14 #define Community_Manager 15 #define Co-Owner 16 |
public LoadUser_data(playerid,name[],value[]) INI_Int("Admin",PlayerInfo[playerid][pRank]); |
if(PlayerInfo[playerid][pRank] == Trial_Admin) { //your things do here } else if(PlayerInfo[playerid][pRank] == Junior_Administrator) { //your things do here } else if(PlayerInfo[playerid][pRank] == General_Administrator) { //your things do here } else if(PlayerInfo[playerid][pRank] == Senior_Administrator) { //your things do here } else if(PlayerInfo[playerid][pRank] == Head_Administrator) { //your things do here } else if(PlayerInfo[playerid][pRank] == Community_Manager) { //your things do here } else if(PlayerInfo[playerid][pRank] == Co-Owner) { //your things do here } |
else if(PlayerInfo[playerid][pRank] == Co-Owner) { //your things do here } |
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Score",0);
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Score",PlayerInfo[playerid][pScore]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Health",PlayerInfo[playerid][pHealth]);
INI_Int("Armour",PlayerInfo[playerid][pArmour]);
INI_Int("Admin",PlayerInfo[playerid][pRank]);
enum pInfo
{
pCash,
pRank
}