24.09.2015, 06:03
Olб, eu estou sofrendo um problema muito estranho na minha GM, que afeta a mostra de resultados de duel, tipo:
"Fulano venceu Sicrano sobrando 160 de vida em 5 segundos"
O que estб acontecendo й o seguinte:
Porйm й o seguinte, o vencedor ganha normalmente o premio por eliminar um player e os 2 sгo respawnados normalmente, eu fiz debug das variбveis para ver se tinha alguma divergкncia e nada, quando o duel ocorre tudo fica como deveria ser.
OBS: esse code de duel foi feito pelo arakuta (laranja_azul) na sua GM do HardDM, eu coloquei os devidos crйditos na GM, o timer pra contar os segundos foi uma tentativa que quase deu certo.
Bem, eu nгo faзo a minima ideia do que estб causando isso.
Callback OnPlayerDeath:
Eu tф aprendendo a scriptar sozinho, eu fiz o code praticamente sozinho entгo nгo julgue se ta mal otimizado, sу quero descobrir o que estб acontecendo
Eu to achando que й aquele bug do sscanf do ID 0, sei lб, nгo faзo a minima ideia :/
Agradeзo desde jб.
"Fulano venceu Sicrano sobrando 160 de vida em 5 segundos"
O que estб acontecendo й o seguinte:
- Quando o id 0 tira duel com o id 1 os resultados aparecem normalmente.
- Quando o id 0 tira duel com o id 2 os resultados nгo aparecem.
- Quando o id 1 tira duel com o id 2 sу aparecem resultados de perfect.
- Entre outras combinaзхes...
Porйm й o seguinte, o vencedor ganha normalmente o premio por eliminar um player e os 2 sгo respawnados normalmente, eu fiz debug das variбveis para ver se tinha alguma divergкncia e nada, quando o duel ocorre tudo fica como deveria ser.
Код:
KillTimer(dueltimerid[killerid]); KillTimer(dueltimerid[playerid]); new wl[500]; new Float:result,Float:life,Float:armour,segundos; if(dueltimer[playerid] == 0) { KillTimer(dueltimer[killerid]); segundos = dueltimer[killerid]; } else if(dueltimer[killerid] == 0) { KillTimer(dueltimer[playerid]); segundos = dueltimer[playerid]; } GetPlayerArmour(killerid,armour); GetPlayerHealth(killerid,life); result = life + armour; if(result >= 200) { format(wl,sizeof wl,"{0EBEF1}[DUEL] O Player {FFFFFF}%s{0EBEF1} venceu{FFFFFF} %s {0EBEF1}de {FFFF00}perfect!! {0EBEF1}em {FFFFFF}%d {0EBEF1}segundos!",GetName(killerid),GetName(playerid),segundos); } else { format(wl,sizeof wl,"{0EBEF1}[DUEL] O Player {FFFFFF}%s {0EBEF1}venceu {FFFFFF}%s, {0EBEF1}sobrando {FFFFFF}%d {0EBEF1}em {FFFFFF}%d {0EBEF1}segundos.",GetName(killerid),GetName(playerid),floatround(result),segundos); } SendClientMessageToAll(-1,wl); SpawnPlayer(killerid); OnPlayerKillingSpree(killerid,0,100); printf("killerid: %d , duelvar:%d ,segundos:%d", killerid, Duel[killerid], dueltimer[killerid]); printf("playerid: %d , duelvar:%d ,segundos:%d", playerid, Duel[playerid], dueltimer[playerid]); printf("Result: %d", floatround(result)); printf("Result: %f", result); dueltimer[killerid] = -1; dueltimer[playerid] = -1;
Bem, eu nгo faзo a minima ideia do que estб causando isso.
Callback OnPlayerDeath:
Код:
if(killerid != INVALID_PLAYER_ID) { PlayerInfo[killerid][Matou] ++; switch(randomdeathmsg) { case 0:format(strmorte,sizeof(strmorte),"~r~%s ~w~pipocou voce!",GetName(killerid)); case 1:format(strmorte,sizeof(strmorte),"~r~%s ~w~estracalhou voce!",GetName(killerid)); case 2:format(strmorte,sizeof(strmorte),"~r~%s ~w~dilacerou voce!",GetName(killerid)); case 3:format(strmorte,sizeof(strmorte),"~r~%s ~w~esbagacou voce!",GetName(killerid)); case 4:format(strmorte,sizeof(strmorte),"~r~%s ~w~triturou voce!",GetName(killerid)); } format(strmatou,sizeof(strmatou),"Voce matou:~w~ %s",GetName(playerid)); PlayerTextDrawSetString(killerid,pAnn[killerid][7],strmatou); PlayerTextDrawShow(killerid,pAnn[killerid][7]); KillTimer(timerptd[killerid][0]); timerptd[killerid][0] = SetTimerEx("SumirTDFragInfo", 3000, false, "i", killerid); Morto[playerid] = true; if(Duel[playerid] != 998 && Duel[killerid] != 998) { OnPlayerDuelEnd(playerid,killerid); } else if(Emarena[playerid] == true || HSARENA[playerid] == true) { SetPlayerHealth(killerid,100); SetPlayerArmour(killerid,100); SendClientMessage(killerid, Amarelo, "~Info~ Kill em arenas contam metade do XP"); OnPlayerKillingSpree(killerid,0,50); } else { OnPlayerKillingSpree(killerid,0,100); } } else { format(strmorte,sizeof(strmorte),"Voce se suicidou."); } PlayerTextDrawSetString(playerid,pAnn[playerid][11],strmorte); PlayerTextDrawShow(playerid,pAnn[playerid][11]); KillTimer(timerptd[playerid][0]); timerptd[playerid][0] = SetTimerEx("SumirTDFragInfo", 1000, false, "i", playerid); return 1; }
Eu to achando que й aquele bug do sscanf do ID 0, sei lб, nгo faзo a minima ideia :/
Agradeзo desde jб.