SA-MP Forums Archive
Class selection HELP [ 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: Class selection HELP [ REP + ] (/showthread.php?tid=578603)



Class selection HELP [ REP + ] - _GHT_MarK445 - 20.06.2015

Hey guys, I have this:

Код:
new Guard;
then i am determinating the "Guard" into certain AddPlayerClasses, which are guarders skins:

Код:
Guard = AddPlayerClass(163, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
	Guard = AddPlayerClass(164, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
And finally, in OnPlayerRequestClass i am checking it, and doing actions:

Код:
	if(classid == Guard && PlayerInfo[playerid][pScore] < 5000)
	{
		SendClientMessage(playerid, COLOR_ORANGE, "[ Server ] You do not have enough points to play guarder!");
		return 0;
	}
But.. the thing is that even if my pScore is 0 i can choose guarder class and also no message showes up, what can be the problem?

Thanks.


Re: Class selection HELP [ REP + ] - Dusan01 - 20.06.2015

try this code:
Код:
if(classid == Guard && PlayerInfo[playerid][pScore] < 5000)
	{
		SendClientMessage(playerid, COLOR_ORANGE, "[ Server ] You do not have enough points to play guarder!");
		return 1;
	}



Re: Class selection HELP [ REP + ] - _GHT_MarK445 - 20.06.2015

It does not work still.


Re: Class selection HELP [ REP + ] - Dusan01 - 20.06.2015

Then delete that variable Guard and add that classes without it. Then try this code:
pawn Код:
if((classid == 163 && classid == 164) && PlayerInfo[playerid][pScore] < 5000)
    {
        SendClientMessage(playerid, COLOR_ORANGE, "[ Server ] You do not have enough points to play guarder!");
        return 0;
    }
if this is not working give me whole public OnPlayerRequestClass


Re: Class selection HELP [ REP + ] - _GHT_MarK445 - 20.06.2015

Still aint working.


Re: Class selection HELP [ REP + ] - Dusan01 - 20.06.2015

can u give me whole OnPlayerRequestClass and OnPlayerRequestSpawn


Re: Class selection HELP [ REP + ] - _GHT_MarK445 - 20.06.2015

What the hell are you talking about bro? This is everything i have in OnPlayerRequestClass.

And I am not using OnPlayerRequestSpawn.


Re: Class selection HELP [ REP + ] - Dusan01 - 20.06.2015

then try by this way: add new varaible at top:
Код:
new gTeam[MAX_PLAYERS];
new guard1;
new giard2;
ongamemodeinit:
Код:
guard1 = AddPlayerClass(163, 1963.3783, 1342.1572, 16.3746, 269.1425, 0, 0, 0, 0, 0, 0);
guard2 = AddPlayerClass(164, 1963.3783, 1342.1572, 16.3746, 269.1425, 0, 0, 0, 0, 0, 0);
add OnPlayerRequestClass like this:
Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerTeamFromClass(playerid,classid);
	return 1;
}

SetPlayerTeamFromClass(playerid, classid)
{
 	if(classid == guard1 || classid == guard2)
	{
		gTeam[playerid] = 9;
	}
return 1;
}
then on public OnPlayerRequestSpawn add this:
Код:
public OnPlayerRequestSpawn(playerid)
{
if(gTeam[playerid] == 9)
{
    if(PlayerInfo[playerid][pScore] < 5000)
	{
            SendClientMessage(playerid, COLOR_ORANGE, "[ Server ] You do not have enough points to play guarder!");
            return 0;
	}
}
return 1;
}



Re: Class selection HELP [ REP + ] - _GHT_MarK445 - 20.06.2015

I am already using me pre-defined teams, i do not need to define new ones.

Please, if you can not help, just dont write anything, i want to wait for REAL helper, thanks.


Re: Class selection HELP [ REP + ] - Dusan01 - 20.06.2015

Quote:
Originally Posted by _GHT_MarK445
Посмотреть сообщение
I am already using me pre-defined teams, i do not need to define new ones.

Please, if you can not help, just dont write anything, i want to wait for REAL helper, thanks.
Ok dude, im sorry for trying to help u, i just give u an example of code witch is working u have it above u can even check it: http://pastebin.com/5rHgNF39