Limit max players in a deathmatch ? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Limit max players in a deathmatch ? (
/showthread.php?tid=148520)
Limit max players in a deathmatch ? -
Shoko Lacho - 17.05.2010
Hi, everything in the title, I search how to limit the number max of players in a deathmatch, for example:
PlayerA type /dm3 > He is teleported in the deathmatch
PlayerB type /dm3 > He is teleported too in the deathmatch
PlayerC type /dm3 > He got an error message like "deathmatch 3 is full" and he can't join the deathmatch.
Can someone help me please ?
Re: Limit max players in a deathmatch ? -
Jeffry - 17.05.2010
Just an short example:
pawn Код:
new DM3Joiners;
new DMParticipant[MAX_PLAYERS];
//at the cmd
if(DMParticipant[playerid]==1) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are already in a deatmatch.");
if(DM3Joiners>=3)
{
//Your code....then
DM3Joiners++;
DMParticipant[playerid]=1;
}
else
{
return SendClientMessage(playerid, COLOR_RED, "Dm 3 is full.");
}
//OnPlayerDeath
DM3Joiners--;
DMParticipant[playerid]=0;
//OnPlayerDisconnect
DMParticipant[playerid]=0;
This was just fast typed.
If you have any questions, or any errors, or something more, just let me know.
Jeffry
Re: Limit max players in a deathmatch ? -
deather - 17.05.2010
At the top:
Код:
new dm3;// to count players joined.
In OnPlayerCommandText
Код:
if(strcmp("/pm", cmdtext, true) == 0)
{
if(dm3 == 0)
{
dm3++;
// make player teleport to deathmatch
}
if(dm3 == 2)
{
SendClientMessage(playerid, COLOR, "The deathmatch is full. You have to wait.");
}
return 1;
}
Re: Limit max players in a deathmatch ? -
Naxix - 17.05.2010
Quote:
Originally Posted by |)ЂΩ†{−}ЂR™ – Dare To Die
At the top:
Код:
new dm3;// to count players joined.
In OnPlayerCommandText
Код:
if(strcmp("/pm", cmdtext, true) == 0)
{
if(dm3 == 0)
{
dm3++;
// make player teleport to deathmatch
}
if(dm3 == 2)
{
SendClientMessage(playerid, COLOR, "The deathmatch is full. You have to wait.");
}
return 1;
}
|
Your code wont work, as only 1 player can join as you did "if(dm3 == 0)" has to be like "if(dm3 < 2)"
Re: Limit max players in a deathmatch ? -
Shoko Lacho - 17.05.2010
It works, thanks =)
Re: Limit max players in a deathmatch ? -
deather - 18.05.2010
Quote:
Originally Posted by Naxix
Quote:
Originally Posted by |)ЂΩ†{−}ЂR™ – Dare To Die
At the top:
Код:
new dm3;// to count players joined.
In OnPlayerCommandText
Код:
if(strcmp("/pm", cmdtext, true) == 0)
{
if(dm3 == 0)
{
dm3++;
// make player teleport to deathmatch
}
if(dm3 == 2)
{
SendClientMessage(playerid, COLOR, "The deathmatch is full. You have to wait.");
}
return 1;
}
|
Your code wont work, as only 1 player can join as you did "if(dm3 == 0)" has to be like "if(dm3 < 2)"
|
oh yea. Mistake!! :P