[Ajuda] Tesouro - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (
https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Tesouro (
/showthread.php?tid=555955)
Tesouro -
davinfs - 09.01.2015
Olб, eu tenho um sistema de Tesouro, so que o seguinte, quando eu coloco o tesouro todo mundo do servidor pode pegar, e se alguem pegar e tiver outro player perto o dinheiro tbm vai pra quem ta perto,eu queria colocar pra pessoa que achar primeiro pegar, podem me ajudar nisso?
pawn Код:
if(newkeys == 16 && GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
new DinheiroTesouro = 20000 + random(50000);
new RespeitoTesouro = random(6);
new stringp[128];
if(tesourocriado[i] == 1)
{
if(IsPlayerInRangeOfPoint(i, 2.0,cX,cY,cZ))
{
new location[MAX_ZONE_NAME];
GetPlayer2DZone(i, location, MAX_ZONE_NAME);
format(stringp, sizeof(stringp), "[Tesouro BGL]:[%s] Encontrou o Tesouro Em:[%s] e Ganhou R$[%d] e de Respeito[%d].",PlayerName(i),location,DinheiroTesouro, RespeitoTesouro);
SendClientMessageToAll(COLOR_LIGHTBLUE,stringp);
GivePlayerMoney(i, DinheiroTesouro);
PlayerInfo[i][pExp] += RespeitoTesouro;
tesourocriado[i] = 0;
DestroyObject(tesouroobj[i]);
}
}
}
}
pawn Код:
if(strcmp(cmdtext, "/eventotesouro", true) == 0)
{
new strcone[128];
if(PlayerInfo[playerid][pAdmin] >= 2)
{
if(admtrampando[playerid] < 1 && PlayerInfo[playerid][pAdmin] != 1342 && PlayerInfo[playerid][pAdmin] != 1341 && PlayerInfo[playerid][pAdmin] != 1340)
{
SendClientMessage(playerid, COLOR_GRAD1, "Vocк nгo estб trabalhando! (/trabalhar)");
return 1;
}
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT) return SendClientMessage(playerid, COLOR_GRAD1, "Vocк Nao pode botar um Tesouro dentro de um veнculo.");
format(strcone, sizeof(strcone), "[Evento Tesouro]: O Admin %s Soltou Um Tesouro em algum lugar, Vб Atras dele e Receba Uma Recompensa!",name);
SendClientMessageToAll(COLOR_LIGHTBLUE, strcone);
GetPlayerPos(playerid, Xp, Yp, Zp);
cX = Xp;
cY = Yp;
cZ = Zp;
tesouroobj[playerid] = CreateObject(1550, Xp, Yp, Zp-0.65, 0, 0, 0);
SetPlayerPos(playerid, Xp, Yp, Zp+0.8);
format(strcone, sizeof(strcone), "EVENTO TESOURO INICIADO!");
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i)) GameTextForAll(strcone, 5000, 5);
tesourocriado[i] = 1;
}
return 1;
}
return 1;
}
Re: Tesouro -
Gii - 09.01.2015
pawn Код:
#define PEGO true
#define LIVRE false
new bool:statusTesouro = LIVRE;
// quando alguem pegar o tesouro
if ( !statusTesouro ) {
// pode pegar
statusTesouro = PEGO;
}
else {
SendClientMessage(playerid, -1, "O tesouro jб foi pego por alguйm!");
}
// no comando /eventotesouro
statusTesouro = LIVRE;