amenu = CreateMenu("Escolha sua arma", 1, 200.0, 100.0, 150.0, 150.0); AddMenuItem(amenu, 0, "Micro SMG"); AddMenuItem(amenu, 0, "Sawn-off Shotgun"); AddMenuItem(amenu, 0, "Pistola"); AddMenuItem(amenu, 0, "Granada"); AddMenuItem(amenu, 0, "Desert Eagle"); AddMenuItem(amenu, 0, "M4"); AddMenuItem(amenu, 0, "Sniper"); AddMenuItem(amenu, 0, "Combat Shotgun"); AddMenuItem(amenu, 0, "MP5"); AddMenuItem(amenu, 0, "AK-47"); AddMenuItem(amenu, 0, "Moto Serra"); AddMenuItem(amenu, 0, "Sair");
if (strcmp("/ma",cmdtext, true,10) == 0) { ShowMenuForPlayer(amenu, playerid); return 1; }
new Menu:current; current = GetPlayerMenu(playerid); if(current == amenu) { switch(row) { case 0:{ GivePlayerWeapon(playerid,28,6000); SendClientMessage(playerid,cor_amarela,"| INFO | Arma Fornecida!"); } case 1:{ GivePlayerWeapon(playerid,26,6000); SendClientMessage(playerid,cor_amarela,"| INFO | Arma Fornecida!"); } case 2:{ GivePlayerWeapon(playerid,22,6000); SendClientMessage(playerid,cor_amarela,"| INFO | Arma Fornecida!"); } case 3:{ GivePlayerWeapon(playerid,16,45); SendClientMessage(playerid,cor_amarela,"| INFO | Arma Fornecida!"); } case 4:{ GivePlayerWeapon(playerid,24,6000); SendClientMessage(playerid,cor_amarela,"| INFO | Arma Fornecida!"); } case 5:{ GivePlayerWeapon(playerid,31,6000); SendClientMessage(playerid,cor_amarela,"| INFO | Arma Fornecida!"); } case 6:{ GivePlayerWeapon(playerid,34,6000); SendClientMessage(playerid,cor_amarela,"| INFO | Arma Fornecida!"); } case 7:{ GivePlayerWeapon(playerid,39,6000); SendClientMessage(playerid,cor_amarela,"| INFO | Arma Fornecida!"); } case 8:{ GivePlayerWeapon(playerid,30,6000); SendClientMessage(playerid,cor_amarela,"| INFO | Arma Fornecida!"); } case 9:{ GivePlayerWeapon(playerid,9,6000); SendClientMessage(playerid,cor_amarela,"| INFO | Arma Fornecida!"); } case 10:{ TogglePlayerControllable(playerid, 1); } case 11:{ } }
bem estou criando um servidor de dm e criei um menu de armas mas quando o player digita o comando o menu o server fecha ai vai o codigo
Код:
amenu = CreateMenu("Escolha sua arma", 1, 200.0, 100.0, 150.0, 150.0); AddMenuItem(amenu, 0, "Micro SMG"); AddMenuItem(amenu, 0, "Sawn-off Shotgun"); AddMenuItem(amenu, 0, "Pistola"); AddMenuItem(amenu, 0, "Granada"); AddMenuItem(amenu, 0, "Desert Eagle"); AddMenuItem(amenu, 0, "M4"); AddMenuItem(amenu, 0, "Sniper"); AddMenuItem(amenu, 0, "Combat Shotgun"); AddMenuItem(amenu, 0, "MP5"); AddMenuItem(amenu, 0, "AK-47"); AddMenuItem(amenu, 0, "Moto Serra"); AddMenuItem(amenu, 0, "Sair"); Код:
if (strcmp("/ma",cmdtext, true,10) == 0) { ShowMenuForPlayer(amenu, playerid); return 1; } alguem poderia me ajudar |
public OnPlayerSelectedMenuRow(playerid, row)
{
new Menu:current;
current = GetPlayerMenu(playerid);
if(current == amenu)
{
switch(row)
{
case 0:
{
GivePlayerWeapon(playerid,28,6000);
SendClientMessage(playerid,cor_amarela,"| INFO | Arma Fornecida!");
}
case 1:
{
GivePlayerWeapon(playerid,26,6000);
SendClientMessage(playerid,cor_amarela,"| INFO | Arma Fornecida!");
}
case 2:
{
GivePlayerWeapon(playerid,22,6000);
SendClientMessage(playerid,cor_amarela,"| INFO | Arma Fornecida!");
}
case 3:
{
GivePlayerWeapon(playerid,16,45);
SendClientMessage(playerid,cor_amarela,"| INFO | Arma Fornecida!");
}
case 4:
{
GivePlayerWeapon(playerid,24,6000);
SendClientMessage(playerid,cor_amarela,"| INFO | Arma Fornecida!");
}
case 5:
{
GivePlayerWeapon(playerid,31,6000);
SendClientMessage(playerid,cor_amarela,"| INFO | Arma Fornecida!");
}
case 6:
{
GivePlayerWeapon(playerid,34,6000);
SendClientMessage(playerid,cor_amarela,"| INFO | Arma Fornecida!");
}
case 7:
{
GivePlayerWeapon(playerid,39,6000);
SendClientMessage(playerid,cor_amarela,"| INFO | Arma Fornecida!");
}
case 8:
{
GivePlayerWeapon(playerid,30,6000);
SendClientMessage(playerid,cor_amarela,"| INFO | Arma Fornecida!");
}
case 9:
{
GivePlayerWeapon(playerid,9,6000);
SendClientMessage(playerid,cor_amarela,"| INFO | Arma Fornecida!");
}
case 10:
{
GivePlayerWeapon(playerid,9,6000); //Moto Serra ID.
SendClientMessage(playerid,cor_amarela,"| INFO | Arma Fornecida!");
}
case 11:
{
HideMenuForPlayer(amenu, playerid);
TogglePlayerControllable(playerid, 1);
}
}
}
return 1;
}