Scripting question
#1

pawn Код:
public OnGameModeInit()
{
    SetGameModeText("Role Play");
    AddPlayerClass(2, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(265, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(287, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
   
    return 1;
}
//===============================================================
public OnPlayerRequestClass(playerid, classid)
{
    Class[playerid] = classid;
    SetPlayerInterior(playerid,3);
    SetPlayerPos(playerid,944.99,-41.64,1001.77);
    SetPlayerFacingAngle(playerid,180.0);
    SetPlayerCameraPos(playerid,944.69,-47.54,1001.12);
    SetPlayerCameraLookAt(playerid,944.99,-41.64,1001.77);
    if(classid == 0)
    {
        SetPlayerTeamFromClass(playerid, classid);
        GameTextForPlayer(playerid,"~w~CIVILIAN",1000,4);
    }
    if(classid == 1)
    {
        SetPlayerTeamFromClass(playerid, classid);
        GameTextForPlayer(playerid,"~b~COP",1000,4);
    }
    if(classid == 2)
    {
        SetPlayerTeamFromClass(playerid, classid);
        GameTextForPlayer(playerid,"~g~ARMY",1000,4);
    }
    return 1;
}
//==================================================
I want to add multiple skins for every class, with the Game text showing, How?
Reply
#2

Anyone help?
Reply
#3

I think You could addmore by adding more addplayerclass.
And for gametext,
You can show it under OnPlayerRequestClass.
Reply
#4

Let's say you have
pawn Код:
AddPlayerClass(2, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); //classid 0
    AddPlayerClass(265, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(287, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(294, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0); //classid 3
Now for an example, let's say you want classid 0 and 3 to be 'Civilians':
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    Class[playerid] = classid;
    SetPlayerInterior(playerid,3);
    SetPlayerPos(playerid,944.99,-41.64,1001.77);
    SetPlayerFacingAngle(playerid,180.0);
    SetPlayerCameraPos(playerid,944.69,-47.54,1001.12);
    SetPlayerCameraLookAt(playerid,944.99,-41.64,1001.77);
    if(classid == 0 || classid == 3)
    {
        SetPlayerTeamFromClass(playerid, classid);
        GameTextForPlayer(playerid,"~w~CIVILIAN",1000,4);
    }
    if(classid == 1)
    {
        SetPlayerTeamFromClass(playerid, classid);
        GameTextForPlayer(playerid,"~b~COP",1000,4);
    }
    if(classid == 2)
    {
        SetPlayerTeamFromClass(playerid, classid);
        GameTextForPlayer(playerid,"~g~ARMY",1000,4);
    }
    return 1;
}
Or alternatively, you could use:
pawn Код:
switch(classid)
{
    case 0, 3:
    {
        GameTextForPlayer(playerid,"~w~CIVILIAN",1000,4);
    }
    case 1:
    {
        GameTextForPlayer(playerid,"~b~COP",1000,4);
    }
    case 2:
    {
        GameTextForPlayer(playerid,"~g~ARMY",1000,4);
    }
}
SetPlayerTeamFromClass(playerid, classid);
And change your function like so:
pawn Код:
stock SetPlayerTeamFromClass(playerid, classid)
{
    switch(classid)
    {
        case 0, 3:
        {
            gTeam[playerid] = TEAM_CIV; //Considering the fact if you have defines at the top.
        }
        case 1:
        {
            gTeam[playerid] = TEAM_COP;
        }
        case 2:
        {
            gTeam[playerid] = TEAM_ARMY;
        }
    }
    return 1;
}
You will need to have:
pawn Код:
new gTeam[MAX_PLAYERS];
#define TEAM_CIV 0
#define TEAM_COP 1
#define TEAM_ARMY 2
At the top of your script, in the respective position.
Reply
#5

Like?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)