Deathmatch help - 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: Deathmatch help (
/showthread.php?tid=149693)
Deathmatch help -
Jay. - 23.05.2010
Hey guy's I'm working on a /dm command but i've just realized that the players can use the teleports in the dm how to
disable this?
To like "Sorry you cannot use commands, While your in a dm"
Thanks
(Jay)
Re: Deathmatch help -
Niixie - 23.05.2010
I'll help you, but i dont really have a good way to explain it. To you have teamviewer?
Re: Deathmatch help -
Jay. - 23.05.2010
Quote:
Originally Posted by [MWR
Niixie ]
I'll help you, but i dont really have a good way to explain it. To you have teamviewer?
|
Yes, But can you try to explain it in a code first?
Re: Deathmatch help -
Niixie - 23.05.2010
Sure, erm.
You know like when you check if a player is logged in.
I bet you have one look'a'like to check if the player is in the DM. if not, then go to the top and do
Code:
new IsPlayerInDM[MAX_PLAYERS];
then when a player enters the DM put it in like
Code:
DCMD_COMMANDNAME(blablabla)
{
if(IsPlayerInDM[playerid] == 0)
{
//Rest of the code.
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Sorry you cannot use commands, While your in a dm");
}
return 1;
}
Re: Deathmatch help -
Jay. - 23.05.2010
Quote:
Originally Posted by [MWR
Niixie ]
Sure, erm.
You know like when you check if a player is logged in.
I bet you have one look'a'like to check if the player is in the DM. if not, then go to the top and do
Code:
new IsPlayerInDM[MAX_PLAYERS];
then when a player enters the DM put it in like
Code:
DCMD_COMMANDNAME(blablabla)
{
if(IsPlayerInDM[playerid] == 0)
{
//Rest of the code.
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Sorry you cannot use commands, While your in a dm");
}
return 1;
}
|
Will i have to add this to all my Dms?
Re: Deathmatch help -
Andy_McKinley - 23.05.2010
Quote:
Originally Posted by (Jay)
Quote:
Originally Posted by [MWR
Niixie ]
Sure, erm.
You know like when you check if a player is logged in.
I bet you have one look'a'like to check if the player is in the DM. if not, then go to the top and do
Code:
new IsPlayerInDM[MAX_PLAYERS];
then when a player enters the DM put it in like
Code:
DCMD_COMMANDNAME(blablabla)
{
if(IsPlayerInDM[playerid] == 0)
{
//Rest of the code.
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Sorry you cannot use commands, While your in a dm");
}
return 1;
}
|
Will i have to add this to all my Dms?
|
I you want to disable all!
Re: Deathmatch help -
Jay. - 23.05.2010
Quote:
Originally Posted by DarkPhoenix
Quote:
Originally Posted by (Jay)
Quote:
Originally Posted by [MWR
Niixie ]
Sure, erm.
You know like when you check if a player is logged in.
I bet you have one look'a'like to check if the player is in the DM. if not, then go to the top and do
Code:
new IsPlayerInDM[MAX_PLAYERS];
then when a player enters the DM put it in like
Code:
DCMD_COMMANDNAME(blablabla)
{
if(IsPlayerInDM[playerid] == 0)
{
//Rest of the code.
}
else
{
SendClientMessage(playerid, 0xFF0000AA, "Sorry you cannot use commands, While your in a dm");
}
return 1;
}
|
Will i have to add this to all my Dms?
|
I you want to disable all!
|
Ah ye i do thanks lol.
Re: Deathmatch help -
Niixie - 23.05.2010
No Problem
Re: Deathmatch help -
dice7 - 23.05.2010
Or a much simpler version
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp(cmdtext, "/leavedm") == 0)
{
IsPlayerInDM[playerid] = 0;
SendClientMessage(playerid, COLOR_RED, "You left the dm, you can now use other commands");
return 1;
}
if (IsPlayerInDM[playerid] != 0) return SendClientMessage(playerid, COLOR_RED, "You can't use commands while in a dm");
//other commands
return 0;
}
Re: Deathmatch help -
Jay. - 23.05.2010
Quote:
Originally Posted by dice7
Or a much simpler version
pawn Code:
public OnPlayerCommandText(playerid, cmdtext[]) { if (strcmp(cmdtext, "/leavedm") == 0) { IsPlayerInDM[playerid] = 0; SendClientMessage(playerid, COLOR_RED, "You left the dm, you can now use other commands"); return 1; }
if (IsPlayerInDM[playerid] != 0) return SendClientMessage(playerid, COLOR_RED, "You can't use commands while in a dm");
//other commands
return 0; }
|
Ah ye this works to Thanks both of you