Help with finishing these /aduty & /setaname commands please
#1

Hi, i have been trying for ages to get this aduty and setaname system working.

What i want it to do is if the player doesnt have a 'aName' set when trying to go on duty, he will be told that he needs to set one. So then he would do "/setaname name" and his aName would be set. (this also saves to the pInfo ini file.

OKay, so he types /aduty and he goes on admin duty, with the name he set.
This is when the problem happens, when he goes off duty, his name does not change back to his character name, it stays as his admin name.

Anyone know how to fix this please? I know it is something to do with the fact that 'pName' isn't saving to the ini file but i can't work it out.
Thanks alot for anyone that can help, im sure im just mispelling a word somewhere xD

Heres the necessary code(the asetname and aduty cmds are at line 1369)
http://pastebin.com/R7yt5yZH
Reply
#2

pawn Код:
CMD:aduty(playerid, params[])
{
    new playername[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
    GetPlayerName(playerid, playername, sizeof(playername));
    if(!PlayerInfo[playerid][pAdmin])
    {
        return SendClientMessage(playerid, -1, "You are not an admin.");
    }
 
    if(PlayerInfo[playerid][OnDuty])
    {
        SetPlayerName(playerid, PlayerInfo[playerid][pName]);
        PlayerInfo[playerid][OnDuty] = false;
        SendClientMessage(playerid,COLOR_YELLOW, "You have gone OFF administrator duty!");
    }
    else
    {
        if(!PlayerInfo[playerid][HasSetAdminName])
        {
            return SendClientMessage(playerid, -1, "You haven't set an admin name yet.");
        }
        GetPlayerName(playerid, PlayerInfo[playerid][pName], sizeof(PlayerInfo[playerid][pName]));
        SetPlayerName(playerid, PlayerInfo[playerid][aName]);
        PlayerInfo[playerid][OnDuty] = true;
        SendClientMessage(playerid,COLOR_YELLOW, "You have gone ON administrator duty!");
    }
 
    return 1;
}
This should work.
Reply
#3

Thanks for replying

It almost works; theres just a problem with syntax i think but i can't see it

Any idea on what to do?
pawn Код:
D:\Downloads\Game Mods\GTA SA Mods\SAMP\Gamemodes\RP GMs\Roleplay Base Script\gamemodes\ei-rp.pwn(1409) : error 001: expected token: "]", but found "-identifier-"
D:\Downloads\Game Mods\GTA SA Mods\SAMP\Gamemodes\RP GMs\Roleplay Base Script\gamemodes\ei-rp.pwn(1409) : warning 215: expression has no effect
D:\Downloads\Game Mods\GTA SA Mods\SAMP\Gamemodes\RP GMs\Roleplay Base Script\gamemodes\ei-rp.pwn(1409) : error 001: expected token: ";", but found "]"
D:\Downloads\Game Mods\GTA SA Mods\SAMP\Gamemodes\RP GMs\Roleplay Base Script\gamemodes\ei-rp.pwn(1409) : error 029: invalid expression, assumed zero
D:\Downloads\Game Mods\GTA SA Mods\SAMP\Gamemodes\RP GMs\Roleplay Base Script\gamemodes\ei-rp.pwn(1409) : fatal error 107: too many error messages on one line
Reply
#4

What line is that?
Reply
#5

Ops sorry lol, forgot to paste the line in;

Here is the aduty command; the error occurs at the commented out line near the bottom:
pawn Код:
CMD:aduty(playerid, params[])
{
    new playername[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
    GetPlayerName(playerid, playername, sizeof(playername));
    if(!PlayerInfo[playerid][pAdmin])
    {
        return SendClientMessage(playerid, -1, "You are not an admin.");
    }

    if(PlayerInfo[playerid][OnDuty])
    {
        SetPlayerName(playerid, PlayerInfo[playerid][pName]);
        PlayerInfo[playerid][OnDuty] = false;
        SendClientMessage(playerid,COLOR_YELLOW, "You have gone OFF administrator duty!");
    }
    else
    {
        if(!PlayerInfo[playerid][HasSetAdminName])
        {
            return SendClientMessage(playerid, -1, "You haven't set an admin name yet.");
        }
        //GetPlayerName(playerid, PlayerInfo[playerid][pName], sizeof(PlayerInfo[playerid][pName]));
        SetPlayerName(playerid, PlayerInfo[playerid][aName]);
        PlayerInfo[playerid][OnDuty] = true;
        SendClientMessage(playerid,COLOR_YELLOW, "You have gone ON administrator duty!");
    }

    return 1;
}
Reply
#6

Wow I have no idea to be honest..Try this..

pawn Код:
GetPlayerName(playerid, PlayerInfo[playerid][pName], 24);
Reply
#7

Quote:
Originally Posted by JhnzRep
Посмотреть сообщение
Wow I have no idea to be honest..Try this..

pawn Код:
GetPlayerName(playerid, PlayerInfo[playerid][pName], 24);
OMFG IT WORKED!!!! Thanks alot man!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)