pawn Код:
dcmd_venderarmas(playerid, params[])
{
if(Player[playerid][pJob] == VARMAS || Player[playerid][pMember] == TEAM_RUSSA || Player[playerid][pLeader] == TEAM_RUSSA || Player[playerid][pMember] == TEAM_YAKUZA || Player[playerid][pLeader] == TEAM_YAKUZA)
{
if(PlayerToPoint(40.0, playerid, 245.9469,75.8629,1003.6406)) return SendClientMessage(playerid, COLOR_WHITE, "[ERRO] Vocк nгo pode vender armas na DP! ");
new x_weapon[256],weapon[MAX_PLAYERS],ammo[MAX_PLAYERS],price[MAX_PLAYERS];
new tmp[24], idx; tmp = strtok(params, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "[USO] /venderarmas [id/nick] [nome da arma]");
SendClientMessage(playerid, COLOR_GREY, "Armas: flores(25) sdpistol(100) eagle(150) mp5(200) escopeta(200)");
SendClientMessage(playerid, COLOR_GREY, "Armas: ak47(600) m4(600) rifle (600) paraquedas (100)");
return 1;
}
new giveid = ReturnUser(tmp);
if(!IsPlayerConnected(giveid)) return SendClientMessage(playerid, COLOR_GREY,"Jogador nгo conectado.");
if(Treinando[giveid][0] > 0) return SendClientMessage(playerid,COLOR_RED,"[ERRO] Jogador estб treinando.");
if(Player[giveid][pExp] < 0) return SendClientMessage(playerid, COLOR_RED, "O jogador ainda nгo pode usar armas.");
x_weapon = strtok(params, idx);
if(!strlen(x_weapon))
{
SendClientMessage(playerid, COLOR_GREEN, "________________________________________________");
SendClientMessage(playerid, COLOR_WHITE, "*** Vender de armas ***");
SendClientMessage(playerid, COLOR_GREY, "[USO] /venderarmas [id/nick] [nome da arma]");
SendClientMessage(playerid, COLOR_GREY, "Armas: flores(25) sdpistol(100) eagle(200) mp5(200) escopeta(200)");
SendClientMessage(playerid, COLOR_GREY, "Armas: ak47(600) m4(600) rifle(600) paraquedas (100) spray (50)");
SendClientMessage(playerid, COLOR_GREEN, "________________________________________________");
return 1;
}
if(strcmp(x_weapon,"sdpistol", true) == 0) { if(Player[playerid][pMats] > 99) { weapon[playerid] = 23; price[playerid] = 100; ammo[playerid] = 50; Player[giveid][pGun2] = 23; Player[giveid][pAmmo2] = 50; } else { SendClientMessage(playerid,COLOR_GREY," Materiais insuficientes para esta arma."); return 1; } }
else if(strcmp(x_weapon,"flores", true) == 0) { if(Player[playerid][pMats] > 24) { weapon[playerid] = 14; price[playerid] = 25; ammo[playerid] = 1; Player[giveid][pGun1] = 14; Player[giveid][pAmmo1] = 1; } else { SendClientMessage(playerid,COLOR_GREY," Materiais insuficientes para esta arma."); return 1; } }
else if(strcmp(x_weapon,"eagle", true) == 0) { if(Player[playerid][pMats] > 199) { weapon[playerid] = 24; price[playerid] = 150; ammo[playerid] = 50; Player[giveid][pGun2] = 24; Player[giveid][pAmmo2] = 50; } else { SendClientMessage(playerid,COLOR_GREY," Materiais insuficientes para esta arma."); return 1; } }
else if(strcmp(x_weapon,"mp5", true) == 0) { if(Player[playerid][pMats] > 199) { weapon[playerid] = 29; price[playerid] = 200; ammo[playerid] = 200; Player[giveid][pGun2] = 29; Player[giveid][pAmmo2] = 200; } else { SendClientMessage(playerid,COLOR_GREY," Materiais insuficientes para esta arma."); return 1; } }
else if(strcmp(x_weapon,"escopeta", true) == 0) { if(Player[playerid][pMats] > 199) { weapon[playerid] = 25; price[playerid] = 200; ammo[playerid] = 50; Player[giveid][pGun2] = 25; Player[giveid][pAmmo2] = 50; } else { SendClientMessage(playerid,COLOR_GREY," Materiais insuficientes para esta arma."); return 1; } }
else if(strcmp(x_weapon,"ak47", true) == 0) { if(Player[playerid][pMats] > 599) { weapon[playerid] = 30; price[playerid] = 600; ammo[playerid] = 250; Player[giveid][pGun2] = 30; Player[giveid][pAmmo2] = 250; } else { SendClientMessage(playerid,COLOR_GREY," Materiais insuficientes para esta arma."); return 1; } }
else if(strcmp(x_weapon,"m4", true) == 0) { if(Player[playerid][pMats] > 599) { weapon[playerid] = 31; price[playerid] = 600; ammo[playerid] = 250; Player[giveid][pGun2] = 31; Player[giveid][pAmmo2] = 250; } else { SendClientMessage(playerid,COLOR_GREY," Materiais insuficientes para esta arma."); return 1; } }
else if(strcmp(x_weapon,"rifle", true) == 0) { if(Player[playerid][pMats] > 599) { weapon[playerid] = 33; price[playerid] = 600; ammo[playerid] = 50; Player[giveid][pGun2] = 33; Player[giveid][pAmmo2] = 50; } else { SendClientMessage(playerid,COLOR_GREY," Materiais insuficientes para esta arma."); return 1; } }
else if(strcmp(x_weapon,"paraquedas", true) == 0) { if(Player[playerid][pMats] > 99) { weapon[playerid] = 46; price[playerid] = 100; ammo[playerid] = 1; Player[giveid][pGun2] = 46; Player[giveid][pAmmo2] = 1; } else { SendClientMessage(playerid,COLOR_GREY," Materiais insuficientes para esta arma."); return 1; } }
else if(strcmp(x_weapon,"spray", true) == 0) { if(Player[playerid][pMats] > 20) { weapon[playerid] = 41; price[playerid] = 50; ammo[playerid] = 300; Player[giveid][pGun2] = 41; Player[giveid][pAmmo2] = 300; } else { SendClientMessage(playerid,COLOR_GREY," Materiais insuficientes para esta arma."); return 1; } }
else { SendClientMessage(playerid,COLOR_GREY," Nome inexistente."); return 1; }
if(ProxDetectorS(5.0, playerid, giveid))
{
if(giveid == playerid) return SendClientMessage(playerid, COLOR_RED, "[ERRO] Vocк nгo pode vender armas a vocк mesmo");
if(Player[playerid][pMiserPerk] > 0)
{
new skill = 2 * Player[playerid][pMiserPerk];
new mats = price[playerid] / 100;
price[playerid] -= (mats)*(skill);
}
ConsumingMoney[playerid] = 1;
format(thestring, sizeof(thestring), " Vocк deu a %s uma %s com %d municхes usando %d materiais.", Player[giveid][pName],x_weapon, ammo[playerid], price[playerid]);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
SendClientMessage(playerid, COLOR_GREY, thestring);
format(thestring, sizeof(thestring), " Vocк recebeu uma %s com %d de %s.", x_weapon, ammo[playerid], Player[playerid][pName]);
SendClientMessage(giveid, COLOR_GREY, thestring);
PlayerPlaySound(giveid, 1052, 0.0, 0.0, 0.0);
format(thestring, sizeof(thestring), "%s recebeu armas de %s.", Player[giveid][pName], Player[playerid][pName]);
ProxDetector(30.0, playerid, thestring, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
new gunname[100];
GetWeaponName(weapon[playerid], gunname, sizeof(gunname));
format(thestring, sizeof(thestring), "%s vendeu uma %s para %s.", Player[playerid][pName], gunname,Player[giveid][pName]);
ProxDetector(30.0, playerid, thestring, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SafeGivePlayerWeapon(giveid,weapon[playerid],ammo[playerid]);
Player[playerid][pMats] -= price[playerid];
}
else { SendClientMessage(playerid, COLOR_RED,"[ERRO] Aproxime-se."); } }
else { SendClientMessage(playerid,COLOR_ORANGE,"Vocк nгo й um vendedor de armas."); }
return 1;
}
Pode dar alguns erros pois fiz com pressa.