Identificando uma GangZone. -
Ley - 30.05.2013
Boa Tarde, criei uma gangzone para marcar a 'favela' ( local de DM liberado ), porйm estou em dъvida em como irei verificar se um player estб, ou nгo na gangzone.
Eu pensei em utilizar o
PHP код:
IsPlayerInRangeOfPoint
porйm eu nгo sei a distвncia que tem essa GangZone...
Alguйm poderia me ajudar?
Resumo: Como verifico se um player estб dentro da gangzone, onde a variбvel dela й 'favela'?
Aguardo respostas.
Re: Identificando uma GangZone. -
-GooGle- - 30.05.2013
pawn Код:
IsPlayerInGangZone(playerid)
{
//troque as coordenadas pelas coordenadas da sua gangzone
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid, x, y, z);
if(x >= 116.7788 && y >= 1296.244 && x <= 303.6248&& y <= 1471.412) return 1;
else return 0;
}
pawn Код:
//exemplo de uso
CMD:verificar(playerid, params[])
{
if(!IsPlayerInGangZone(playerid)) return SendClientMessage(playerid,-1,"Vocк nгo estб na GangZone!");
SendClientMessage(playerid,-1,"Vocк estб na GangZone!");
return true;
}
Re: Identificando uma GangZone. -
Ley - 30.05.2013
Quote:
Originally Posted by -******-
pawn Код:
IsPlayerInGangZone(playerid) { //troque as coordenadas pelas coordenadas da sua gangzone new Float:x,Float:y,Float:z; GetPlayerPos(playerid, x, y, z); if(x >= 116.7788 && y >= 1296.244 && x <= 303.6248&& y <= 1471.412) return 1; else return 0; }
pawn Код:
//exemplo de uso CMD:verificar(playerid, params[]) { if(!IsPlayerInGangZone(playerid)) return SendClientMessage(playerid,-1,"Vocк nгo estб na GangZone!"); SendClientMessage(playerid,-1,"Vocк estб na GangZone!"); return true; }
|
Mas ainda tenho dъvida, o meu querer й uma verificaзгo
, para ver se o player estб em uma GangZone, e ela irб ser aplicada na callback
...
Re: Identificando uma GangZone. -
-GooGle- - 30.05.2013
Acho que й mais ou menos isto que quer,pelo meu ver.
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new Nome[MAX_PLAYER_NAME],frase[70],fraseb[70];
GetPlayerName(playerid, Nome, sizeof(Nome));
format(frase,sizeof(frase),"%s morreu na GangZone!",Nome);
format(fraseb,sizeof(fraseb),"% morreu fora da GangZone!",Nome);
if(IsPlayerInGangZone(playerid)) return SendClientMessageToAll(-1,frase);
if(!IsPlayerInGangZone(playerid)) return SendClientMessageToAll(-1,fraseb);
return true;
}
Re: Identificando uma GangZone. -
AlucardSnow - 30.05.2013
Nгo sei se й oque quer, mais й mais ou menos isso que quer?
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(!IsPlayerInGangZone(playerid))
{
GivePlayerMoney(killerid, -500);
}
return 1;
}
Esse code se o player morto nao tiver na GangZone que o -******- postou lб, quem matou ele perde 500 reais.
Й isso que tu ta querendo mais ou menos?
Re: Identificando uma GangZone. -
Ley - 30.05.2013
Quote:
Originally Posted by AlucardSnow
Nгo sei se й oque quer, mais й mais ou menos isso que quer?
pawn Код:
public OnPlayerDeath(playerid, killerid, reason) { if(!IsPlayerInGangZone(playerid)) { GivePlayerMoney(killerid, -500); } return 1; }
Esse code se o player morto nao tiver na GangZone que o -******- postou lб, quem matou ele perde 500 reais.
Й isso que tu ta querendo mais ou menos?
|
Sim, й exatamente isso. Porйm, a variбvel da gangzone, й 'favela'. E й ela que eu quero identificar.
Aguardo respostas!
Re: Identificando uma GangZone. -
-GooGle- - 30.05.2013
Me passa o cуdigo em que a variavel Favela й usada para definir a gangzone criada,provavelmente deve estar em OnGameModeInit.
Re: Identificando uma GangZone. -
Ley - 30.05.2013
Quote:
Originally Posted by -******-
Me passa o cуdigo em que a variavel Favela й usada para definir a gangzone criada,provavelmente deve estar em OnGameModeInit.
|
Sim, ela se encontra na callback OnGameModeInit...
PHP код:
favela = GangZoneCreate(2029.868, -1125.23, 2284.658, -963.3729);
Re: Identificando uma GangZone. -
-GooGle- - 30.05.2013
pawn Код:
IsPlayerInFavela(playerid)
{
//Adicione isto ao final de seu gm
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid, x, y, z);
if(x >= 2029.868 && y >= -1125.23 && x <= 2284.658&& y <= -963.3729) return 1;
else return 0;
}
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(!IsPlayerInFavela(playerid))
{
GivePlayerMoney(killerid, -500);
SendClientMessage(killerid,-1,"Vocк perdeu 500 por matar fora da gangzone!");
}
return 1;
}
Re: Identificando uma GangZone. -
Ley - 30.05.2013
Quote:
Originally Posted by -******-
pawn Код:
IsPlayerInFavela(playerid) { //Adicione isto ao final de seu gm new Float:x,Float:y,Float:z; GetPlayerPos(playerid, x, y, z); if(x >= 2029.868 && y >= -1125.23 && x <= 2284.658&& y <= -963.3729) return 1; else return 0; }
pawn Код:
public OnPlayerDeath(playerid, killerid, reason) { if(!IsPlayerInFavela(playerid)) { GivePlayerMoney(killerid, -500); SendClientMessage(killerid,-1,"Vocк perdeu 500 por matar fora da gangzone!"); } return 1; }
|
Irei testar.