Help with easy command
#1

I need help with a command. I want to make a duty command using zcmd, so if I type /duty I go on duty and if I type it again I go off duty.
Reply
#2

Код:
new DutySomething[MAX_PLAYERS] = 0; + OnPlayerConnect DutySomething[playerid] = 0;
Код:
CMD:duty(playerid, params[])
{
    if(DutySomething[playerid] == 0)
	{
 		//Duty Goes Here On
 		DutySomething[playerid] = 1;
	}
   	else if(DutySomething[playerid] == 1)
	{
    	//Duty Goes Here Off
   		DutySomething[playerid] = 0;
	}
	return 1;
}
Reply
#3

try this
Код:
CMD:aduty(playerid,params[])
{
   if(PlayerInfo[playerid][Level] >= 1)
   {
         if(PlayerInfo[playerid][OnDuty] == 0) {
         PlayerInfo[playerid][OnDuty] = 1;
	     new str[128], AdminName[28];
         GetPlayerName(playerid, AdminName, sizeof(AdminName));
         format(str, sizeof(str), "%s is now on Admin duty!", AdminName);
         SendClientMessageToAll(red, str);
         SetPlayerSkin(playerid,217);
         SetPlayerTeam(playerid, 6);
   	     SetPlayerColor(playerid, 0xF600F6FF);
         SetPlayerHealth(playerid, 100000000000);
         SetPlayerArmour(playerid, 100000000000);
		 ResetPlayerWeapons(playerid);
         GivePlayerWeapon(playerid, 38,999999999);
         Update3DTextLabelText(RankLabel[playerid], 0xFFFFFFFF, " ");
         gTeam[playerid] = TEAM_NONE;
         }
         else if(PlayerInfo[playerid][OnDuty] == 1) {
         PlayerInfo[playerid][OnDuty] = 0;
         new str[128], AdminName[28];
         GetPlayerName(playerid, AdminName, sizeof(AdminName));
         format(str, sizeof(str), "%s is now off Admin duty", AdminName);
         SendClientMessageToAll(red, str);
         SetPlayerHealth(playerid, 0);
		 ForceClassSelection(playerid);
	     SetPlayerHealth(playerid, 0);
	     SetPlayerArmour(playerid, 0);
         new rand = random(sizeof(PlayerColors));
         SetPlayerColor(playerid, PlayerColors[rand]);
         FirstSpawn[playerid] = 1;
         }
   } else return 0;
   return 1;
}
Reply
#4

Quote:
Originally Posted by Tomix
Посмотреть сообщение
try this
Код:
CMD:aduty(playerid,params[])
{
   if(PlayerInfo[playerid][Level] >= 1)
   {
         if(PlayerInfo[playerid][OnDuty] == 0) {
         PlayerInfo[playerid][OnDuty] = 1;
	     new str[128], AdminName[28];
         GetPlayerName(playerid, AdminName, sizeof(AdminName));
         format(str, sizeof(str), "%s is now on Admin duty!", AdminName);
         SendClientMessageToAll(red, str);
         SetPlayerSkin(playerid,217);
         SetPlayerTeam(playerid, 6);
   	     SetPlayerColor(playerid, 0xF600F6FF);
         SetPlayerHealth(playerid, 100000000000);
         SetPlayerArmour(playerid, 100000000000);
		 ResetPlayerWeapons(playerid);
         GivePlayerWeapon(playerid, 38,999999999);
         Update3DTextLabelText(RankLabel[playerid], 0xFFFFFFFF, " ");
         gTeam[playerid] = TEAM_NONE;
         }
         else if(PlayerInfo[playerid][OnDuty] == 1) {
         PlayerInfo[playerid][OnDuty] = 0;
         new str[128], AdminName[28];
         GetPlayerName(playerid, AdminName, sizeof(AdminName));
         format(str, sizeof(str), "%s is now off Admin duty", AdminName);
         SendClientMessageToAll(red, str);
         SetPlayerHealth(playerid, 0);
		 ForceClassSelection(playerid);
	     SetPlayerHealth(playerid, 0);
	     SetPlayerArmour(playerid, 0);
         new rand = random(sizeof(PlayerColors));
         SetPlayerColor(playerid, PlayerColors[rand]);
         FirstSpawn[playerid] = 1;
         }
   } else return 0;
   return 1;
}
What? Is this magically suppose to work with all these variables and enumerators? This will return a lot of errors and warnings including undefined symbol's... don't just put a code here that you grabbed off of another GM, every GM is different.
Reply
#5

@David

Thank you. And for you others, I didn't ask for the whole command just how to make it that you type /duty and it goes off and on with the same command.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)