/invite Help Rep++++++
#1

Well When I execute this command it automatically says "This Player is wanted/alread in the faction/ part of a different team


pawn Код:
if(strcmp(cmd, "/invite", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /invite [playerid/PartOfName]");
                return 1;
            }
            new para1;
            new ftext[20];
            para1 = ReturnUser(tmp);
            if (PlayerInfo[playerid][pLeader] >= 1)
            {
                if(IsPlayerConnected(para1))
                {
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        if (gTeam[para1]==TEAM_GREEN && PlayerInfo[para1][pMember] == 0 && PlayerInfo[para1][pFMember] == 255)
                        {
                            if(PlayerInfo[playerid][pLeader] == 1) { PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "Police Force"; ChosenSkin[para1] = 71; SetPlayerSkin(para1, 71); }
                            else if(PlayerInfo[playerid][pLeader] == 2) { PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "FBI/ATF"; ChosenSkin[para1] = 286; SetPlayerSkin(para1, 286); }
                            else if(PlayerInfo[playerid][pLeader] == 3) { PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "National Guard"; ChosenSkin[para1] = 287; SetPlayerSkin(para1, 287); }
                            else if(PlayerInfo[playerid][pLeader] == 4) { PlayerInfo[para1][pTeam] = 1; gTeam[para1] = 1; ftext = "Firemen/Ambulance"; ChosenSkin[para1] = 70; SetPlayerSkin(para1, 70); }
                            else if(PlayerInfo[playerid][pLeader] == 5) { PlayerInfo[para1][pTeam] = 5; gTeam[para1] = 5; ftext = "Surenos"; ChosenSkin[para1] = 116; SetPlayerSkin(para1, 116); }
                            else if(PlayerInfo[playerid][pLeader] == 6) { PlayerInfo[para1][pTeam] = 6; gTeam[para1] = 6; ftext = "La Famiglia Sinatra"; ChosenSkin[para1] = 125; SetPlayerSkin(para1, 125); }
                            else if(PlayerInfo[playerid][pLeader] == 7) { return 1; }
                            else if(PlayerInfo[playerid][pLeader] == 8) { PlayerInfo[para1][pTeam] = 10; gTeam[para1] = 12; ftext = "Hitman Agency"; ChosenSkin[para1] = 249; SetPlayerSkin(para1, 249); }
                            else if(PlayerInfo[playerid][pLeader] == 9) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "ABC Studio"; ChosenSkin[para1] = 148; SetPlayerSkin(para1, 148); }
                            else if(PlayerInfo[playerid][pLeader] == 10) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "Taxi Cab Company"; ChosenSkin[para1] = 255; SetPlayerSkin(para1, 255); }
                            else if(PlayerInfo[playerid][pLeader] == 11) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "School Instructors"; ChosenSkin[para1] = 59; SetPlayerSkin(para1, 59); }
                            else if(PlayerInfo[playerid][pLeader] == 14) { PlayerInfo[para1][pTeam] = 5; gTeam[para1] = 5; ftext = "Yamaguchi"; ChosenSkin[para1] = 169; SetPlayerSkin(para1, 169); }
                            else if(PlayerInfo[playerid][pLeader] == 15) { PlayerInfo[para1][pTeam] = 15; gTeam[para1] = 15; ftext = "Chornaya Bratva"; ChosenSkin[para1] = 258; SetPlayerSkin(para1, 258); }
                            else if(PlayerInfo[playerid][pLeader] == 16) { PlayerInfo[para1][pTeam] = 5; gTeam[para1] = 5; ftext = "La Vice"; ChosenSkin[para1] = 143; SetPlayerSkin(para1, 143); }
                            else { return 1; }
                            GetPlayerName(para1, giveplayer, sizeof(giveplayer));

                            PlayerInfo[para1][pMember] = PlayerInfo[playerid][pLeader];
                            PlayerInfo[para1][pRank] = 1;
                            printf("AdmCmd: %s has invited %s to join %s.", sendername, giveplayer, ftext);
                            format(string, sizeof(string), "   You have Joined the %s, you were invited by Leader %s", ftext, sendername);
                            SendClientMessage(para1, COLOR_WHITE, string);
                            format(string, sizeof(string), "   You have Invited %s to join the %s.", giveplayer,ftext);
                            SendClientMessage(playerid, COLOR_WHITE, string);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "  That player is currently Wanted / a Different Team / or already a Family Member.");
                            return 1;
                        }
                    }
                }//not connected
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command(leaders only)!");
            }
        }
        return 1;
    }
Reply
#2

Try this

