SA-MP Forums Archive
Undercover command - 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: Undercover command (/showthread.php?tid=543170)



Undercover command - benjaminjones - 25.10.2014

pawn Код:
CMD:undercover(playerid, params[])
{
    if (GetFactionType(playerid) != FACTION_POLICE)
        return SendErrorMessage(playerid, "You must be a police officer.");

    switch (listitem)
    {
        case 0:
        {
            PlayerData[playerid][pClothesType] = 1;

            switch (PlayerData[playerid][pGender])
            {
                 case 1:
                    ShowModelSelectionMenu(playerid, "Clothes", MODEL_SELECTION_CLOTHES, g_aMaleSkins, sizeof(g_aMaleSkins), -16.0, 0.0, -55.0);

                case 2:
                    ShowModelSelectionMenu(playerid, "Clothes", MODEL_SELECTION_CLOTHES, g_aFemaleSkins, sizeof(g_aFemaleSkins), -16.0, 0.0, -55.0);
                }
                }
    }
    return 1;
}
pawn Код:
Dialog:Undercover(playerid, response, listitem, inputtext[])
{
    switch (listitem)
    {
        case 0:
        {
            PlayerData[playerid][pClothesType] = 1;

            switch (PlayerData[playerid][pGender])
            {
                case 1:
                    ShowModelSelectionMenu(playerid, "Clothes", MODEL_SELECTION_CLOTHES, g_aMaleSkins, sizeof(g_aMaleSkins), -16.0, 0.0, -55.0);

                case 2:
                    ShowModelSelectionMenu(playerid, "Clothes", MODEL_SELECTION_CLOTHES, g_aFemaleSkins, sizeof(g_aFemaleSkins), -16.0, 0.0, -55.0);
            }
            }
    }
    return 1;
}
Current error:
pawn Код:
error 017: undefined symbol "listitem"

Okay so, I am creating a undercover command that is restricted to Police factions only. Basically, I need the command to be doing this: When the player type in the command he will get the dialog where he can click on the skin he want. Then he will receive the skin. Do I have to use dialog or I need the command only? If someone is able to remake the command and the dialog if needed, I would be very thankful.



Re: Undercover command - Emmet_ - 25.10.2014

Remove the "switch (listitem)" part from the command.


Re: Undercover command - benjaminjones - 25.10.2014

I tried to remove it but here are the errors:
pawn Код:
(33561) : error 014: invalid statement; not in switch
(33561) : warning 215: expression has no effect
(33561) : error 001: expected token: ";", but found ":"
(33561) : error 029: invalid expression, assumed zero
(33561) : fatal error 107: too many error messages on one line



Re: Undercover command - Crayder - 25.10.2014

pawn Код:
CHange Dialog:Undercover(playerid, response, listitem, inputtext[])
{
    switch (listitem)
    {
        case 0:
        {
            PlayerData[playerid][pClothesType] = 1;

            switch (PlayerData[playerid][pGender])
            {
                case 1:
                    ShowModelSelectionMenu(playerid, "Clothes", MODEL_SELECTION_CLOTHES, g_aMaleSkins, sizeof(g_aMaleSkins), -16.0, 0.0, -55.0);

                case 2:
                    ShowModelSelectionMenu(playerid, "Clothes", MODEL_SELECTION_CLOTHES, g_aFemaleSkins, sizeof(g_aFemaleSkins), -16.0, 0.0, -55.0);
            }
            }
    }
    return 1;
}









To

Dialog:Undercover(playerid, response, listitem, inputtext[])
{
    PlayerData[playerid][pClothesType] = 1;
    switch (PlayerData[playerid][pGender])
    {
        case 1:
            ShowModelSelectionMenu(playerid, "Clothes", MODEL_SELECTION_CLOTHES, g_aMaleSkins, sizeof(g_aMaleSkins), -16.0, 0.0, -55.0);
        case 2:
            ShowModelSelectionMenu(playerid, "Clothes", MODEL_SELECTION_CLOTHES, g_aFemaleSkins, sizeof(g_aFemaleSkins), -16.0, 0.0, -55.0);
    }
    return 1;
}



Re: Undercover command - benjaminjones - 25.10.2014

What about the command? It keeps giving the error
pawn Код:
error 017: undefined symbol "listitem"



Re: Undercover command - Emmet_ - 25.10.2014

pawn Код:
CMD:undercover(playerid, params[])
{
    if (GetFactionType(playerid) != FACTION_POLICE)
        return SendErrorMessage(playerid, "You must be a police officer.");

    PlayerData[playerid][pClothesType] = 1;

    switch (PlayerData[playerid][pGender])
    {
        case 1:
            ShowModelSelectionMenu(playerid, "Clothes", MODEL_SELECTION_CLOTHES, g_aMaleSkins, sizeof(g_aMaleSkins), -16.0, 0.0, -55.0);

        case 2:
            ShowModelSelectionMenu(playerid, "Clothes", MODEL_SELECTION_CLOTHES, g_aFemaleSkins, sizeof(g_aFemaleSkins), -16.0, 0.0, -55.0);
    }
    return 1;
}



Re: Undercover command - benjaminjones - 25.10.2014

Thank you, Emmet_ but when I click on the skin I want, nothing happens. My skin doesn't change, just the menu is closed.


Re: Undercover command - Quickie - 25.10.2014

ever heard of??
pawn Код:
ShowModelSelectionMenu(playerid, ListID, header_text[], dialogBGcolor = 0x4A5A6BBB, previewBGcolor = 0x88888899 , tdSelectionColor = 0xFFFF00AA)

forward OnPlayerModelSelection(playerid, response, listid, modelid);

public OnPlayerModelSelection(playerid, response, listid, modelid)
{
return 1;
}



Re: Undercover command - benjaminjones - 25.10.2014

Quote:
Originally Posted by Quickie
Посмотреть сообщение
ever heard of??
pawn Код:
ShowModelSelectionMenu(playerid, ListID, header_text[], dialogBGcolor = 0x4A5A6BBB, previewBGcolor = 0x88888899 , tdSelectionColor = 0xFFFF00AA)

forward OnPlayerModelSelection(playerid, response, listid, modelid);

public OnPlayerModelSelection(playerid, response, listid, modelid)
{
return 1;
}
Where do I put it in?


Re: Undercover command - Laurey - 25.10.2014

Create a dialog response of MODE_SELECTION_CLOTHES, and simply set skin, i expect you know how to.