new Menu:armasmenu;
public OnGameModeInit()
armasmenu = CreateMenu("Loja de Armas", 1, 50.0, 180.0, 200.0, 200.0); AddMenuItem(armasmenu, 0, "9mm($500)"); AddMenuItem(armasmenu, 0, "Desert Eagle($1500)"); AddMenuItem(armasmenu, 0, "Micro SMG($1500)"); AddMenuItem(armasmenu, 0, "AK-47($3500)"); AddMenuItem(armasmenu, 0, "Country Rifle($850)");
public OnPlayerSelectedMenuRow(playerid, row)
{ new Menu:current; current = GetPlayerMenu(playerid); if(current ==armasmenu) { switch(row) { case 0: { TogglePlayerControllable(playerid, true); if(GetPlayerCash(playerid) >= 500) { PlayerInfo[playerid][p9mm] = 1; GivePlayerWeapon(playerid, 22, 100); SendClientMessage(playerid, COLOR_WHITE, "Vocк comprou uma 9mm"); GivePlayerCash(playerid, -500); } else { SendClientMessage(playerid, COLOR_WHITE, "Vocк nгo pode adquirir isso (500)"); } } case 1: { TogglePlayerControllable(playerid, true); if(GetPlayerCash(playerid) >= 1500) { PlayerInfo[playerid][pEagle] = 1; GivePlayerWeapon(playerid, 24, 100); SendClientMessage(playerid, COLOR_WHITE, "Vocк comprou uma Desert Eagle"); GivePlayerCash(playerid, -1500); } else { SendClientMessage(playerid, COLOR_WHITE, "Vocк nгo pode adquirir isso (1500)"); } } case 2: { TogglePlayerControllable(playerid, true); if(GetPlayerCash(playerid) >= 1500) { PlayerInfo[playerid][pMsmg] = 1; GivePlayerWeapon(playerid, 28, 100); GivePlayerCash(playerid, -1500); SendClientMessage(playerid, COLOR_WHITE, "Vocк comprou uma Micro SMG"); } else { SendClientMessage(playerid, COLOR_WHITE, "Vocк nгo pode adquirir isso (1500)"); } } case 3: { TogglePlayerControllable(playerid, true); if(GetPlayerCash(playerid) >= 4000) { PlayerInfo[playerid][pAK] = 1; GivePlayerWeapon(playerid, 30, 100); GivePlayerCash(playerid, -4000); SendClientMessage(playerid, COLOR_WHITE, "Vocк comprou uma AK-47"); } else { SendClientMessage(playerid, COLOR_WHITE, "Vocк nгo pode adquirir isso (4000)"); } } case 4: { TogglePlayerControllable(playerid, true); if(GetPlayerCash(playerid) >= 850) { PlayerInfo[playerid][pCountry] = 1; GivePlayerWeapon(playerid, 33, 100); GivePlayerCash(playerid, -850); SendClientMessage(playerid, COLOR_WHITE, "Vocк comprou um Country Rifle"); } else { SendClientMessage(playerid, COLOR_WHITE, "Vocк nгo pode adquirir isso (850)"); } } } } return 1; }
Originally Posted by andmeida10
ele falou por dialog
|
if(dialogid==2332) {
if(response) {
if(listitem==0) {
if(GetPlayerMoney(playerid)<2000) return SendClientMessage(playerid,COR,"Vocк nгo tem dinheiro suficiente!");
else {GivePlayerMoney(playerid,-2000);GivePlayerWeapon(playerid,26,300);}
return 1;}
//Divisгo
if(listitem==1) {
if(GetPlayerMoney(playerid)<900) return SendClientMessage(playerid,COR,"Vocк nгo tem dinheiro suficiente!");
else {GivePlayerMoney(playerid,-900);GivePlayerWeapon(playerid,32,400);}
return 1;}}
return 1;
}
new ValorSawn=VSAWN;new ValorTec=VTEC;new strcp[128];
format(strcp,sizeof(strcp),"Sawn-Off - R$%i\nTec9 - R$%i",ValorSawn,ValorTec);
ShowPlayerDialog(playerid,2332,DIALOG_STYLE_LIST,"Menu de Armas",strcp,"Comprar","Sair");
#define SAWN 19239
#define TEC 19233
#define PSAWN 6 //Preзo de 1 bala da Sawn-Off
#define PTEC 3 //Preзo de 1 bala da Tec9
#define VSAWN 2000 //Preзo da arma Sawn
#define VTEC 900 //Preзo da arma Tec9
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid==2332) {
if(response) {
if(listitem==0) {
if(GetPlayerMoney(playerid)<VSAWN) return SendClientMessage(playerid,vermelho,"Vocк nгo tem dinheiro suficiente!");
else {ShowPlayerDialog(playerid,SAWN,DIALOG_STYLE_INPUT,"Balas para sua Sawn-Off","Dependendo da quantidade de balas o preзo irб aumentar!","Comprar","Sair");}
return 1;}
if(listitem==1) {
if(GetPlayerMoney(playerid)<VTEC) return SendClientMessage(playerid,vermelho,"Vocк nгo tem dinheiro suficiente!");
else {ShowPlayerDialog(playerid,SAWN,DIALOG_STYLE_INPUT,"Balas para sua Tec9","Dependendo da quantidade de balas o preзo irб aumentar!","Comprar","Sair");}
return 1;}}
return 1;
}
if(dialogid==SAWN) {
if(response) {
new BalasP=strval(inputtext)*PSAWN+VSAWN;
if(GetPlayerMoney(playerid)<BalasP) return SendClientMessage(playerid,vermelho,"Vocк nгo tem o dinheiro suficiente para comprar todas essas balas!");
else {GivePlayerMoney(playerid,-(BalasP));GivePlayerWeapon(playerid,26,strval(inputtext));SendClientMessage(playerid,amarelo,"Compra com sucesso!");}}
return 1;
}
if(dialogid==TEC) {
if(response) {
new BalasP=strval(inputtext)*PTEC+VTEC;
if(GetPlayerMoney(playerid)<BalasP) return SendClientMessage(playerid,vermelho,"Vocк nгo tem o dinheiro suficiente para comprar todas essas balas!");
else {GivePlayerMoney(playerid,-(BalasP));GivePlayerWeapon(playerid,32,strval(inputtext));SendClientMessage(playerid,amarelo,"Compra com sucesso!");}}
return 1;
}
if (strcmp(cmd, "/comprararma", true) == 0) { if(IsPlayerConnected(playerid)) { if(GetPlayerGP(playerid) < 1) { SendClientMessage(playerid, COLOR_GREY, " Vocк nгo tem o dinheiro suficiente com vocк !"); return 1; } new gun; new gunid[16]; new infostring[256]; new guncharge; new ammocharge; new location = PlayerInfo[playerid][pLocal]; if(location == 99 || location == 100 || location == 102) { new mod = 100; tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { format(string, sizeof(string), "DICA: /comprararma [NomeDaArma] [NumeroDeBalas]"); SendClientMessage(playerid, COLOR_GREEN,"_____________________________________ __"); SendClientMessage(playerid, COLOR_LIGHTBLUE,"*** Armas: ***"); SendClientMessage(playerid, COLOR_YELLOW2,"Pistola: Silenciadora e Eagle"); SendClientMessage(playerid, COLOR_YELLOW2,"Combat: Shotgun"); SendClientMessage(playerid, COLOR_YELLOW2,"Metralhadora: MP5"); SendClientMessage(playerid, COLOR_YELLOW2,"Fuzil: Ak47 e M4"); SendClientMessage(playerid, COLOR_YELLOW2,"Rifles: Rifle"); SendClientMessage(playerid, COLOR_GREEN,"_____________________________________ __"); return 1; } strmid(gunid, tmp, 0, strlen(cmdtext), 255); tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { format(string, sizeof(string), "DICA: /comprararma [NomeDaArma] [NumeroDeBalas]"); return 1; } new ammo = strval(tmp); if(ammo < 1 || ammo > 999) { SendClientMessage(playerid, COLOR_GREY, " Muniзгo entre 1 e 999 !"); return 1; } if (strcmp(gunid, "silenciadora", true, strlen(gunid)) == 0) { gun = 23; guncharge = GunPrice[13][0]/100*mod; ammocharge = GunPrice[25][0]*ammo; PlayerInfo[playerid][pGun2] = 23; PlayerInfo[playerid][pAmmo2] = ammo; } else if (strcmp(gunid, "eagle", true, strlen(gunid)) == 0) { gun = 24; guncharge = GunPrice[15][0]/100*mod; ammocharge = GunPrice[25][0]*ammo; PlayerInfo[playerid][pGun2] = 24; PlayerInfo[playerid][pAmmo2] = ammo; } else if (strcmp(gunid, "mp5", true, strlen(gunid)) == 0) { gun = 29; guncharge = GunPrice[18][0]/100*mod; ammocharge = GunPrice[27][0]*ammo; PlayerInfo[playerid][pGun3] = 29; PlayerInfo[playerid][pAmmo3] = ammo; } else if (strcmp(gunid, "shotgun", true, strlen(gunid)) == 0) { gun = 25; guncharge = GunPrice[19][0]/100*mod; ammocharge = GunPrice[26][0]*ammo; PlayerInfo[playerid][pGun3] = 25; PlayerInfo[playerid][pAmmo3] = ammo; } else if (strcmp(gunid, "ak47", true, strlen(gunid)) == 0) { gun = 30; guncharge = GunPrice[22][0]/100*mod; ammocharge = GunPrice[28][0]*ammo; PlayerInfo[playerid][pGun4] = 30; PlayerInfo[playerid][pAmmo4] = ammo; } else if (strcmp(gunid, "m4", true, strlen(gunid)) == 0) { gun = 31; guncharge = GunPrice[23][0]/100*mod; ammocharge = GunPrice[28][0]*ammo; PlayerInfo[playerid][pGun4] = 31; PlayerInfo[playerid][pAmmo4] = ammo; } else if (strcmp(gunid, "rifle", true, strlen(gunid)) == 0) { gun = 33; guncharge = GunPrice[24][0]/100*mod; ammocharge = GunPrice[29][0]*ammo; PlayerInfo[playerid][pGun4] = 33; PlayerInfo[playerid][pAmmo4] = ammo; } else { SendClientMessage(playerid, COLOR_GRAD6, "Lojista diz: Eu nunca ouvi falar dessa arma."); return 1; } if((guncharge+ammocharge) > GetPlayerGP(playerid)) { format(infostring, 256, " Vocк nгo tem R$ %d !",guncharge+ammocharge); SendClientMessage(playerid, COLOR_GRAD3, infostring); return 1; } if(GetPlayerGP(playerid) < (guncharge+ammocharge)) { SendClientMessage(playerid, COLOR_GREY, " Vocк nгo pode pagar !"); return 1; } new payout = guncharge + ammocharge; format(infostring, 256, "Vocк comprou uma %s com %d balas pelo custo de R$ %d",gunid,ammo,payout); SendClientMessage(playerid, COLOR_GRAD3, infostring); if(location == 102 && IsACop(playerid)) { } else { GivePlayerGP(playerid, - payout); } BizzInfo[location-99][bTill] += payout; ExtortionBiz(location-99, payout); BizzInfo[location-99][bProducts]--; PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0); GivePlayerWeapon(playerid, gun, ammo); GetPlayerName(playerid, sendername, sizeof(sendername)); format(string, sizeof(string), "%s comprou armas por R$ %d na empresa %d", sendername, payout, location-99); printf("%s", string); PayLog(string); } else { SendClientMessage(playerid, COLOR_WHITE,"Vocк nгo estб em uma loja de armas."); return 1; } } return 1; } |