if(strcmp(cmdtext, "/arena", true) == 0)
{
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED,"Vocк nгo pode ir a Arena em um veнculo!");
GetPlayerName(playerid, sendername, sizeof(sendername));
new string[256];
format(string, sizeof(string), "O Player {FFFFFF}%s {FF0000}foi para a Arena! Digite /arena.", sendername);
SendClientMessageToAll(COLOR_YELLOW, string);
SetPlayerPos(playerid, 1677.4564,-1337.7351,158.4766);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 16, 50);
GivePlayerWeapon(playerid, 31, 100000);
GivePlayerWeapon(playerid, 26, 100000);
GivePlayerWeapon(playerid, 32, 100000);
SetPlayerHealth(playerid, 100.0);
SetPlayerArmour(playerid, 100.0);
return 1;
}
//No seu comando /arena:
SetPVarInt(playerid, "Usou Comando Arena", true);
//E no topo do seu OnPlayerCommandText, antes de todos os comandos:
if(GetPVarInt(playerid, "Usou Comando Arena")) return SendClientMessage(playerid,0xFFFFFFAA,"Comandos bloqueados, pois vocк usou o comando /arena !");
Mas desta forma irб bloquear todos os comandos e caso ele for sair da arena, nгo irб poder entгo outra soluзгo seria acrescentar o cуdigo dentro dos comandos normalmente..Antes de tudo que executa no comando (menos no /sair arena) Caso tenha
|
if(strcmp("/sair", cmdtext, true) && GetPVarInt(playerid, "UsouComando")) return SendClientMessage(playerid, 0xFF4040AA, "Impossivel usar comandos na arena!");
UsouComando //coloca no enum
if(strcmp(cmdtext, "/arena", true) == 0)
{
if(PlayerInfo[playerid][UsouComando] > 0) return SendClientMessage(playerid, Branco, "Vocк jб tб na arena use /sairarena"); //isso checarб se ele jб usou o comando
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_RED,"Vocк nгo pode ir a Arena em um veнculo!");
GetPlayerName(playerid, sendername, sizeof(sendername));
new string[256];
format(string, sizeof(string), "O Player {FFFFFF}%s {FF0000}foi para a Arena! Digite /arena.", sendername);
SendClientMessageToAll(COLOR_YELLOW, string);
SetPlayerPos(playerid, 1677.4564,-1337.7351,158.4766);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 16, 50);
GivePlayerWeapon(playerid, 31, 100000);
GivePlayerWeapon(playerid, 26, 100000);
GivePlayerWeapon(playerid, 32, 100000);
SetPlayerHealth(playerid, 100.0);
SetPlayerArmour(playerid, 100.0);
PlayerInfo[playerid][UsouComando] = 1; //Isso define que ele jб usou o comando
return 1;
}
//coloca isso no /sairarena
PlayerInfo[playerid][UsouComando = 0;
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/sair", true) == 0 && GetPVarInt(playerid, "NaArena") == 1 )
return SendClientMessage(playerid,Cor,"Vocк saiu!"),
SetPVarInt(playerid, "NaArena",0);
if(GetPVarInt(playerid, "NaArena") == 1)
return SendClientMessage(playerid,Cor,"Vocк nгo pode usar comandos na Arena!");
if(strcmp(cmdtext, "/arena", true) == 0 && GetPVarInt(playerid, "NaArena") == 0 )
{
if(IsPlayerInAnyVehicle(playerid))
return SendClientMessage(playerid,Cor,"Vocк nгo pode ir a Arena em um veнculo!");
SetPlayerPos(playerid, 1677.4564,-1337.7351,158.4766);
ResetPlayerWeapons(playerid);
GivePlayerWeapon(playerid, 16, 50);
GivePlayerWeapon(playerid, 31, 100000);
GivePlayerWeapon(playerid, 26, 100000);
GivePlayerWeapon(playerid, 32, 100000);
SetPlayerHealth(playerid, 100.0);
SetPlayerArmour(playerid, 100.0);
SetPVarInt(playerid, "NaArena",1);
return 1;
}
//Outros comandos.
return 0;
}
if(GetPVarInt(playerid, "NaArena") == 1) SetPVarInt(playerid, "NaArena",0);