Class system dialouge on every spawn????? -
iOmar - 16.06.2012
He Guys?
I have This:
pawn Код:
public OnPlayerSpawn(playerid)
{
ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class (Need No Rank) \nSniper Class (Need Rank 2) \nEngineer Class (Need Rank 3) \nJet-Trooper Class (Need Rank 5) \nPilot Class (Need Rank 7) ", "Choose","");
TogglePlayerControllable(playerid, 0);
SetPlayerVirtualWorld(playerid, 0);
return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 999)
{
if(response)
{
if(listitem == 0)
{
if(GetPlayerScore(playerid) >= 0)
{
SendClientMessage(playerid, COLOR_WHITE, "Server News: You Chose the Assault as your class.");
ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Assult Class:", "{F81414}Abilities:\n{FFFFFF}A Solo class, good in infantry attacks.\n\n{F81414}Weapons:\n\n{FFFFFF}Knife\n{FFFFFF}M4\n{FFFFFF}Spaz12\n{FFFFFF}Deagle", "OK","");
gPlayerClass[playerid] = ASSAULT;
PickedClass[playerid] = 1;
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
GivePlayerWeapon(playerid, 4, 1);
GivePlayerWeapon(playerid, 27, 400);
GivePlayerWeapon(playerid, 24, 300);
GivePlayerWeapon(playerid, 31, 600);
}
}
if(listitem == 1)
{
if(GetPlayerScore(playerid) >= 300)
{
SendClientMessage(playerid, COLOR_WHITE, "Server News: You Chose the Sniper as your class.");
ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Sniper Class:", "{F81414}Abilities:\n{FFFFFF}A Locater class, Always invisible on map.\n\n{F81414}Weapons:\n\n{FFFFFF}Sniper Rifle\n{FFFFFF}Mp5\n{FFFFFF}Knife\n{FFFFFF}Shotgun", "OK","");
gPlayerClass[playerid] = SNIPER;
PickedClass[playerid] = 1;
SetPlayerColor(playerid,0xFF000000);
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
GivePlayerWeapon(playerid, 4, 1);
GivePlayerWeapon(playerid, 34, 500);
GivePlayerWeapon(playerid, 29, 400);
GivePlayerWeapon(playerid, 25, 500);
}
else
{
SendClientMessage(playerid,COLOR_RED,"You need to be on Rank 3 to get this Class.");
ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class (Need No Rank) \nSniper Class (Need Rank 3) \nEngineer Class (Need Rank 5) \nJet-Trooper Class (Need Rank 7) \nPilot Class (Need Rank 8)", "Choose","");
TogglePlayerControllable(playerid, 0);
}
}
if(listitem == 2)
{
if(GetPlayerScore(playerid) >= 600)
{
SendClientMessage(playerid, COLOR_WHITE, "Server News: You Chose the Engineer as your class.");
ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Engineer Class:", "{F81414}Abilities:\n{FFFFFF}A Strong class. Very good on land\nCan drive tanks.\n\n{F81414}Weapons:\n\n{FFFFFF}Spas12\n{FFFFFF}Silent Pistol\n{FFFFFF}RPG\n{FFFFFF}Desert Eagle", "OK","");
gPlayerClass[playerid] = ENGINEER;
PickedClass[playerid] = 1;
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
GivePlayerWeapon(playerid, 27, 400);
GivePlayerWeapon(playerid, 23, 400);
GivePlayerWeapon(playerid, 35, 2);
GivePlayerWeapon(playerid, 24, 150);
}
else
{
SendClientMessage(playerid,COLOR_DARKRED,"You need to be on Rank 5 to get this Class.");
ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class (Need No Rank) \nSniper Class (Need Rank 3) \nEngineer Class (Need Rank 5) \nJet-Trooper Class (Need Rank 7) \nPilot Class (Need Rank 8)", "Choose","");
TogglePlayerControllable(playerid, 0);
}
}
if(listitem == 3)
{
if(GetPlayerScore(playerid) >= 1200)
{
SendClientMessage(playerid, COLOR_WHITE, "Server News: You Chose the Jet-Trooper as your class.");
ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Jetrooper Class:", "{F81414}Abilities:\n{FFFFFF}A Solo class, can spawn jetpack by /jp.\n\n{F81414}Weapons:\n\n{FFFFFF}Tec-9\n{FFFFFF}Colt\n{FFFFFF}Knife\n{FFFFFF}Moltov", "OK","");
gPlayerClass[playerid] = JETTROOPER;
PickedClass[playerid] = 1;
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
GivePlayerWeapon(playerid, 4, 1);
GivePlayerWeapon(playerid, 32, 1000);
GivePlayerWeapon(playerid, 22, 1000);
GivePlayerWeapon(playerid, 18, 2);
}
else
{
SendClientMessage(playerid,COLOR_DARKRED,"You need to be on Rank 7 to get this Class.");
ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class (Need No Rank) \nSniper Class (Need Rank 3) \nEngineer Class (Need Rank 5) \nJet-Trooper Class (Need Rank 7) \nPilot Class (Need Rank 8)", "Choose","");
TogglePlayerControllable(playerid, 0);
}
}
if(listitem == 4)
{
if(GetPlayerScore(playerid) >= 2000)
{
SendClientMessage(playerid, COLOR_WHITE, "Server News: You Chose the Pilot as your class.");
ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{6EF83C}Pilot Class:", "{F81414}Abilities:\n{FFFFFF}A Airforce class, Very Good in Air. Can drive Hunter, Hydra & Sea Sparrow.\n\n{F81414}Weapons:\n\n{FFFFFF}Deagle\n{FFFFFF}Tear Gas\n{FFFFFF}Shotgun\n{FFFFFF}9mm", "OK","");
gPlayerClass[playerid] = PILOT;
PickedClass[playerid] = 1;
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
GivePlayerWeapon(playerid, 22, 250);
GivePlayerWeapon(playerid, 24, 400);
GivePlayerWeapon(playerid, 17, 4);
GivePlayerWeapon(playerid, 25, 100);
}
else
{
SendClientMessage(playerid,COLOR_DARKRED,"You need to be on Rank 8 to get this Class.");
ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class (Need No Rank) \nSniper Class (Need Rank 3) \nEngineer Class (Need Rank 5) \nJet-Trooper Class (Need Rank 7) \nPilot Class (Need Rank 8)", "Choose","");
TogglePlayerControllable(playerid, 0);
}
}
return 1;
}
return 1;
}
return true;
}
====> it appears on every spawn after die. i don't want this. i want it will appear once when we connect to server. And then appear by use using CMD. Not on every spawn even after death...
Re: Class system dialouge on every spawn????? -
FalconX - 16.06.2012
Check OnPlayerDeath or OnPlayerSpawn, you will have the same DIALOG ID 999, change it to something else, you would have used like the following:-
pawn Код:
#define DIALOG_CONNECT 10
// and so on
EDIT: Ah my bad I didn't read it properly I was sleepy sorry, ignore my post. I actually thought you don't want it on OnPlayerSpawn just want it on OnPlayerConnect, so yea ignore my post.
Re: Class system dialouge on every spawn????? -
iggy1 - 16.06.2012
pawn Код:
new gPlayerFirstSpwn[MAX_PLAYERS char];//global
public OnPlayerConnect(playerid)
{
gPlayerFirstSpwn{playerid} = true;
return 1;
}
public OnPlayerSpawn(playerid)
{
if( gPlayerFirstSpwn{playerid} ) {
gPlayerFirstSpwn{playerid} = false;
ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class (Need No Rank) \nSniper Class (Need Rank 2) \nEngineer Class (Need Rank 3) \nJet-Trooper Class (Need Rank 5) \nPilot Class (Need Rank 7) ", "Choose","");
TogglePlayerControllable(playerid, 0);
}
SetPlayerVirtualWorld(playerid, 0);
return 1;
}
Re: Class system dialouge on every spawn????? -
iOmar - 16.06.2012
It worked. but when i spawned after got killed i don't get weapons. i want i'll get class i selected on first spawn..
Re: Class system dialouge on every spawn????? -
iggy1 - 16.06.2012
Edit OnPlayerSpawn like this.
pawn Код:
public OnPlayerSpawn(playerid)
{
if( gPlayerFirstSpwn{playerid} )
{
gPlayerFirstSpwn{playerid} = false;
ShowPlayerDialog(playerid, 999, DIALOG_STYLE_LIST, "{6EF83C}Choose A Class:", "Assault Class (Need No Rank) \nSniper Class (Need Rank 2) \nEngineer Class (Need Rank 3) \nJet-Trooper Class (Need Rank 5) \nPilot Class (Need Rank 7) ", "Choose","");
TogglePlayerControllable(playerid, 0);
}
else
{
ResetPlayerWeapons( playerid );
switch(gPlayerClass[playerid])
{
case ASSAULT:
{
GivePlayerWeapon(playerid, 4, 1);
GivePlayerWeapon(playerid, 27, 400);
GivePlayerWeapon(playerid, 24, 300);
GivePlayerWeapon(playerid, 31, 600);
}
//rest of classes
}
}
SetPlayerVirtualWorld(playerid, 0);
return 1;
}
Re: Class system dialouge on every spawn????? -
iOmar - 18.06.2012
Yeah it worked. When i select assault class it works perfectly. but when i select other classes such as Sniper, Pilot then when i type /kill then when i spawn i don't have weapons. i want like assault when we choose other class like sniper than we will have sniper weapons (SNIPER CLASS) on next spawn. Like ASSAULT.....
Re: Class system dialouge on every spawn????? -
Vince - 18.06.2012
Quote:
Originally Posted by iggy1
pawn Код:
case ASSAULT: {
} //rest of classes
|
^ Read the green comment!
Re: Class system dialouge on every spawn????? -
iOmar - 18.06.2012
Oh
My Bad..