SA-MP Forums Archive
Why do my enums not save properly - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Why do my enums not save properly (/showthread.php?tid=336879)



Why do my enums not save properly - Scripter12345 - 24.04.2012

Why do my enums not save properly


pawn Код:
enum pData
{
       AdminSkin,
}
pawn Код:
CMD:setadminskin(playerid, params[])
{
    if(PlayerData[ID][AdminLevel] >= 1)
    {
        new string[128], newskin;
        if(sscanf(params, "i", newskin)) return SendClientMessage(playerid, COLOR_GREEN, "USAGE: /setadminskin <skinid>");
        format(string, sizeof(string), "You set your admin skin to %d", newskin);
        SendClientMessage(playerid, 0xFFFFFFF, string);
        PlayerData[playerid][AdminSkin] = newskin;
    }
    return 1;
}
pawn Код:
CMD:adminduty(playerid, params[])
{
    if(PlayerData[ID][AdminLevel] >= 1)
    {
        if(PlayerData[ID][AdminDuty] == 0)
        {
            SetPlayerSkin(playerid, PlayerData[playerid][AdminSkin]);
        }
     }
}

My enum comes out like this

pawn Код:
AdminSkin = 0

Thank You


Please Help Me Please


Re: Why do my enums not save properly - iRage - 24.04.2012

Show the whole things, I can notice there are lots of missing stuff.


Re: Why do my enums not save properly - Scripter12345 - 24.04.2012

Quote:
Originally Posted by iRage
Посмотреть сообщение
Show the whole things, I can notice there are lots of missing stuff.
The whole code for admin duty ?


Thank You


Please Help Me Please


Re: Why do my enums not save properly - iRage - 24.04.2012

Hold on, what does "ID" stand for? It should be playerid.


Re: Why do my enums not save properly - Scripter12345 - 24.04.2012

Quote:
Originally Posted by iRage
Посмотреть сообщение
Hold on, what does "ID" stand for? It should be playerid.
Well ID works just why are my enums not saving properly


Thank You


Please Help Me Please


Re: Why do my enums not save properly - [ABK]Antonio - 24.04.2012

ID won't work....Change ID to playerid then see what it is


Re: Why do my enums not save properly - Scripter12345 - 24.04.2012

Quote:
Originally Posted by [ABK]Antonio
Посмотреть сообщение
ID won't work....Change ID to playerid then see what it is
That has NOTHING to do with enums.


Re: Why do my enums not save properly - iRage - 24.04.2012

Then show us the whole thingy in order for us to be able to help you


Re: Why do my enums not save properly - Scripter12345 - 24.04.2012

Quote:
Originally Posted by iRage
Посмотреть сообщение
Then show us the whole thingy in order for us to be able to help you
pawn Код:
CMD:adminduty(playerid, params[])
{
    if(PlayerData[ID][AdminLevel] >= 1)
    {
        if(PlayerData[ID][AdminDuty] == 0)
        {
            GetPlayerName(playerid, PlayerData[playerid][OriginalName], 24);
            SetPlayerName(playerid, PlayerData[playerid][AdminName]);
            PlayerData[playerid][OriginalSkin] = GetPlayerSkin(playerid);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are now on admin duty");
            format(str2, sizeof(str2),"Admin %s Is now online",PlayerData[playerid][AdminName]);
            SetPlayerSkin(playerid, PlayerData[playerid][AdminSkin]);
            SetPlayerColor(playerid, COLOR_NAVY);
            SendClientMessageToAll(COLOR_GREEN,str2);
            PlayerData[playerid][AdminDuty] = 1;
        }
        else
        {
            if(PlayerData[ID][AdminDuty] == 1)
            {
                SetPlayerName(playerid, PlayerData[playerid][OriginalName]);
                SetPlayerSkin(playerid, PlayerData[playerid][OriginalSkin]);
                SendClientMessage(playerid, COLOR_LIGHTBLUE, "You are now off admin duty");
                format(str2, sizeof(str2),"Admin %s Is now offline",PlayerData[playerid][AdminName]);
                SetPlayerColor(playerid, COLOR_WHITE);
                SendClientMessageToAll(COLOR_GREEN,str2);
                PlayerData[playerid][AdminDuty] = 0;
            }
        }
    }
    return 1;
}



Re: Why do my enums not save properly - iRage - 24.04.2012

This would only work if player with ID 0 is an admin, considering that you've made a public declaration for the variable "ID" as "new ID" without actually giving it a value so its default value will be 0.

If what I assumed isn't true then show me what's ID used for and how does it get the value it has.
Alternatively change the "ID" to "playerid", test the command and tell me what happens.