problem with OnPlayerRequestClass
#1

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
Reply
#2

Because your variables are both zero.
Reply
#3

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

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
Reply
#5



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.
Reply
#6

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

-_-

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)