SA-MP Forums Archive
adding a new class - 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: adding a new class (/showthread.php?tid=439973)



adding a new class - Geeboi_Mehdi - 27.05.2013

i am using zaks server lof but when i try to add a new class it don't show up for example
pawn Код:
public ShowRole(playerid)
{
    new finishedcustomization[256], finishedtut[256], finishedtut2[128], string[256];
    new Score = PInfo[playerid][TotalScore];
    format(finishedcustomization, 256, "{0000FF}Civilian Pilot {00FF00}[Available]");
    if(Score > 24) { format(finishedtut, 256, "{FF9900}Bus Driver {00FF00}[Available]"); }
    else if(Score < 25) { format(finishedtut, 256, "{FF9900}Bus Driver {FF0404}[Locked]"); }
    if(Score > 49) { format(finishedtut, 256, "{FF9900}Military Pilot {00FF00}[Available]"); }
    else if(Score < 50) { format(finishedtut, 256, "{FF9900}Military Pilot {FF0404}[Locked]"); }
    if(Score > 99) { format(finishedtut2, 256, "{00FFFF}Marine{00FF00}[Available]"); }
    else if(Score < 100) { format(finishedtut2, 256, "{00FFFF}Marine{FF0404}[Locked]"); }
    TogglePlayerControllable(playerid, 0);
    format(string, sizeof(string), "%s\n%s\n%s\n", finishedcustomization, finishedtut, finishedtut2);
    ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "{FFFFFF}Which role would you like to play as?", string, "Select", "");
    return 1;
}
Civillian Pilot, Military pilot and marine shows up but not bus driver why so?


Re: adding a new class - IstuntmanI - 27.05.2013

Use this:
pawn Код:
public ShowRole(playerid)
{
    new finishedcustomization[256], finishedtut[256], finishedtut2[128], finishedtut3[128], string[256];
    new Score = PInfo[playerid][TotalScore];
    format(finishedcustomization, 256, "{0000FF}Civilian Pilot {00FF00}[Available]");
    if(Score > 24) { format(finishedtut, 256, "{FF9900}Bus Driver {00FF00}[Available]"); }
    else if(Score < 25) { format(finishedtut, 256, "{FF9900}Bus Driver {FF0404}[Locked]"); }
    if(Score > 49) { format(finishedtut2, 256, "{FF9900}Military Pilot {00FF00}[Available]"); }
    else if(Score < 50) { format(finishedtut2, 256, "{FF9900}Military Pilot {FF0404}[Locked]"); }
    if(Score > 99) { format(finishedtut3, 256, "{00FFFF}Marine{00FF00}[Available]"); }
    else if(Score < 100) { format(finishedtut3, 256, "{00FFFF}Marine{FF0404}[Locked]"); }
    TogglePlayerControllable(playerid, 0);
    format(string, sizeof(string), "%s\n%s\n%s\n%s", finishedcustomization, finishedtut, finishedtut2, finishedtut3);
    ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "{FFFFFF}Which role would you like to play as?", string, "Select", "");
    return 1;
}
You had to use another variable.

Your code is pretty bad.


Re: adding a new class - Geeboi_Mehdi - 27.05.2013

What how you do it please tell me so i can add more :O
thanks so much man


Re: adding a new class - Vince - 27.05.2013

My god, did the one who initially wrote this even bother with program flow? Here is a cleaned up version. Much more straightforward.

pawn Код:
public ShowRole(playerid)
{
    new
        finishedcustomization[48],
        finishedtut[48],
        finishedtut2[48],
        finishedtut3[48],
        string[200];

        // set all locked
    finishedcustomization       = "{0000FF}Civilian Pilot {FF0404}[Locked]";
    finishedtut                 = "{FF9900}Bus Driver {FF0404}[Locked]";
    finishedtut2                = "{FF9900}Military Pilot {FF0404}[Locked]";
    finishedtut3                = "{00FFFF}Marine {FF0404}[Locked]";

    if(PInfo[playerid][TotalScore] > 0)
        finishedcustomization   = "{0000FF}Civilian Pilot {00FF00}[Available]";

    if(PInfo[playerid][TotalScore] > 25)
        finishedtut             = "{FF9900}Bus Driver {00FF00}[Available]";

    if(PInfo[playerid][TotalScore] > 50)
        finishedtut2            = "{FF9900}Military Pilot {00FF00}[Available]";

    if(PInfo[playerid][TotalScore] > 100)
        finishedtut3            = "{00FFFF}Marine{00FF00}[Available]";

    TogglePlayerControllable(playerid, 0);

    format(string, sizeof(string), "%s\n%s\n%s\n%s", finishedcustomization, finishedtut, finishedtut2, finishedtut3);
    ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "{FFFFFF}Which role would you like to play as?", string, "Select", "");
    return 1;
}



Re: adding a new class - Geeboi_Mehdi - 28.05.2013

Thanks vince its so much easy now to add more classes rep+