[HELP] AddPlayerClass
#1

Ok. I want it to show "Grove" if the class in on one of the Grove selections. I want it to show "Unity" if it is on one of the Unity selections. I want it to show "Ballas" if it is on one of the Ballas selections. And I want it to show "Police" if it is on one of the Police selections. Please help, as I am not sure how to do it. I currently have this:
pawn Код:
//  Unity Classes
    AddPlayerClass(115, 1766.5635,-1847.7111,13.5781,183.4783, 24, 100, 27, 100, 34, 100); // Unity Class 1
    AddPlayerClass(33, 1766.5635,-1847.7111,13.5781,183.4783, 24, 100, 27, 100, 34, 100); // Unity Class 2
    AddPlayerClass(53, 1766.5635,-1847.7111,13.5781,183.4783, 24, 100, 27, 100, 34, 100); // Unity Class 3
//  Grove Classes
    AddPlayerClass(105,2504.0347,-1652.5273,13.5938,140.7401, 24, 100, 27, 100, 34, 100); // Grove Class 1
    AddPlayerClass(106,2512.7522,-1675.1533,13.5483,80.8929, 24, 100, 27, 100, 34, 100); // Grove Class 2
    AddPlayerClass(107,2504.1245,-1685.8965,13.5469,44.8592, 24, 100, 27, 100, 34, 100); // Grove Class 3
// Ballas Classes
    AddPlayerClass(102,2055.9773,-1192.9594,23.7984,267.8276, 24, 100, 27, 100, 34, 100); // Ballas Class 1
    AddPlayerClass(103,2055.5042,-1167.6951,23.7719,270.9610, 24, 100, 27, 100, 34, 100); // Ballas Class 2
    AddPlayerClass(104,2055.7559,-1151.1599,23.7852,270.9610, 24, 100, 27, 100, 34, 100); // Ballas Class 3
// PD Classes
    AddPlayerClass(280,1578.6930,-1694.5786,6.2188,186.0260, 24, 100, 27, 100, 34, 100); // PD Class 1
    AddPlayerClass(283,1572.8768,-1694.2316,6.2188,172.5525, 24, 100, 27, 100, 34, 100); // PD Class 2
    AddPlayerClass(288,1566.6099,-1693.9060,5.8906,171.6125, 24, 100, 27, 100, 34, 100); // PD Class 3
    AddPlayerClass(285,1561.4171,-1693.9485,5.8906,177.2525, 24, 100, 27, 100, 34, 100); // PD Class 4
Reply
#2

Bump.
Reply
#3

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(classid == 0)
    {
        GameTextForPlayer(playerid,"~r~ Unity",1000,4);
    }
    if(classid == 4)
    {
        GameTextForPlayer(playerid,"~G~ Grove",1000,4);
    }
    if(classid == 7)
    {
        GameTextForPlayer(playerid,"~P~ Ballas",10000,4);
    }
    if(classid == 10) {
        GameTextForPlayer(playerid,"~b~ Police",10000,4);
    }
    return 1;
}
Reply
#4

Don't bump after 20 minutes.

I'll write a quick system for you that will be easy to use, give me 10 minutes..

@SnG.Scot_MisCuDI: https://sampforum.blast.hk/showthread.php?tid=57018 see 'assumptions'.
Reply
#5

this is taken from the example script "rivershell" with the server


pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetupPlayerForClassSelection(playerid);
    SetPlayerTeamFromClass(playerid,classid);
   
    if(classid == 0 || classid == 1) {
        GameTextForPlayer(playerid,"~g~GREEN ~w~TEAM",1000,5);
    } else if(classid == 2 || classid == 3) {
        GameTextForPlayer(playerid,"~b~BLUE ~w~TEAM",1000,5);
    }
   
    return 1;
}
i would use a switch case though
Reply
#6

@Jonny5: https://sampforum.blast.hk/showthread.php?tid=57018 see 'assumptions'.

Here's an example, using an array. Note that I haven't tested this:

http://pastebin.com/r9jfYJUf

Remove all other AddPlayerClass lines from your mode as it will fuck this up, put your data in to the array in this format:

pawn Код:
{"NAME", skin, x, y, z, angle, weapon1, ammo1, weapon2, ammo2, weapon3, ammo3},
Reply
#7

Quote:
Originally Posted by SnG.Scot_MisCuDI
Посмотреть сообщение
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(classid == 0)
    {
        GameTextForPlayer(playerid,"~r~ Unity",1000,4);
    }
    if(classid == 4)
    {
        GameTextForPlayer(playerid,"~G~ Grove",1000,4);
    }
    if(classid == 7)
    {
        GameTextForPlayer(playerid,"~P~ Ballas",10000,4);
    }
    if(classid == 10) {
        GameTextForPlayer(playerid,"~b~ Police",10000,4);
    }
    return 1;
}
Thanks!
Reply
#8

@dubya, listen to MP2 not my code.

Quote:
Originally Posted by MP2
Посмотреть сообщение
@Jonny5: https://sampforum.blast.hk/showthread.php?tid=57018 see 'assumptions'.

Here's an example, using an array. Note that I haven't tested this:

http://pastebin.com/r9jfYJUf

Remove all other AddPlayerClass lines from your mode as it will fuck this up, put your data in to the array in this format:

pawn Код:
{"NAME", skin, x, y, z, angle, weapon1, ammo1, weapon2, ammo2, weapon3, ammo3},
Reply
#9

Quote:
Originally Posted by MP2
Посмотреть сообщение
@Jonny5: https://sampforum.blast.hk/showthread.php?tid=57018 see 'assumptions'.

Here's an example, using an array. Note that I haven't tested this:

http://pastebin.com/r9jfYJUf

Remove all other AddPlayerClass lines from your mode as it will fuck this up, put your data in to the array in this format:

pawn Код:
{"NAME", skin, x, y, z, angle, weapon1, ammo1, weapon2, ammo2, weapon3, ammo3},
LOL i love how you link me to something you should read too,
your code makes the same assumptions but you have an array and enum.....

using
new var gCJ = AddStaticClass(....)

and checking the class == gCJ is the way not to assume



your code is in jeopardy of a array out of bounds,
because you assume no other scripts add a class.
Reply
#10

What on earth are you talking about? The only assumption I made is that there are no other classes added on the server, which in doing so saves memory by not needing variables. You don't need two systems, you just use mine. It's an okay assumption to make and if the user doesn't follow it it's his own fault for not doing what should be done as stated by me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)