15.10.2013, 19:39
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.
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; }
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; }
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; } |