Help with Class Sytem
#1

I did this:
pawn Код:
public OnDialogsResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1)
            {
                if(response)
                    {

                        if(GetPlayerScore(playerid) <= 0)//Private
                        {

                        SetPlayerSkin(playerid, 287);
                        SendClientMessage(playerid, COLOR_BLUE, "You chose the assault as your class.");
                        SendClientMessage(playerid, COLOR_BLUE, "You can type /switchclass to change your class again.");
                        gPlayerClass[playerid] = ASSAULT_CLASS;
                        PickedClass[playerid] = 1;
                        SetPlayerVirtualWorld(playerid, 0);
                        TogglePlayerControllable(playerid, 1);
                        GivePlayerWeapon(playerid, 24, 200);
                        GivePlayerWeapon(playerid, 31, 500);
                        GivePlayerWeapon(playerid, 17, 5);
                        }
                        }


                if(listitem == 1)//sniper DONE
                    {
                        if(GetPlayerScore(playerid) <= 10)//Private

                        {

                            SetPlayerSkin(playerid, 122);
                            SendClientMessage(playerid, COLOR_BLUE, "You chose the Sniper as your class.");
                            SendClientMessage(playerid, COLOR_BLUE, "You can type /switchclass to change your class again.");
                            gPlayerClass[playerid] = SNIPER_CLASS;
                            PickedClass[playerid] = 1;
                            SetPlayerVirtualWorld(playerid, 0);
                            TogglePlayerControllable(playerid, 1);
                            GivePlayerWeapon(playerid, 23, 500);
                            GivePlayerWeapon(playerid, 34, 100);
                            GivePlayerWeapon(playerid, 29, 200);

                    }
                        else
                    {
                        SendClientMessage(playerid, COLOR_RED, "You need to be atleast Private class [/rank to see yours]");
                        TogglePlayerControllable(playerid, 0);
                    }
                }

                if(listitem == 3)//Engineer
                    {
                            if(GetPlayerScore(playerid) <= 250)//Sergeant

                            {
                            SetPlayerSkin(playerid, 285);
                            SendClientMessage(playerid, COLOR_BLUE, "You chose the Engineer as your class.");
                            SendClientMessage(playerid, COLOR_BLUE, "You can type /switchclass to change your class again.");
                            gPlayerClass[playerid] = ENGINEER_CLASS;
                            PickedClass[playerid] = 1;
                            SetPlayerVirtualWorld(playerid, 0);
                            TogglePlayerControllable(playerid, 1);
                            GivePlayerWeapon(playerid, 22, 100);
                            GivePlayerWeapon(playerid, 32, 500);
                            GivePlayerWeapon(playerid, 35, 5);


                    }
                            else
                    {
                        SendClientMessage(playerid, COLOR_RED, "You need to be atleast Sergeant class [/rank to see yours]");
                        TogglePlayerControllable(playerid, 0);
                    }
                }

                if(listitem == 4)//FlameThrower
                    {
                            if(GetPlayerScore(playerid) <= 400)//CAPTAIN

                            {

                            SetPlayerSkin(playerid, 144);
                            SendClientMessage(playerid, COLOR_BLUE, "You chose the Jet Trooper as your class.");
                            SendClientMessage(playerid, COLOR_BLUE, "You can type /switchclass to change your class again.");
                            gPlayerClass[playerid] = JETTROOPER_CLASS;
                            PickedClass[playerid] = 1;
                            SetPlayerVirtualWorld(playerid, 0);
                            TogglePlayerControllable(playerid, 1);
                            GivePlayerWeapon(playerid, 24, 200);
                            GivePlayerWeapon(playerid, 30, 200);
                            GivePlayerWeapon(playerid, 37, 200);


                    }
                            else
                    {
                        SendClientMessage(playerid, COLOR_RED, "You need to be atleast Captain class [/rank to see yours]");
                        TogglePlayerControllable(playerid, 0);
                    }
                }
                return 1;
        }
return 1;
}
But when i spawn my player freeze and do not Move. But it show dialogue. And it is giving warning
pawn Код:
D:\UDC Wars\gamemodes\Wars.pwn(1402) : warning 235: public function lacks forward declaration (symbol "OnDialogsResponse")
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
Please How to do it great. Because i need class system for my server...
Reply
#2

change

pawn Код:
public OnDialogsResponse(playerid, dialogid, response, listitem, inputtext[])
to

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
your OnDialogResponse has 's'
Reply
#3

but ti says it already defined. And why my player don't move??
Reply
#4

Delete the another OnDialogResponse then put this on your OnDialogResponse

Make sure you also copy/paste the code that the other OnDialogResponse have so incase you need it you just need to put it on your OnDialogResponse

