SA-MP Forums Archive
Disable Command! - 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: Disable Command! (/showthread.php?tid=153594)



Disable Command! - ColdXX - 09.06.2010

Hey!
Me again ....bla bla bla

I have a Vehicle Spawn FS (/v car id)!
I want to disable the /v command at DM areas but idk how since its another FS and the DM areas are in the GM!

thanks!


Re: Disable Command! - RyDeR` - 09.06.2010

Set a variable... I recommand PVars.
If player is in DM use SetPVarInt(playerid, "InDM", true);
if he exits SetPVarInt(playerid, "InDM", false);
Then in cmd: if(GetPVarInt(playerid, "InDM")) return SendClientMessage(playerid, RED, "You can't use this command in DM");


Re: Disable Command! - Joe_ - 09.06.2010

Put the command into your gamemode.

pawn Код:
//top of script

new DM[MAX_PLAYERS];

//OnPlayerConnect & OnPlayerDisconnect

DM[playerid] = 0;

//Under the command which you use to teleport you to the DM

DM[playerid] = 1;

//Under the command to remove u from the DM

DM[playerid] = 0;

//then, under the command '/v' add a check

if(DM[playerid]) return SendClientMessage(playerid, COLOR, "You can't use this command in a DM zone");
Or as above said, use pVars, I still use arrays though, not got round to using pVars.


Re: Disable Command! - ColdXX - 09.06.2010

Quote:
Originally Posted by Joe_
Put the command into your gamemode.

pawn Код:
//top of script

new DM[MAX_PLAYERS];

//OnPlayerConnect & OnPlayerDisconnect

DM[playerid] = 0;

//Under the command which you use to teleport you to the DM

DM[playerid] = 1;

//Under the command to remove u from the DM

DM[playerid] = 0;

//then, under the command '/v' add a check

if(DM[playerid]) return SendClientMessage(playerid, COLOR, "You can't use this command in a DM zone");
Or as above said, use pVars, I still use arrays though, not got round to using pVars.
Ummm but if there is the FS...should i do something in the FS aswell?
I mean...


Re: Disable Command! - Joe_ - 09.06.2010

Quote:
Originally Posted by ColdXX
Quote:
Originally Posted by Joe_
Put the command into your gamemode.

pawn Код:
//top of script

new DM[MAX_PLAYERS];

//OnPlayerConnect & OnPlayerDisconnect

DM[playerid] = 0;

//Under the command which you use to teleport you to the DM

DM[playerid] = 1;

//Under the command to remove u from the DM

DM[playerid] = 0;

//then, under the command '/v' add a check

if(DM[playerid]) return SendClientMessage(playerid, COLOR, "You can't use this command in a DM zone");
Or as above said, use pVars, I still use arrays though, not got round to using pVars.
i've tried this but didnt work! ill try what ryder said!
That does work.


Re: Disable Command! - RyDeR` - 09.06.2010

Quote:
Originally Posted by ColdXX
i've tried this but didnt work! ill try what ryder said!
It should work. Actually both..


Re: Disable Command! - ColdXX - 09.06.2010

this is a part from the code i have created

pawn Код:
dcmd_vehicle(playerid, params[])

return dcmd_v(playerid, params);

dcmd_v(playerid, params[])
{
if(VEH[playerid] == 1) return SendClientMessage(playerid, red, "You can't use this command while at DM area");
{
new idx,iString[128];
if (params[0] == '\0') // Same effect as a !strlen check.
{
SendClientMessage(playerid, 0xFF4040FF, "[USAGE]: /v MODELID/NAME or /vehicle MODELID/NAME");
return 1;
}
But aint working
I have few thigs like this that work perfect!


Re: Disable Command! - Joe_ - 09.06.2010

pawn Код:
//top of script

new VEH[MAX_PLAYERS];

//OnPlayerConnect & OnPlayerDisconnect

VEH[playerid] = 0;

//Under the command which you use to teleport you to the DM

VEH[playerid] = 1;

//Under the command to remove u from the DM

VEH[playerid] = 0;

//then, under the command '/v' add a check

if(VEH[playerid]) return SendClientMessage(playerid, COLOR, "You can't use this command in a DM zone");



Re: Disable Command! - ColdXX - 09.06.2010

I did this!


Re: Disable Command! - Joe_ - 09.06.2010

You haven't, I just tested this, IT WORKS.