SA-MP Forums Archive
problem with OnPlayerRequestClass - 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: problem with OnPlayerRequestClass (/showthread.php?tid=433934)



problem with OnPlayerRequestClass - verlaj - 30.04.2013

this code should suppose to work but it didn't worked

pawn Код:
new Map1[MAX_PLAYERS];
new Map2[MAX_PLAYERS];

public OnPlayerRequestClass(playerid, classid)
{
    if(Map1[playerid] == 1)
    {
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Teams", "Assualters\nDefenders", "Select","");
    }
    else if(Map2[playerid] == 1)
    {
        ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "Teams", "Assualters\nDefenders", "Select","");
    }
    return 1;
}
it don't even give me any compile error


Re: problem with OnPlayerRequestClass - Pottus - 30.04.2013

Because your variables are both zero.


Re: problem with OnPlayerRequestClass - RVRP - 30.04.2013

Your code does absolutely nothing. The value of Map1 and Map2 is going to be zero until you assign it some other value.


Re: problem with OnPlayerRequestClass - verlaj - 30.04.2013

the problem could be with Map1 and Map2 stuff, it usually works if i only write ShowPlayerDialog, it seems i need to create new function for that


Re : problem with OnPlayerRequestClass - lelemaster - 30.04.2013



Quote:
Originally Posted by verlaj
Посмотреть сообщение
the problem could be with Map1 and Map2 stuff, it usually works if i only write ShowPlayerDialog, it seems i need to create new function for that
No, you only need to assing a value to Map1 or Map2 for someone in the script, usually before OnPlayerRequestClass, so it's in OnPlayerConnect.

Example:

Map1[playerid] = 1;
or
Map2[playerid] = 1;

Also, what are you trying to do? Making the player choose a team ?
If yes, you don't need that variable. You only need to show 1 dialog and ask the player which team you want.
Then in on player dialog you'll set up the variable of the team.

Edit: Sorry, I didn't mean to say noob, I wanted to say need.


Re: problem with OnPlayerRequestClass - Pottus - 30.04.2013

Would also like to add, as simple as it is your over thinking the problem here if your repeating code Picard disapproves.


Re: problem with OnPlayerRequestClass - verlaj - 30.04.2013

-_-

lelemaster, i did

Map1[playerid] = 1;
and
Map2[playerid] = 1; (timer) but forget to complie and save the pwn.

btw what you mean by


Quote:
Originally Posted by lelemaster
Посмотреть сообщение
Also, what are you trying to do? Making the player choose a team ?
If yes, you don't need that variable. You only noob to show 1 dialog and ask the player which team you want.
Then in on player dialog you'll set up the variable of the team.
please don't call me noob. and for god shake, try to use your brain by a bit(read the problem and the pawn codes properly), its a custom map stuff.