OnPlayerRequestClass Help - 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: OnPlayerRequestClass Help (
/showthread.php?tid=457086)
OnPlayerRequestClass Help -
NinjahZ - 09.08.2013
I have my own TDM script
but OnPlayerRequestClass has team selection dialog
and when I die,it uses OnPlayerRequestClass,how do I stop this?
I know it has something to do with OnPlayerDeath,but there is nothing assigned for when you die goto forceclassselection
Re: OnPlayerRequestClass Help -
DRIFT_HUNTER - 09.08.2013
Search for a function named
Thats how you force player to chose class again after death
Re: OnPlayerRequestClass Help -
Iron3man - 09.08.2013
Код:
//add this
new PickedClass[MAX_PLAYERS] = 0;
//under OnPlayerRequestSpawn
if(PickedClass[playerid] == 0 ) {
ShowPlayerDialog(playerid, 500, DIALOG_STYLE_LIST, "Classes", "Assault - Rank 0\nSniper - Rank 0\nPilot - Rank 3\nEngineer - rank 5\nFlameThrower - Rank 8\nMedic - Rank 4", "Select", "Cancel");
}
// under onplayerconnect
PickedClass[playerid] = 0;
//under onplayerspawn
if(PickedClass[playerid] == 0 ) {
ShowPlayerDialog(playerid, 500, DIALOG_STYLE_LIST, "Classes", "Assault - Rank 0\nSniper - Rank 0\nPilot - Rank 3\nEngineer - rank 5\nFlameThrower - Rank 8\nMedic - Rank 4", "Select", "Cancel");
}
//under ondialogresponse
add PickedClass[playerid] = 1;
like this
if(dialogid == 500)
{
if(response)
{
if(GetPlayerScore(playerid) >= 0)//Rookie
{
gPlayerClass[playerid] = ASSAULT_CLASS;
SendClientMessage(playerid, COLOR_GREEN, "You chose the Assualt as your class.");
SendClientMessage(playerid, COLOR_GREEN, "You can type /sc to change your class again.");
PickedClass[playerid] = 1;
}
}
Now if you want to forceclassselection then you can do PickedClass[playerid] = 0;
And not want it, then you can do PickedClass[playerid] = 1;
example
CMD:sc(playerid, params[]) {
PickedClass[playerid] = 0;
SendClientMessage(playerid, COLOR_ORANGE, "You will pick your new class next death...");
return 1;
}
Is this help you?
Re: OnPlayerRequestClass Help -
NinjahZ - 09.08.2013
No,I want to stop my dialog showing up once I die,I have not got ForceClassSelection anywhere in my script.
Re: OnPlayerRequestClass Help -
Iron3man - 09.08.2013
Pls read it carefully
under OnDialogResponse
Код:
if(dialogid == 500)
{
if(response)
{
if(GetPlayerScore(playerid) >= 0)//Rookie
{
gPlayerClass[playerid] = ASSAULT_CLASS;
SendClientMessage(playerid, COLOR_GREEN, "You chose the Assualt as your class.");
SendClientMessage(playerid, COLOR_GREEN, "You can type /sc to change your class again.");
PickedClass[playerid] = 1;
}
}
You have to add PickedClass[playerid] = 1; when player chose his class
Re: OnPlayerRequestClass Help -
NinjahZ - 09.08.2013
Thanks man +rep,just compiled