SA-MP Forums Archive
OnPlayerCommandText - 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: OnPlayerCommandText (/showthread.php?tid=507412)



OnPlayerCommandText - Ghazal - 17.04.2014

Hello,
So i have added this under OnPlayerCommandText

Код:
	   if(Minigames[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"You cant use  commands now."), 0;
And its working fine

But i got a question .. I want to enable just one command When player is in minigames

Help please.


Re: OnPlayerCommandText - offon - 17.04.2014

Define a variable and use it to check if the player is in the minigame.


Re: OnPlayerCommandText - HitterHitman - 17.04.2014

Then add that command above the line. I believe it will work.


Re: OnPlayerCommandText - Gaurav_Rawat - 17.04.2014

While creating your command
use the variable
CMD:balbla(playerid,params[])
{
if(Minigames[playerid] == 1)
{
Your things
}
return 1;
}


Re: OnPlayerCommandText - Hanuman - 17.04.2014

Just try to put ur command above that line
pawn Код:
//your command
if(Minigames[playerid] == 1) return SendClientMessage(playerid,COLOR_RED,"You cant use  commands now."), 0;



Re: OnPlayerCommandText - Bingo - 17.04.2014

https://sampforum.blast.hk/showthread.php?tid=507362

I explained you right?

pawn Код:
dcmd_command(playerid,params[])
{
if(Minigames[playerid] == 1)
{
SendClientMessage........
//goes your stuff
}
return 1;
}



Re: OnPlayerCommandText - Ghazal - 17.04.2014

Quote:
Originally Posted by Bingo
Посмотреть сообщение
https://sampforum.blast.hk/showthread.php?tid=507362

I explained you right?

pawn Код:
dcmd_command(playerid,params[])
{
if(Minigames[playerid] == 1)
{
SendClientMessage........
//goes your stuff
}
return 1;
}
Dude, Will i just add that if in 200 command? lol.


Re: OnPlayerCommandText - Bingo - 17.04.2014

Quote:
Originally Posted by Maro06
Посмотреть сообщение
Dude, Will i just add that if in 200 command? lol.
You stated above only 'one' cmd, So which cmd you want that players can use while in minigames you've to add .


Re: OnPlayerCommandText - Hanuman - 17.04.2014

Quote:
Originally Posted by Bingo
Посмотреть сообщение
https://sampforum.blast.hk/showthread.php?tid=507362

I explained you right?

pawn Код:
dcmd_command(playerid,params[])
{
if(Minigames[playerid] == 1)
{
SendClientMessage........
//goes your stuff
}
return 1;
}
I think Bingo has forgotten to add "||Minigames[playerid] == 0" bcoz he need's that the player can use his command inside minigame as well as outside minigame.

From Bingo codes u should do it like this.
pawn Код:
dcmd_command(playerid,params[])
{
if(Minigames[playerid] == 1 || Minigames[playerid] == 0)
{
SendClientMessage........
//goes your stuff
}
return 1;
}



Re: OnPlayerCommandText - Bingo - 17.04.2014

Quote:
Originally Posted by Hanuman
Посмотреть сообщение
I think Bingo has forgotten to add "||Minigames[playerid] == 0" bcoz he need's that the player can use his command inside minigame as well as outside minigame.

From Bingo codes u should do it like this.
pawn Код:
dcmd_command(playerid,params[])
{
if(Minigames[playerid] == 1 || Minigames[playerid] == 0)
{
SendClientMessage........
//goes your stuff
}
return 1;
}
if(Minigames[playerid] == 1 - If player in minigame
Minigames[playerid] == 0) - If player not in minigame

So he wants some commands to be utilizied inside minigame so this (if(Minigames[playerid] == 1).