pawn Код:
if(dialogid == 1)
{
    if(response)
    {
        if(GetPlayerScore(playerid) <= 0)//Private
        {
            SetPlayerSkin(playerid, 287);
            SendClientMessage(playerid, COLOR_BLUE, "You chose the assault as your class.");
            SendClientMessage(playerid, COLOR_BLUE, "You can type /switchclass to change your class again.");
            gPlayerClass[playerid] = ASSAULT_CLASS;
            PickedClass[playerid] = 1;
            SetPlayerVirtualWorld(playerid, 0);
            TogglePlayerControllable(playerid, 1);
            GivePlayerWeapon(playerid, 24, 200);
            GivePlayerWeapon(playerid, 31, 500);
            GivePlayerWeapon(playerid, 17, 5);
        }
    }
    if(listitem == 1)//sniper DONE
    {
        if(GetPlayerScore(playerid) <= 10)//Private
        {
            SetPlayerSkin(playerid, 122);
            SendClientMessage(playerid, COLOR_BLUE, "You chose the Sniper as your class.");
            SendClientMessage(playerid, COLOR_BLUE, "You can type /switchclass to change your class again.");
            gPlayerClass[playerid] = SNIPER_CLASS;
            PickedClass[playerid] = 1;
            SetPlayerVirtualWorld(playerid, 0);
            TogglePlayerControllable(playerid, 1);
            GivePlayerWeapon(playerid, 23, 500);
            GivePlayerWeapon(playerid, 34, 100);
            GivePlayerWeapon(playerid, 29, 200);
        }
        else
        {
                SendClientMessage(playerid, COLOR_RED, "You need to be atleast Private class [/rank to see yours]");
                TogglePlayerControllable(playerid, 0);
        }
    }
    if(listitem == 3)//Engineer
    {
        if(GetPlayerScore(playerid) <= 250)//Sergeant
        {
            SetPlayerSkin(playerid, 285);
            SendClientMessage(playerid, COLOR_BLUE, "You chose the Engineer as your class.");
            SendClientMessage(playerid, COLOR_BLUE, "You can type /switchclass to change your class again.");
            gPlayerClass[playerid] = ENGINEER_CLASS;
            PickedClass[playerid] = 1;
            SetPlayerVirtualWorld(playerid, 0);
            TogglePlayerControllable(playerid, 1);
            GivePlayerWeapon(playerid, 22, 100);
            GivePlayerWeapon(playerid, 32, 500);
            GivePlayerWeapon(playerid, 35, 5);
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You need to be atleast Sergeant class [/rank to see yours]");
            TogglePlayerControllable(playerid, 0);
        }
    }
    if(listitem == 4)//FlameThrower
    {
        if(GetPlayerScore(playerid) <= 400)//CAPTAIN
        {
            SetPlayerSkin(playerid, 144);
            SendClientMessage(playerid, COLOR_BLUE, "You chose the Jet Trooper as your class.");
            SendClientMessage(playerid, COLOR_BLUE, "You can type /switchclass to change your class again.");
            gPlayerClass[playerid] = JETTROOPER_CLASS;
            PickedClass[playerid] = 1;
            SetPlayerVirtualWorld(playerid, 0);
            TogglePlayerControllable(playerid, 1);
            GivePlayerWeapon(playerid, 24, 200);
            GivePlayerWeapon(playerid, 30, 200);
            GivePlayerWeapon(playerid, 37, 200);
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "You need to be atleast Captain class [/rank to see yours]");
            TogglePlayerControllable(playerid, 0);
        }
    }
    return 1;
}
Reply
#5

Thnx soo much. Rep added.
Brother one more thing i want when player gets sniper class than he will invisible on map and when he get pilot than he can driver planes.... How can i?
Reply
#6

For pilot you need to make a team for it like :gTeam[playerid]=TEAM_PILOT;
Then if player enters plane make:
Код:
if(gTeam[playerid]!=TEAM_PILOT)
{
SendClientMessage(playerid,COLOR_RED,"Only pilots can fly in a plane!");
return 1;
}
Reply
#7

aND FOR SNIPER??
Reply
#8

That is example only here is one good example (the one you looking for)

pawn Код:
stock ShowPlayerMarkerForPilot(playerid)
{
    for(new i = 0; i < MAX_PLAYERS; i++) {
        if(IsPlayerConnected(i) == 1) {
            if(gTeam[playerid] == TEAM_PILOT) {
                if(gTeam[i] == TEAM_PILOT) return SetPlayerMarkerForPlayer(i, playerid, GetPlayerColor(playerid));
            }
        }
    }
}
Now you can see your team mate player marker that is if you are pilot.

Modify the stock duplicate it then change the code all credits goes to me

if you didn't set player color the color will be black (as a return) so use SetPlayerColor before testing the stock
Reply
#9

// Make the players marker invisible to the player while keeping chat colour the same. Will only work correctly if SetPlayerColor has been used:
SetPlayerMarkerForPlayer( 42, 1, ( GetPlayerColor( 1 ) & 0xFFFFFF00 ) );
Reply
#10

Quote:
Originally Posted by iOmar
Посмотреть сообщение
Thnx soo much. Rep added.
Brother one more thing i want when player gets sniper class than he will invisible on map and when he get pilot than he can driver planes.... How can i?
Add this in the sniper class section
RemovePlayerMapIcon(playerid);
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)