26.07.2016, 06:13
Hey friends... yep it is me again..
On a hatrick....Three help posts at the same time....
Will need your help again.. I was creating a class selection system here and there is a weird problem..
Here is the code described...
new showclass;
new class_assault;
new class_sniper;
three things defined... showclass(if set to 1, will not show the next time and if 0 will show when spawning)
class_assault(assault class to give weapons)
class_sniper(the same)
Under OnPlayerConnect I set all of them to 0...
Under OnPlayerSpawn
if(showclass == 0)
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Class Selction", "Assault-Rank 1\nSniper-Rank 2", "Choose", "");
}
else if(showclass == 1 && class_assault == 1)
{
GivePlayerWeapon(playerid, 24, 100);
GivePlayerWeapon(playerid, 27, 76);
GivePlayerWeapon(playerid, 16, 3);
GivePlayerWeapon(playerid, 31, 300);
}
else if(showclass == 1 && class_sniper == 1)
{
GivePlayerWeapon(playerid, 4, 0);
GivePlayerWeapon(playerid, 23, 60);
GivePlayerWeapon(playerid, 17, 3);
GivePlayerWeapon(playerid, 34, 200);
}
I did it like this because I want players to choose class only the first time they connect...other times it just goes with the one they selected before..
And finally
Under OnDialogResponse(remember I only have one dialog...for others I used different functions like stocks..)
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)
{
switch(listitem)
{
case 0:
{
showclass = 1;
class_assault = 1;
}
case 1:
{
showclass = 1;
class_sniper = 1;
}
}
}
return 1;
}
Now the problem..
When the player spawns he doesn't get the weapons...
Please help..
On a hatrick....Three help posts at the same time....
Will need your help again.. I was creating a class selection system here and there is a weird problem..
Here is the code described...
new showclass;
new class_assault;
new class_sniper;
three things defined... showclass(if set to 1, will not show the next time and if 0 will show when spawning)
class_assault(assault class to give weapons)
class_sniper(the same)
Under OnPlayerConnect I set all of them to 0...
Under OnPlayerSpawn
if(showclass == 0)
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Class Selction", "Assault-Rank 1\nSniper-Rank 2", "Choose", "");
}
else if(showclass == 1 && class_assault == 1)
{
GivePlayerWeapon(playerid, 24, 100);
GivePlayerWeapon(playerid, 27, 76);
GivePlayerWeapon(playerid, 16, 3);
GivePlayerWeapon(playerid, 31, 300);
}
else if(showclass == 1 && class_sniper == 1)
{
GivePlayerWeapon(playerid, 4, 0);
GivePlayerWeapon(playerid, 23, 60);
GivePlayerWeapon(playerid, 17, 3);
GivePlayerWeapon(playerid, 34, 200);
}
I did it like this because I want players to choose class only the first time they connect...other times it just goes with the one they selected before..
And finally
Under OnDialogResponse(remember I only have one dialog...for others I used different functions like stocks..)
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)
{
switch(listitem)
{
case 0:
{
showclass = 1;
class_assault = 1;
}
case 1:
{
showclass = 1;
class_sniper = 1;
}
}
}
return 1;
}
Now the problem..
When the player spawns he doesn't get the weapons...
Please help..