Duel System bugged - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Duel System bugged (
/showthread.php?tid=647296)
Duel System bugged -
NealPeteros - 02.01.2018
The problem of my duel system is that it doesn't show the player he asked for the duel the information:
PHP код:
format(string, sizeof(string), "You have been invited to a %s duel by %s. /ad to accept or /dd to deny", mode, DuelInfo[did][Host]);
SendClientMessage(dinvitee[playerid][i], 0x0000FFFF, string);
whole duel pastebin
PASTEBIN
Re: Duel System bugged -
m4karow - 02.01.2018
oh my god this code is sooo bad...
maybe first try to change 'return 1;' to 'continue' at line 242.
Код:
new mode[6 + 1];
for(new i=0; i<8; i++)
{
if(!IsPlayerConnected(i))
continue;
if(DuelInfo[did][Mode] == 1) format(mode, sizeof mode, "1 v 1");
if(DuelInfo[did][Mode] == 2) format(mode, sizeof mode, "2 v 2");
if(DuelInfo[did][Mode] == 3) format(mode, sizeof mode, "3 v 3");
if(DuelInfo[did][Mode] == 4) format(mode, sizeof mode, "4 v 4");
format(string, sizeof(string), "You have been invited to a %s duel by %s. /ad to accept or /dd to deny", mode, DuelInfo[did][Host]);
SendClientMessage(dinvitee[playerid][i], 0x0000FFFF, string);
printf("%i", dinvitee[playerid][i]);
}
Re: Duel System bugged -
NealPeteros - 04.01.2018
Sorry about the messiness of the code.
The printed value is
65535
Re: Duel System bugged -
Logic_ - 04.01.2018
65535 is the value of INVALID_PLAYER_ID means 'non-connected player'.
Re: Duel System bugged -
NealPeteros - 04.01.2018
Now that makes sense, thanks
Re: Duel System bugged -
m4karow - 04.01.2018
then you should use
Код:
if(!IsPlayerConnected(dinvitee[playerid][i]))
instead of
Код:
if(!IsPlayerConnected(i))