Disable Command!
#1

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!
Reply
#2

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");
Reply
#3

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.
Reply
#4

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...
Reply
#5

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.
Reply
#6

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

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!
Reply
#8

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");
Reply
#9

I did this!
Reply
#10

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


Forum Jump:


Users browsing this thread: 2 Guest(s)