Problem about police duty
#1

Hi, inside game I wrote /rankfazione [id faction] [rank] [id] but it doesn't work, these are my codes can you help me? I want to let rank correspond to certain skin, how can I do through these codes?

Код:
else if(dialogid == 16 && response) //ShowPlayerDialog(playerid,16,DIALOG_STYLE_LIST,"Servizi Disponibili","Polizia\\nMilitare","Conferma","Esci");
	    {
		 switch(listitem)
	     {
		            case 0://police case
			        {
                            if(PlayerInfo[playerid][pFaction] != 0) return SendClientMessage(playerid, 0xFF0000AA, " Non fai parte della fazione POLIZIA");
                            ShowPlayerDialog(playerid,18,DIALOG_STYLE_LIST,"Polizia","Servizio","Ok","Chiudi");
							SetPlayerSkin(playerid, PlayerInfo[pRank][pSkin]);
			        }
			        case 1: //go out of the duty
			        {
							ResetPlayerWeapons(playerid);
							CopOnDuty[playerid] = 0;
							SetPlayerArmour(playerid, 0);
							SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
							SetPlayerToFactionColor(playerid);
							PlayerActionMessage(playerid,15.0,"toglie la divisa e ripone le armi e il distintivo");
							SetPlayerColor(playerid, WHITE);
						}
				}
		}
