SA-MP Forums Archive
one hard question [+rep] - 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: one hard question [+rep] (/showthread.php?tid=333681)



one hard question [+rep] - mineralo - 12.04.2012

well, I working on my server and when log every player have to choose job skin but sometimes there are noobs and don't know what skin they should took ( its written ) and I have a question:
how to do when player log in show skins which is availables for it !
some codes:
pawn Код:
public OnGameModeInit();
{
AddPlayerClassEx(TEAM_CITIZEN,2,2321.7683,-2078.6880,13.5469,91.7119,1,1,0,0,0,0);
    AddPlayerClassEx(TEAM_CITIZEN,55,2321.7683,-2078.6880,13.5469,91.7119,1,1,0,0,0,0);
    AddPlayerClassEx(TEAM_COP,280,1553.2623,-1675.2860,16.1953,92.7704,3,1,0,0,0,0);
    AddPlayerClassEx(TEAM_COP,282,1553.2623,-1675.2860,16.1953,92.7704,3,1,0,0,0,0);
    AddPlayerClassEx(TEAM_CRIMINAL,29,2748.2466,-2448.6731,13.6484,166.0463,5,1,0,0,0,0);
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
        SetPlayerPos(playerid,1133.0504,-2038.4034,69.1000);
        SetPlayerFacingAngle(playerid,0.0);
        SetPlayerCameraPos(playerid,1133.0504,-2035.4034,69.1000);
        SetPlayerCameraLookAt(playerid,1133.0504,-2038.4034,69.1000);
        if(GetPlayerJobID(playerid) == 1)
        {
        GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~w~Citizen",50000, 3);
        }
        else if(GetPlayerJobID(playerid) == 2)
        {
        GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~b~Police Officer",50000, 3);
        }
        else if(GetPlayerJobID(playerid) == 3)
        {
        GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~r~Criminal",50000, 3);
        }
return 1;
}
any ideas?


Re: one hard question [+rep] - SomebodyAndMe - 12.04.2012

Try to add cases to it:

case 1,2,3:
policeofficer

And somehwhere in the beginning: AddPlayerClass(blabla,blabla,blabla); // case 1
Continue doing that. should work, worked fine for me.

pawn Код:
public OnGameModeInit();
{
    AddPlayerClassEx(TEAM_CITIZEN,2,2321.7683,-2078.6880,13.5469,91.7119,1,1,0,0,0,0); //case 1
    AddPlayerClassEx(TEAM_CITIZEN,55,2321.7683,-2078.6880,13.5469,91.7119,1,1,0,0,0,0);
    AddPlayerClassEx(TEAM_COP,280,1553.2623,-1675.2860,16.1953,92.7704,3,1,0,0,0,0);
    AddPlayerClassEx(TEAM_COP,282,1553.2623,-1675.2860,16.1953,92.7704,3,1,0,0,0,0);
    AddPlayerClassEx(TEAM_CRIMINAL,29,2748.2466,-2448.6731,13.6484,166.0463,5,1,0,0,0,0);
    return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
        SetPlayerPos(playerid,1133.0504,-2038.4034,69.1000);
        SetPlayerFacingAngle(playerid,0.0);
        SetPlayerCameraPos(playerid,1133.0504,-2035.4034,69.1000);
        SetPlayerCameraLookAt(playerid,1133.0504,-2038.4034,69.1000);
        if(GetPlayerJobID(playerid) == 1)
        {
            case 1,2:
            {
                GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~w~Citizen",50000, 3);
            }
        }
        else if(GetPlayerJobID(playerid) == 2)
        {
            case 3,4:
            {
                GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~b~Police Officer",50000, 3);
            }
        }
        else if(GetPlayerJobID(playerid) == 3)
        {
            case 5:
            {
                GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~r~Criminal",50000, 3);
            }
        }
    return 1;
}
Not tested


Re: one hard question [+rep] - mineralo - 12.04.2012

not working
any body else?


Re: one hard question [+rep] - Jochemd - 12.04.2012

GetPlayerJobID? You must be talking shit. Also you're using 'cases' and you haven't even used switch?

