Bloquear arma sу para o Player -
WenioGustavo - 18.12.2014
fala galera, entгo no meu gm tem um sistema de ant-armas, que se alguem puxar a arma que ta proibida la, tem uma funзгo pre-definida para Kickalo, retirar as armas, ou dar Ban. mais isso se aplica em qualquer um, exemplo eu quero bloquear a minigun para os players, mais os administradores poder ter acesso sem ser banido / kickado.
Seria possivel modificar algum dos code abaixo para o administrador poder ter acesso?
Код:
/*================== Ant armas ==================================================*/
#define ACTION (2) /* 0 = BANIR | 1 = KICKAR | 2 = RETIRAR ARMA */
/*=============================================================================*/
Код:
/* ============================== Anti armas ==================================*/
new
pStr[128],
wName[32];
new
ArmasProibidas[] =
{
38, // Minigun
};
/*=============================================================================*/
Код:
/*============================= Armas Proibida ================================*/
public
CheckWM()
{
for( new i, j = GetMaxPlayers(); i < j; ++i )
{
for( new w; w < sizeof(ArmasProibidas); ++w )
{
if(Spawnado[i] == false)
continue;
if(PlayerInfo[i][pLogged] == 1) {
if( GetPlayerWeapon( i ) == ArmasProibidas[ w ] )
{
GetWeaponName( ArmasProibidas[ w ], wName, sizeof(wName) );
#if ACTION == 0
format(pStr, sizeof(pStr), "| BSP-Admin | O Administrador [BSP]Guardiгo Baniu o Jogador %s ( Motivo: (%s) )", PlayerName( i ), wName );
SendClientMessageToAll( Azul, pStr );
BanEx( i, "Weapon Cheat" );
#elseif ACTION == 1
format(pStr, sizeof(pStr), "| BSP-Admin | O Administrador [BSP]Guardiгo kickou o jogador %s por usar uma arma proibida. (%s)", PlayerName( i ), wName );
SendClientMessageToAll( Azul, pStr );
Kick( i );
#elseif ACTION == 2
format(pStr, sizeof(pStr), " | ANTI - ARMAS | O Jogador %s [ID: %d] tentou usar uma arma proibida e nгo obteve sucesso. (%s)", PlayerName( i ), i, wName );
SendClientMessageToAll( Azul, pStr );
RemoveWeaponSlot( i, GetWeaponSlot( ArmasProibidas[ w ] ) );
#endif
}
}
}
}
return 1;
}
/Dararma
Код:
if(strcmp(cmd,"/dararma", true)==0){
if(pAdmin[playerid] == 3 || pAdmin[playerid] == 4 || pAdmin[playerid] == 5){
new plid, idarma;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)){
SendClientMessage(playerid, Vermelho, " | ERRO | Digite: /dararma [id] [id-da-arma]");
return 1;
}
plid = strval(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, Vermelho, " | ERRO | Digite: /dararma [id] [id-da-arma]");
return 1;
}
idarma = strval(tmp);
if(idarma == 38){
SendClientMessage(playerid, Vermelho, " | ERRO | Arma Proibida!");
return 1;
}
if(IsPlayerConnected(plid)){
GivePlayerWeapon(plid,idarma,100000);
SendClientMessage(playerid, adm, " | INFO | Comando efetuado com sucesso!");
format(string, sizeof(string), " | INFO | O Administrador %s (%d) te deu a arma de id: %d", PlayerName(playerid),playerid,idarma);
SendClientMessage(plid,adm, string);
return 1;
}else{
SendClientMessage(playerid, Vermelho, " | ERRO | Jogador nгo conectado.");
return 1;
}
}
}
Obrigado
Re: Bloquear arma sу para o Player -
Artista - 18.12.2014
Modifique esta linha:
pawn Код:
if( GetPlayerWeapon( i ) == ArmasProibidas[ w ] )
para:
pawn Код:
if(GetPlayerWeapon(i) == ArmasProibidas[w] && !pAdmin[i])
Re: Bloquear arma sу para o Player -
WenioGustavo - 18.12.2014
Deu Certo Obrigado