Admin Name [When you go on Aduty]
#1

pawn Код:
if(strcmp(cmd, "/setadmintag", true) == 0)
    {
        if(PlayerInfo[playerid][pAdmin] <= 5) return SendClientMessage(playerid, COLOR_LIGHTRED, "* You need to be admin, to do this!");
        if(PlayerInfo[playerid][pAdmin] >= 1337)
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /setadmintag [Admin Name]");
            SetPlayerName(playerid, tmp);
            admintag = 1;
            SendClientMessage(playerid, COLOR_GREY, "* You have set your admin name!");
            return 1;
        }
        return 1;
    }

ADuty Bit
pawn Код:
if (admintag == 1)
                    {
                        new name[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, name, sizeof(name));
                        SetPlayerName(playerid, name);
                    }
Can anyone tell me, That changes the whole name, how would I return the real name, when you go off aduty? That is an admin name, btw.
Reply
#2

Not sure if this will work, But try make a new variable and set it so that if the value is 0 he is not aduty, and when he is now on admin duty it will +1 to the variable, Make a loop to check if the variable <= 1 if so then set his name to what he chose, And then the loop will check if its 0 again if its 0 it will change the name back, you will also have to make a string variable to save his name while he is not on admin duty or any other method of saving his name?
Reply
#3

global variables work wonders
pawn Код:
new offdutyname[MAX_PLAYERS][24];
new admintag[MAX_PLAYERS][24];
and save the names in those to call when ever you switch names or if you have a player info enum that would work better for saving and what not
Reply
#4

If you use the offdutyname[MAX_PLAYERS][24] variable by NumbSkull:
pawn Код:
if (admintag == 1)
{
    SetPlayerName(playerid, offdutyname[playerid]);
}
if(strcmp(cmd, "/setadmintag", true) == 0)
{
    if(PlayerInfo[playerid][pAdmin] <= 5) return SendClientMessage(playerid, COLOR_LIGHTRED, "* You need to be admin, to do this!");
    if(PlayerInfo[playerid][pAdmin] >= 1337)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /setadmintag [Admin Name]");
        SetPlayerName(playerid, tmp);
        admintag = 1;
        new name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        format(offdutyname, 24, name);
        SendClientMessage(playerid, COLOR_GREY, "* You have set your admin name!");
        return 1;
    }
    return 1;
}
Reply
#5

only prblem with that var is on log off you need to switch the adminduty and name back to off duty and make sure to set the var fresh for each logon or you get others tags
Reply
#6

C:\Users\matt\Desktop\New folder (3)\gamemodes\larp.pwn(26321) : warning 217: loose indentation
C:\Users\matt\Desktop\New folder (3)\gamemodes\larp.pwn(26332) : error 017: undefined symbol "offdutyname"
C:\Users\matt\Desktop\New folder (3)\gamemodes\larp.pwn(26339) : warning 217: loose indentation
C:\Users\matt\Desktop\New folder (3)\gamemodes\larp.pwn(3476 : error 017: undefined symbol "offdutyname"
C:\Users\matt\Desktop\New folder (3)\gamemodes\larp.pwn(3476 : warning 215: expression has no effect
C:\Users\matt\Desktop\New folder (3)\gamemodes\larp.pwn(3476 : error 001: expected token: ";", but found "]"
C:\Users\matt\Desktop\New folder (3)\gamemodes\larp.pwn(3476 : error 029: invalid expression, assumed zero
C:\Users\matt\Desktop\New folder (3)\gamemodes\larp.pwn(3476 : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Reply
#7

you didnt define them as a global variable on top first
but it may be easier to stuff them in you player info enum and save into player files so you dont get it mixed up with onplayerdisconnect and all that stuff with the globals
Reply
#8

I did, Still errors.
Reply
#9

C:\Users\matt\Desktop\New folder (3)\gamemodes\larp.pwn(26330) : error 033: array must be indexed (variable "admintag")
C:\Users\matt\Desktop\New folder (3)\gamemodes\larp.pwn(26333) : error 048: array dimensions do not match
C:\Users\matt\Desktop\New folder (3)\gamemodes\larp.pwn(34767) : error 033: array must be indexed (variable "admintag")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

pawn Код:
if(strcmp(cmd, "/setadmintag", true) == 0)
    {
        if(PlayerInfo[playerid][pAdmin] <= 5) return SendClientMessage(playerid, COLOR_LIGHTRED, "* You need to be admin, to do this!");
        if(PlayerInfo[playerid][pAdmin] >= 1337)
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /setadmintag [Admin Name]");
            SetPlayerName(playerid, tmp);
            admintag[playerid] = 1;
            new name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, name, sizeof(name));
            format(offdutyname, 24, name);
            SendClientMessage(playerid, COLOR_GREY, "* You have set your admin name!");
            return 1;
        }
        return 1;
    }
pawn Код:
if (admintag[playerid] == 1)
                    {
                        SetPlayerName(playerid, offdutyname[playerid]);
                    }
How do I fix it?
Reply
#10

Make sure your admintag is defined as:
pawn Код:
new admintag[MAX_PLAYERS];
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)