Custom class selection - 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: Custom class selection (
/showthread.php?tid=387237)
Custom class selection -
Hade. - 23.10.2012
Hey, im starting a new FUN server but i will need a little help with the beginning and the class choosing i havent found any tutorial on that maybe someone would help me just pu a few example skind and something and i will continiue later.
Re: Custom class selection -
HyDrAtIc - 23.10.2012
https://sampwiki.blast.hk/wiki/PAWN_for_Beginners
This will help you.
Re: Custom class selection -
Eminem 2ka9 - 23.10.2012
Add this to top of script
pawn Код:
new gPlayerClass[MAX_PLAYERS];
new PickedClass[MAX_PLAYERS] = 0;
Add this to the bottom of your script.
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 10)
{
if(response)
{
if(GetPlayerScore(playerid) <= 0)//Private
{
gPlayerClass[playerid] = ASSAULT_CLASS;
PickedClass[playerid] = 1;
GivePlayerWeapon(playerid, 24, 200);
GivePlayerWeapon(playerid, 31, 500);
GivePlayerWeapon(playerid, 17, 5);
}
}
}
if(listitem == 1)//sniper DONE
{
if(GetPlayerScore(playerid) <= 10)//Private
{
gPlayerClass[playerid] = SNIPER_CLASS;
PickedClass[playerid] = 1;
GivePlayerWeapon(playerid, 23, 500);
GivePlayerWeapon(playerid, 34, 100);
GivePlayerWeapon(playerid, 29, 200);
}
else
{
}
}
if(listitem == 2)//pilot DONE
{
if(GetPlayerScore(playerid) <= 1150)//Lieutenant Colonel
{
gPlayerClass[playerid] = AIRMAN_CLASS;
PickedClass[playerid] = 1;
GivePlayerWeapon(playerid, 22, 50);
GivePlayerWeapon(playerid, 29, 500);
GivePlayerWeapon(playerid, 16, 5);
}
else
{
}
}
if(listitem == 3)//Engineer
{
if(GetPlayerScore(playerid) <= 250)//Sergeant
{
gPlayerClass[playerid] = ENGINEER_CLASS;
PickedClass[playerid] = 1;
GivePlayerWeapon(playerid, 22, 100);
GivePlayerWeapon(playerid, 32, 500);
GivePlayerWeapon(playerid, 35, 5);
}
else
{
}
}
if(listitem == 4)//FlameThrower
{
if(GetPlayerScore(playerid) <= 400)//CAPTAIN
{
gPlayerClass[playerid] = FLAMETHROWER_CLASS;
PickedClass[playerid] = 1;
GivePlayerWeapon(playerid, 24, 200);
GivePlayerWeapon(playerid, 30, 200);
GivePlayerWeapon(playerid, 37, 200);
}
else
{
}
}
return 1;
}
Now Add this to OnplayerRequestSpawn or OnPlayerConnect. Not OnplayerSpawn at the dialog will appear each time you die, we don't want that.
pawn Код:
ShowPlayerDialog(playerid, 10, DIALOG_STYLE_LIST, "Classes", "Assault\nSniper\nPilot\nEngineer\nPyroman", "Select", "Cancel");
return 1;