Disable Commands -
Saleem - 21.07.2013
hello i want to disable all commands while player in in this match
also i want /leave command for this macth please help me
PHP код:
if(strcmp(cmdtext, "/onehit", true) == 0)
{
new msg[128];
new playerName[MAX_PLAYER_NAME], RandomSpawn = random(5);
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
if (RandomSpawn == 0)
{
SetPlayerPos(playerid, 22.7227,2245.2556,126.6797);
}
if (RandomSpawn == 1)
{
SetPlayerPos(playerid, 33.6609,2238.2681,126.6797);
}
if (RandomSpawn == 2)
{
SetPlayerPos(playerid, 27.3105,2233.2581,126.6797);
}
if (RandomSpawn == 3)
{
SetPlayerPos(playerid, 41.3499,2227.5371,125.0820);
}
if (RandomSpawn == 4)
{
SetPlayerPos(playerid, 29.9060,2230.6448,126.4038);
}
SetCameraBehindPlayer(playerid);
SetPlayerHealth(playerid, 1);
ResetPlayerWeapons(playerid);
format(msg,sizeof(msg),"%s [%i] Has Joined One hit kill Death match : [/onehit]",playerName,playerid);
SendClientMessageToAll(COLOR_CYAN,msg);
return 1;
}
Re: Disable Commands -
ConnorHunter - 21.07.2013
What is the match? Can you provide more detailed explanations?
Re: Disable Commands -
Saleem - 22.07.2013
this is one hit kill death match
Re: Disable Commands -
Saleem - 22.07.2013
help plz
Re: Disable Commands -
Champ - 22.07.2013
Simple. Create a variable like
pawn Код:
new InOneHit[MAX_PLAYERS];
then when player join the match set variable value to 1.
pawn Код:
if(!strcmp(cmdtext, "/onehit", true))
{
InOneHit[playerid] = 1;
return 1;
}
then when players uses anyother command while in deathmatch. return it to an error
pawn Код:
if(InOneHit[playerid] == 1) return SendClientMessage(playerid,0xAA3333AA,"[ERROR]You cant use commands while in a Deathmatch");
Re: Disable Commands -
Th3b3ast5 - 22.07.2013
Nevermind
Re: Disable Commands -
JimmyCh - 22.07.2013
Alright, you can do this many ways, but the best way would be like this:
pawn Код:
new InDM[MAX_PLAYERS];
// now i dont know if this is an event or anything but
OnPlayerConnect >> InDM[playerid] = 0;
//Im sure you want it that if they die there, they spawn back there so on ur code u add this
if(InDM[playerid] == 1
// then the rest of ur code comes here
//now u wanted to disable commands if they are inside the arena,
//u can put on each cmd like this:
if(InDM[playerid]==0)
{
// ur code of CMD here
//this will disable the certain cmd in the arena
Re: Disable Commands -
Areax - 22.07.2013
At the top of your script put:
Then put this in your command /onehit
And, here is the /leave command:
pawn Код:
if(strcmp(cmdtext, "/leave", true) == 0)
{
new msg[128];
new playerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
if(OneHit[playerid] == 0)return SendClientMessage(playerid, COLOR_CYAN, "You Aren't in One hit kill Death Match: [/onehit]");
SetPlayerHealth(playerid, -1);
format(msg,sizeof(msg),"%s [%i] Has Left One hit kill Death match : [/onehit]",playerName,playerid);
SendClientMessageToAll(COLOR_CYAN,msg);
OneHit[playerid] = 0;
return 1;
}
NOTE: Fixed..
Re: Disable Commands -
JimmyCh - 22.07.2013
Your /leave cmd is wrong, you should atleast put:
pawn Код:
CMD:leave(playerid, params[])
{
If(InDM[playerid] == 0) return SendClientMessage(playerid, -1, "You are not at the One Hit stadium(wtvr)");
else if (InDM[playerid] == 1)
{
InDM[playerid] = 0;
SetPlayerHealth(playerid, 0);
// and what else u wanna put in ur code
}
return 1;
}
Re: Disable Commands -
Champ - 22.07.2013
and to make leave command ↓
pawn Код:
if(strcmp(cmdtext, "/onehit", true) == 0)
{
new string[600],pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
if(IsPlayerInDM[playerid] == 0) return SendClientMessage(playerid, COLOR_RED, "You already leave MJ's DM Arena!");
IsPlayerInDM[playerid] = 0;
SetPlayerPos(playerid, x, y, z);
format(string, sizeof(string), "%s has left One Hit Deathmatch Arena", pname);
SendClientMessageToAll(COLOR_GREEN, string);
SendClientMessage(playerid, COLOR_RED, "You left One Hit Deathmatch");
return 1;
}
to make this command work properly. you have to define color_red and color_green and change the setplayerpos coordinates. This is an example command.