You got to do it like this

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    switch(classid)
    {
        case 0, 1: // Class the player is currently seeing is ID 0 (Citizen) or ID 1 (Citizen)
        {
            GameTextForPlayer(playerid,"Citizen",50000,3);
        }
        case 2, 3: // Class the player is currently seeing is ID 2 (Cop) or ID 3 (Cop)
        {
            GameTextForPlayer(playerid,"Cop",50000,3);
        }
        case 4: // Class the player is currently seeing is ID 4 (Criminal)
        {
            GameTextForPlayer(playerid,"Citizen",50000,3);
        }
    }
    return 1;
}



Re: one hard question [+rep] - mineralo - 12.04.2012

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
GetPlayerJobID? You must be talking shit. Also you're using 'cases' and you haven't even used switch?

You got to do it like this

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    switch(classid)
    {
        case 0, 1: // Class the player is currently seeing is ID 0 (Citizen) or ID 1 (Citizen)
        {
            GameTextForPlayer(playerid,"Citizen",50000,3);
        }
        case 2, 3: // Class the player is currently seeing is ID 2 (Cop) or ID 3 (Cop)
        {
            GameTextForPlayer(playerid,"Cop",50000,3);
        }
        case 4: // Class the player is currently seeing is ID 4 (Criminal)
        {
            GameTextForPlayer(playerid,"Citizen",50000,3);
        }
    }
    return 1;
}
man, I don't need it, I had it before, I mean when player have to choose a skin he can take only 2 skin which his job has, like:
I've citizen job and I can choose only 0 and 1 but others skins I can't see, understood?


Re: one hard question [+rep] - mineralo - 12.04.2012

any one? I need it !


Re: one hard question [+rep] - mineralo - 12.04.2012

maybe there are somehow limit show player classid>?


Re: one hard question [+rep] - Marco_Valentine - 12.04.2012

under: OnGameModeInit()
pawn Код:
AddPlayerClass(SKIN, ClassPos, ClassAngle, 0, 0, 0, 0, 0, 1);
    AddPlayerClass(SKIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
    AddPlayerClass(SKIN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1); //Change SKIN to the skin Id's

uner: OnPlayerRequestClass(playerid)
pawn Код:
if(classid == 0) //The amount of player classes you have added above (3)
    {
        SetPlayerPos(playerid,1133.0504,-2038.4034,69.1000);
        SetPlayerFacingAngle(playerid,0.0);
        SetPlayerCameraPos(playerid,1133.0504,-2035.4034,69.1000);
        SetPlayerCameraLookAt(playerid,1133.0504,-2038.4034,69.1000);
        gTeam[playerid] = TEAM_POLICE;
        GameTextForPlayer(playerid, "Police!", 4000, 6);
    SetPlayerColor(playerid,COLOR); //Change COLOR to the players team color
    }
        if(classid == 1) //The amount of player classes you have added above (3)
    {
        SetPlayerPos(playerid,1133.0504,-2038.4034,69.1000);
        SetPlayerFacingAngle(playerid,0.0);
        SetPlayerCameraPos(playerid,1133.0504,-2035.4034,69.1000);
        SetPlayerCameraLookAt(playerid,1133.0504,-2038.4034,69.1000);
        gTeam[playerid] = TEAM_CITIZEN;
        GameTextForPlayer(playerid, "Citizen!", 4000, 6);
    SetPlayerColor(playerid,COLOR); //Change COLOR to the players team color
    }
        if(classid == 2) //The amount of player classes you have added above (3)
    {
        SetPlayerPos(playerid,1133.0504,-2038.4034,69.1000);
        SetPlayerFacingAngle(playerid,0.0);
        SetPlayerCameraPos(playerid,1133.0504,-2035.4034,69.1000);
        SetPlayerCameraLookAt(playerid,1133.0504,-2038.4034,69.1000);
        gTeam[playerid] = TEAM_CRIMINAL;
        GameTextForPlayer(playerid, "Criminal!", 4000, 6);
    SetPlayerColor(playerid,COLOR); //Change COLOR to the players team color
    }
this should give you an idea


Re: one hard question [+rep] - mineralo - 12.04.2012

MAN, ITS IS GOOD BUT I DON'T NEED IT
I want when player choose the fuckin' skin from Requestion Class its should show only some skins NOT ALL WHAT WAS DEFINED on game mode


Re: one hard question [+rep] - mineralo - 13.04.2012

any ideas?