SA-MP Forums Archive
2 Questions on 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: 2 Questions on OnPlayerRequestClass (/showthread.php?tid=342622)



2 Questions on OnPlayerRequestClass - Neil. - 14.05.2012

1st question

How do I do that when instead a Player chooses class through the normal class selection menu, instead I want a dialog based?

like

Код:
ShowPlayerDialog(playerid,57,DIALOG_STYLE_LIST,"Class Select","Trucker\nBus Driver\nBoat Man\nPolice","Select", "");
then ofcourse, each class has it's own skin and has a score required like for example

Dialog:
Код:
Class Select:
Trucker - 0 Score
Bus Driver - 30 Score
Boat Man - 60 Score
Police - 100 Score
That brings us to the next question
Question number 2:
How do I implement a required score on class selection?

like the following:

Dialog:
Код:
Class Select:
Trucker - 0 Score
Bus Driver - 30 Score
Boat Man - 60 Score
Police - 100 Score
Do I need to use
Код:
if(GetPlayerScore) > 0
or something like that?, can you cite an example of how or where do i implement the score requirement on class selection?


Re: 2 Questions on OnPlayerRequestClass - TheDominator - 14.05.2012

You could try doing this:

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SpawnPlayer(playerid);
    return 1;
}
And then between the SpawnPlayer and return 1; add your dialog system. That should work but haven't been able to test it.


Re: 2 Questions on OnPlayerRequestClass - Neil. - 14.05.2012

Quote:
Originally Posted by TheDominator
Посмотреть сообщение
You could try doing this:

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SpawnPlayer(playerid);
    return 1;
}
And then between the SpawnPlayer and return 1; add your dialog system. That should work but haven't been able to test it.
Yes thank you it works. But one problem (sorry for being a noob), the arrows and spawn select on the bottom, how do I remove it?


Re: 2 Questions on OnPlayerRequestClass - TheDominator - 14.05.2012

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
   TogglePlayerSpectating(playerid, 1);
   return 1;
}

public OnPlayerSpawn(playerid)
{
   TogglePlayerSpectating(playerid, 0);
   return 1;
}
This should remove it, also I haven't tried this either but I heard it's worth a shot.


Re: 2 Questions on OnPlayerRequestClass - Neil. - 15.05.2012

Quote:
Originally Posted by TheDominator
Посмотреть сообщение
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
   TogglePlayerSpectating(playerid, 1);
   return 1;
}

public OnPlayerSpawn(playerid)
{
   TogglePlayerSpectating(playerid, 0);
   return 1;
}
This should remove it, also I haven't tried this either but I heard it's worth a shot.
It does work but, I can't choose a class anymore from the dialog (once i choose which one from the dialog, nothing happens)


Re: 2 Questions on OnPlayerRequestClass - TheDominator - 15.05.2012

Have you linked any responses to it for when your changing the classes because if you haven't it wouldn't work either way.


Re: 2 Questions on OnPlayerRequestClass - Neil. - 16.05.2012

Quote:
Originally Posted by TheDominator
Посмотреть сообщение
Have you linked any responses to it for when your changing the classes because if you haven't it wouldn't work either way.
Yes ofcourse


Re: 2 Questions on OnPlayerRequestClass - $$inSane - 16.05.2012

simple
add the class dialog in OnPlayerConnect(playerid) and put if(GetPlayerScore(playerid)>0; in dialog respose of class selection