pawn Код:
if(strcmp(cmd, "/invite", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /invite [playerid/PartOfName]");
                return 1;
            }
            new para1;
            new ftext[20];
            para1 = ReturnUser(tmp);
            if (PlayerInfo[playerid][pLeader] >= 1)
            {
                if(IsPlayerConnected(para1))
                {
                    if(para1 != INVALID_PLAYER_ID)
                    {
                        if (gTeam[para1]==TEAM_GREEN || PlayerInfo[para1][pMember] == 0 || PlayerInfo[para1][pFMember] == 255) // The "&&" means "AND" and "||" means or, so I guess this will fix your problem
                        {
                            if(PlayerInfo[playerid][pLeader] == 1) { PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "Police Force"; ChosenSkin[para1] = 71; SetPlayerSkin(para1, 71); }
                            else if(PlayerInfo[playerid][pLeader] == 2) { PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "FBI/ATF"; ChosenSkin[para1] = 286; SetPlayerSkin(para1, 286); }
                            else if(PlayerInfo[playerid][pLeader] == 3) { PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "National Guard"; ChosenSkin[para1] = 287; SetPlayerSkin(para1, 287); }
                            else if(PlayerInfo[playerid][pLeader] == 4) { PlayerInfo[para1][pTeam] = 1; gTeam[para1] = 1; ftext = "Firemen/Ambulance"; ChosenSkin[para1] = 70; SetPlayerSkin(para1, 70); }
                            else if(PlayerInfo[playerid][pLeader] == 5) { PlayerInfo[para1][pTeam] = 5; gTeam[para1] = 5; ftext = "Surenos"; ChosenSkin[para1] = 116; SetPlayerSkin(para1, 116); }
                            else if(PlayerInfo[playerid][pLeader] == 6) { PlayerInfo[para1][pTeam] = 6; gTeam[para1] = 6; ftext = "La Famiglia Sinatra"; ChosenSkin[para1] = 125; SetPlayerSkin(para1, 125); }
                            else if(PlayerInfo[playerid][pLeader] == 7) { return 1; }
                            else if(PlayerInfo[playerid][pLeader] == 8) { PlayerInfo[para1][pTeam] = 10; gTeam[para1] = 12; ftext = "Hitman Agency"; ChosenSkin[para1] = 249; SetPlayerSkin(para1, 249); }
                            else if(PlayerInfo[playerid][pLeader] == 9) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "ABC Studio"; ChosenSkin[para1] = 148; SetPlayerSkin(para1, 148); }
                            else if(PlayerInfo[playerid][pLeader] == 10) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "Taxi Cab Company"; ChosenSkin[para1] = 255; SetPlayerSkin(para1, 255); }
                            else if(PlayerInfo[playerid][pLeader] == 11) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "School Instructors"; ChosenSkin[para1] = 59; SetPlayerSkin(para1, 59); }
                            else if(PlayerInfo[playerid][pLeader] == 14) { PlayerInfo[para1][pTeam] = 5; gTeam[para1] = 5; ftext = "Yamaguchi"; ChosenSkin[para1] = 169; SetPlayerSkin(para1, 169); }
                            else if(PlayerInfo[playerid][pLeader] == 15) { PlayerInfo[para1][pTeam] = 15; gTeam[para1] = 15; ftext = "Chornaya Bratva"; ChosenSkin[para1] = 258; SetPlayerSkin(para1, 258); }
                            else if(PlayerInfo[playerid][pLeader] == 16) { PlayerInfo[para1][pTeam] = 5; gTeam[para1] = 5; ftext = "La Vice"; ChosenSkin[para1] = 143; SetPlayerSkin(para1, 143); }
                            else { return 1; }
                            GetPlayerName(para1, giveplayer, sizeof(giveplayer));

                            PlayerInfo[para1][pMember] = PlayerInfo[playerid][pLeader];
                            PlayerInfo[para1][pRank] = 1;
                            printf("AdmCmd: %s has invited %s to join %s.", sendername, giveplayer, ftext);
                            format(string, sizeof(string), "   You have Joined the %s, you were invited by Leader %s", ftext, sendername);
                            SendClientMessage(para1, COLOR_WHITE, string);
                            format(string, sizeof(string), "   You have Invited %s to join the %s.", giveplayer,ftext);
                            SendClientMessage(playerid, COLOR_WHITE, string);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "  That player is currently Wanted / a Different Team / or already a Family Member.");
                            return 1;
                        }
                    }
                }//not connected
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command(leaders only)!");
            }
        }
        return 1;
    }
