Races problem
#1

Hello guys!

I have a minor problem lol xD

The problem is: When i am in a race, i am able to use all types of cmds, and i just want 1 command to work in races, and thats /exit race.

I think i need a string of some kind, but my mind stops there. When people are in /race, i want all cmds disabled except /exit race

Thanks for help anyways!
Reply
#2

Create something like

pawn Код:
new g_racing[MAX_PLAYERS]
(or use pvars)

Set g_racing[playerid] to true for racing players, and then in each disabled command check if(!g_racing[playerid]) otherwise don't proceed.
Reply
#3

I tried this in dm.i use ZCMD.So my commands little code is here

Код:
public OnPlayerSpawn(playerid)
{
	if(GetPVarInt(playerid,"InSniperDM") == 1)
	{
	    SendClientMessage(playerid,COLOR_RED,"You will respawn in dm areas untill you type {FF0000}/leavedm");
   		GivePlayerWeapon(playerid,34,999999);
   		SetPVarInt(playerid,"InDeathMatch",1);
  		SetPVarInt(playerid,"InSniperDM",1);
		new Random = random(sizeof(RandomSpawnsDM));
		SetPlayerPos(playerid, RandomSpawnsDM[Random][0], RandomSpawnsDM[Random][1], RandomSpawnsDM[Random][2]);
		return SetPlayerFacingAngle(playerid, RandomSpawnsDM[Random][3]);
	}
	if(GetPVarInt(playerid,"InBFDM") == 1)
	{
	    SendClientMessage(playerid,COLOR_RED,"You will respawn in dm areas untill you type {FF0000}/leavedm");
		GivePlayerWeapon(playerid,34,999999);
		GivePlayerWeapon(playerid,26,999999);
		GivePlayerWeapon(playerid,28,999999);
		GivePlayerWeapon(playerid,24,999999);
		SetPVarInt(playerid,"InDeathMatch",1);
  		SetPVarInt(playerid,"InBFDM",1);
		new Random = random(sizeof(RandomSpawnsDMINBF));
		SetPlayerPos(playerid, RandomSpawnsDMINBF[Random][0],RandomSpawnsDMINBF[Random][1], RandomSpawnsDMINBF[Random][2]);
		return SetPlayerFacingAngle(playerid, RandomSpawnsDMINBF[Random][3]);
	}

CMD:st1(playerid,params[])
{

    if(GetPVarInt(playerid,"InSniperDM") == 1) return SendClientMessage(playerid,COLOR_RED,"ERROR:You Cant Use This Command When You are In A Deathmatch");
    if(GetPVarInt(playerid,"InDeathMatch") == 1) return SendClientMessage(playerid,COLOR_RED,"ERROR:You Cant Use This Command When You are In A Deathmatch");
	if (IsPlayerInAnyVehicle(playerid))
	{
 		SetVehiclePos(GetPlayerVehicleID(playerid),-2967.3865,471.7879,4.9141);
	    SetVehicleZAngle(GetPlayerVehicleID(playerid),91.6934);
	}
	else
	{
 		SetPlayerPos(playerid,-2967.3865,471.7879,4.9141);
	    SetPlayerFacingAngle(playerid, 91.6934);
	}
	SendClientMessage(playerid,COLOR_GREEN,"Welcome to Stuntrun 1{FFFF00}[/St1]");
	PlayerPlaySound(playerid,1085,0.0,0.0,0.0);
	return 1;
}
It may help u dude
Reply
#4

aha, so i need f.ex:

g_racing[playerid] = 1

(thats set to true, right? )
Reply
#5

Yup. Set it up when player enters the race, and remove when he uses /exit
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)