Код:
if(PlayerInfo[playerid][pFaction] == 0 || PlayerInfo[playerid][pFaction] == 1)//	if(PlayerInfo[playerid][pFaction] != 255
			{
					if(CopOnDuty[playerid])
					{
				 		if(rank == 1)
						{
						    format(wstring, sizeof(wstring), "[RADIO] %s %s: %s, passo.",DynamicFactions[faction][fRank1],GetPlayerNameEx(playerid),result);
						    ProxDetector(5.0, playerid, wstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
							if(PlayerInfo[playerid][pFaction] == 0) {
								SendFactionMessage(0, 0x33CCFFAA, wstring);
								SetPlayerSkin(playerid, 288);
								}
							else if(PlayerInfo[playerid][pFaction] == 1) {
								SendFactionMessage(1, 0x33CCFFAA, wstring);
								}
						    FactionChatLog(wstring);
						    PhoneAnimation(playerid);
						}
				 		else if(rank == 2)
						{
						    format(wstring, sizeof(wstring), "[RADIO] %s %s: %s, passo.",DynamicFactions[faction][fRank1],GetPlayerNameEx(playerid),result);
						    ProxDetector(5.0, playerid, wstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
							if(PlayerInfo[playerid][pFaction] == 0) {
								SendFactionMessage(0, 0x33CCFFAA, wstring);
								SetPlayerSkin(playerid, 282);
								}
							else if(PlayerInfo[playerid][pFaction] == 1) {
								SendFactionMessage(1, 0x33CCFFAA, wstring);
								}
						    FactionChatLog(wstring);
						    PhoneAnimation(playerid);
						}
				 		else if(rank == 3)
						{
						    format(wstring, sizeof(wstring), "[RADIO] %s %s: %s, passo.",DynamicFactions[faction][fRank1],GetPlayerNameEx(playerid),result);
						    ProxDetector(5.0, playerid, wstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
							if(PlayerInfo[playerid][pFaction] == 0) {
								SendFactionMessage(0, 0x33CCFFAA, wstring);
								SetPlayerSkin(playerid, 281);
								}
							else if(PlayerInfo[playerid][pFaction] == 1) {
								SendFactionMessage(1, 0x33CCFFAA, wstring);
								}
						    FactionChatLog(wstring);
						    PhoneAnimation(playerid);
						}
				 		else if(rank == 4)
						{
							format(wstring, sizeof(wstring), "[RADIO] %s %s: %s, passo.",DynamicFactions[faction][fRank1],GetPlayerNameEx(playerid),result);
						    ProxDetector(5.0, playerid, wstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
							if(PlayerInfo[playerid][pFaction] == 0) {
								SendFactionMessage(0, 0x33CCFFAA, wstring);
								SetPlayerSkin(playerid, 280);
								}
							else if(PlayerInfo[playerid][pFaction] == 1) {
								SendFactionMessage(1, 0x33CCFFAA, wstring);
								}
						    FactionChatLog(wstring);
						    PhoneAnimation(playerid);
						}
					}
		     		else
					{
						SendClientMessage(playerid,0xFF0000AA, "  Non sei in servizio!");
						
     				}
			}

_________________________________________________________________________________________________
	if(strcmp(cmd, "/Servizio", true) == 0)
	{
        if(IsPlayerConnected(playerid))
	    {

     if(PlayerToPoint(5.0, playerid,248.5919,1858.7484,14.0840))
				{
                     if(PlayerInfo[playerid][pFaction] == 1)
			         {
                          if(CopOnDuty[playerid] == 0)
                          {
ShowPlayerDialog(playerid,20,DIALOG_STYLE_LIST,"Servizio","Cecchino \nAssalto \nAddestramento \nEsci dal Servizio","Ok","Chiudi");
				                 CopOnDuty[playerid] = 1;
                          }
                          else
                          {
                                SendClientMessage(playerid,COLOR_LIGHTBLUE," Non sei piщ in servizio");
				                SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
				                CopOnDuty[playerid] = 0;
				                ResetPlayerWeapons(playerid);
							    CopOnDuty[playerid] = 0;
							    SetPlayerArmour(playerid, 0);
							    SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
						     PlayerActionMessage(playerid,15.0,"toglie la divisa e ripone le armi nell'armadietto");
                          }
                     }
                     else
                     {
                              SendClientMessage(playerid,0xFF0000AA,"Non sei un militare");
                     }
                }

_________________________________________________________________________________________________
	if(strcmp(cmd, "/inservizio", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if(PlayerInfo[playerid][pFaction] == 0)//	if(PlayerInfo[playerid][pFaction] != 255
			{
				if (PlayerToPoint(5.0, playerid,PoliceDutyPosition[X],PoliceDutyPosition[Y],PoliceDutyPosition[Z]))
				{
				     ShowPlayerDialog(playerid,16,DIALOG_STYLE_LIST,"Servizio","Polizia \nEsci dal Servizio","Ok","Chiudi");
				}
    			else
				{
					SendClientMessage(playerid, 0xFF0000AA, "  Non sei nella posizione giusta per andare /inservizio!");
					return 1;
				}
			}
   			else
			{
				SendClientMessage(playerid, 0xFF0000AA, "  Fazione Invalida.");
				return 1;
			}
		}
		return 1;
	}
Reply
#2

HELP ...........
Reply
#3

can you tell me what is its problem? and don't use strcmp it's too old.
Reply
#4

Use ZCMD. Strcmp is outdated and slow.
Reply
#5

Hello!

I don't know exactly what your problem is, but try this:
PHP код:
else if(dialogid == 16 && response)
{
    switch(
listitem)
    {
        case 
0:
        {
            if(
PlayerInfo[playerid][pFaction] != 0)return SendClientMessage(playerid0xFF0000AA" Non fai parte della fazione POLIZIA");
            
ShowPlayerDialog(playerid,18,DIALOG_STYLE_LIST,"Polizia","Servizio","Ok","Chiudi");
            
SetPlayerSkin(playerid,PlayerInfo[pRank][pSkin]);
        }
        case 
1:
        {
            
ResetPlayerWeapons(playerid);
            
CopOnDuty[playerid] = 0;
            
SetPlayerArmour(playerid,0);
            
SetPlayerSkin(playeridPlayerInfo[playerid][pSkin]);
            
SetPlayerToFactionColor(playerid);
            
PlayerActionMessage(playerid,15.0,"toglie la divisa e ripone le armi e il distintivo");
            
SetPlayerColor(playeridWHITE);
        }
    }
}
if(
PlayerInfo[playerid][pFaction] == || PlayerInfo[playerid][pFaction] == 1)
{
    if(!
CopOnDuty[playerid])return SendClientMessage(playerid,0xFF0000AA"  Non sei in servizio!");
    if(
rank == 1)
    {
        
format(wstring,sizeof wstring,"[RADIO] %s %s: %s, passo.",DynamicFactions[faction][fRank1],GetPlayerNameEx(playerid),result);
        
ProxDetector(5.0,playerid,wstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
        if(
PlayerInfo[playerid][pFaction] == 0)SendFactionMessage(0,0x33CCFFAA,wstring),SetPlayerSkin(playerid,288);
        else if(
PlayerInfo[playerid][pFaction] == 1)SendFactionMessage(1,0x33CCFFAA,wstring);
    }
    else if(
rank == 2)
    {
        
format(wstring,sizeof wstring,"[RADIO] %s %s: %s, passo.",DynamicFactions[faction][fRank2],GetPlayerNameEx(playerid),result);
        
ProxDetector(5.0playeridwstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
        if(
PlayerInfo[playerid][pFaction] == 0)SendFactionMessage(0,0x33CCFFAA,wstring),SetPlayerSkin(playerid,282);
        else if(
PlayerInfo[playerid][pFaction] == 1)SendFactionMessage(1,0x33CCFFAA,wstring);
    }
    else if(
rank == 3)
    {
        
format(wstringsizeof(wstring), "[RADIO] %s %s: %s, passo.",DynamicFactions[faction][fRank3],GetPlayerNameEx(playerid),result);
        
ProxDetector(5.0playeridwstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
        if(
PlayerInfo[playerid][pFaction] == 0)SendFactionMessage(00x33CCFFAAwstring),SetPlayerSkin(playerid281);
        else if(
PlayerInfo[playerid][pFaction] == 1)SendFactionMessage(10x33CCFFAAwstring);
    }
    else if(
rank == 4)
    {
        
format(wstringsizeof(wstring), "[RADIO] %s %s: %s, passo.",DynamicFactions[faction][fRank4],GetPlayerNameEx(playerid),result);
        
ProxDetector(5.0playeridwstring,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
        if(
PlayerInfo[playerid][pFaction] == 0)SendFactionMessage(00x33CCFFAAwstring),SetPlayerSkin(playerid280);
        else if(
PlayerInfo[playerid][pFaction] == 1)SendFactionMessage(10x33CCFFAAwstring);
    }
    
FactionChatLog(wstring);
    
PhoneAnimation(playerid);

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)