26.07.2016, 06:22
You're not giving him any weapons under OnDialogResponse when they first choose.
Also, this system should be per-player to prevent issues.
Also, this system should be per-player to prevent issues.
PHP Code:
new showclass[MAX_PLAYERS], class_assault[MAX_PLAYERS], class_sniper[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
showclass[playerid] = 0;
class_assault[playerid] = 0;
class_sniper[playerid] = 0;
return 1;
}
public OnPlayerSpawn(playerid)
{
if(showclass[playerid] == 0)
{
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Class Selction", "Assault-Rank 1\nSniper-Rank 2", "Choose", "");
}
else if(showclass[playerid] == 1 && class_assault[playerid] == 1)
{
GivePlayerWeapon(playerid, 24, 100);
GivePlayerWeapon(playerid, 27, 76);
GivePlayerWeapon(playerid, 16, 3);
GivePlayerWeapon(playerid, 31, 300);
}
else if(showclass[playerid] == 1 && class_sniper[playerid] == 1)
{
GivePlayerWeapon(playerid, 4, 0);
GivePlayerWeapon(playerid, 23, 60);
GivePlayerWeapon(playerid, 17, 3);
GivePlayerWeapon(playerid, 34, 200);
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)
{
switch(listitem)
{
case 0:
{
GivePlayerWeapon(playerid, 24, 100);
GivePlayerWeapon(playerid, 27, 76);
GivePlayerWeapon(playerid, 16, 3);
GivePlayerWeapon(playerid, 31, 300);
showclass[playerid] = 1;
class_assault[playerid] = 1;
}
case 1:
{
GivePlayerWeapon(playerid, 4, 0);
GivePlayerWeapon(playerid, 23, 60);
GivePlayerWeapon(playerid, 17, 3);
GivePlayerWeapon(playerid, 34, 200);
showclass[playerid] = 1;
class_sniper[playerid] = 1;
}
}
}
return 1;
}