I've made the same mistake before, I guess this will help
Reply
#3

Works for me:

Код:
	if(strcmp(cmd, "/invite", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "{33CCFF}USAGE:{FFFFFF} /invite [playerid/PartOfName]");
				return 1;
			}
			new para1;
			new ftext[20];
			para1 = ReturnUser(tmp);
			if (PlayerInfo[playerid][pLeader] >= 1)
			{
			    if(IsPlayerConnected(para1))
			    {
			        if(para1 != INVALID_PLAYER_ID)
			        {
					    if (gTeam[para1]==TEAM_GREEN && PlayerInfo[para1][pMember] == 0)
					    {
					        if(PlayerInfo[playerid][pLeader] == 1) { PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "Police Force";  }
					        else if(PlayerInfo[playerid][pLeader] == 2) { PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "FBI";  }
					        else if(PlayerInfo[playerid][pLeader] == 3) { PlayerInfo[para1][pTeam] = 2; gTeam[para1] = 2; ftext = "Los Santos Prison";  }
					        else if(PlayerInfo[playerid][pLeader] == 4) { PlayerInfo[para1][pTeam] = 1; gTeam[para1] = 1; ftext = "Firemen/Ambulance";  }
					        //else if(PlayerInfo[playerid][pLeader] == 5) { PlayerInfo[para1][pTeam] = 5; gTeam[para1] = 5; ftext = "Surenos";  }
					        //else if(PlayerInfo[playerid][pLeader] == 6) { PlayerInfo[para1][pTeam] = 6; gTeam[para1] = 6; ftext = "La Famiglia Sinatra";  }
					        else if(PlayerInfo[playerid][pLeader] == 7) { return 1; }
					        else if(PlayerInfo[playerid][pLeader] == 8) { PlayerInfo[para1][pTeam] = 10; gTeam[para1] = 12; ftext = "Hitman Agency";  }
					        else if(PlayerInfo[playerid][pLeader] == 9) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "SAN Studio";  }
					        else if(PlayerInfo[playerid][pLeader] == 10) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "Taxi Cab Company";  }
					        else if(PlayerInfo[playerid][pLeader] == 11) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "School Instructors";  }
					        //else if(PlayerInfo[playerid][pLeader] == 14) { PlayerInfo[para1][pTeam] = 5; gTeam[para1] = 5; ftext = "Yamaguchi";  }
					        //else if(PlayerInfo[playerid][pLeader] == 15) { PlayerInfo[para1][pTeam] = 15; gTeam[para1] = 15; ftext = "47th Street Saints";  }
					        //else if(PlayerInfo[playerid][pLeader] == 16) { PlayerInfo[para1][pTeam] = 5; gTeam[para1] = 5; ftext = "East Side Bloods";  }
					        else if(PlayerInfo[playerid][pLeader] == 17) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "Garage man";  }
					        else if(PlayerInfo[playerid][pLeader] == 18) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "Speed Racers";  }
					        else if(PlayerInfo[playerid][pLeader] == 19) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "SAPD Force";  }
					        else if(PlayerInfo[playerid][pLeader] == 20) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "VPS";  }
					        else if(PlayerInfo[playerid][pLeader] == 21) { PlayerInfo[para1][pTeam] = 12; gTeam[para1] = 12; ftext = "LSFD Force";  }
					        else { return 1; }
							GetPlayerName(para1, giveplayer, sizeof(giveplayer));
                            //GetPlayerName(playerid, sendername, sizeof(sendername));
							PlayerInfo[para1][pMember] = PlayerInfo[playerid][pLeader];
							PlayerInfo[para1][pRank] = 1;
							printf("AdmCmd: %s has invited %s to join %s.", sendername, giveplayer, ftext);
							format(string, sizeof(string), "   You have Joined the %s, you were invited by Leader %s", ftext, sendername);
							SendClientMessage(para1, COLOR_WHITE, string);
							format(string, sizeof(string), "   You have Invited %s to join the %s.", giveplayer,ftext);
							SendClientMessage(playerid, COLOR_WHITE, string);
						}
						else
						{
						    SendClientMessage(playerid, COLOR_GREY, "  That player is currently Wanted / a Different Team / or already a Family Member.");
						    return 1;
						}
					}
				}//not connected
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   {BCD4E6}Error: {FFFFFF}Sorry, you cant use this command.(leaders only)!");
			}
		}
		return 1;
	}
Reply
#4

You need to Try And Just recompile and it will work then, Looks more like a bug to me than a Scripting Fault..
Reply
#5

Thanks guys I fixed the problem. +++ Rep for all!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)