Should Return value
#1

Direct to problem:
Код:
CMD:enterfaction(playerid, params[])
{
        new groupID;
        new userID = playerid;
		if(sscanf(params, "d", groupID)) {
		return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/EnterFaction [FactionID]");
		}
        else
		{
			if(groupID < 1 || groupID > MAX_GROUPS) return SendClientMessage(playerid, COLOR_GREY, "Invalid group ID->:");
			SendClientMessage(playerid, COLOR_GREY, "LSPD(1) - F.B.I(2) - National Guard(3) - Paramedic Departament(4);");
			SendClientMessage(playerid, COLOR_GREY, "Guvernment(5) - The Russian Mafia(6) - Groove Street(7) - Los Aztecas(8);");
			SendClientMessage(playerid, COLOR_GREY, "Ballas(9) - Los Vagos(10) - Hitman Agency(11) - School Instructors(12);");
			SendClientMessage(playerid, COLOR_GREY, "Taxi Company(13) - News Reporters(14) - Las Barrancas Taxi Company(15).");
			if(playerVariables[userID][pGroup] == 0)
			{
				format(szMessage, 256, "UPDATE playeraccounts set playerDays = 0 WHERE playerID = '%d'", playerVariables[userID][pInternalID]);
				mysql_tquery(handle,szMessage);
				playerVariables[userID][pGroup] = groupID;
				playerVariables[userID][pGroupRank] = 1;
				SetPlayerToTeamColor(userID);
				new string[256];
				GetPlayerName(userID, szPlayerName, MAX_PLAYER_NAME);
				format(string, sizeof(string), "Ai intrat in: %s.", szPlayerName, groupVariables[groupID][gGroupName]);
				SendClientMessage(playerid, COLOR_WHITE, string);
				GetPlayerName(userID, szPlayerName, MAX_PLAYER_NAME);
				new query[500];
				format(string, sizeof(string), "<< %s a intrat in factiunea %s. >>", szPlayerName,groupVariables[groupID][gGroupName]);
				format(query, sizeof(query), "INSERT INTO faction_logs (text, playerID) VALUES ('%s', '%d')", string,playerVariables[userID][pInternalID]);
				mysql_tquery(handle,query);
				format(query, sizeof(query), "INSERT INTO flogs (text, playerID, faction) VALUES ('%s', '%d', '%d')", string,playerVariables[userID][pInternalID], playerVariables[userID][pGroup]);
				mysql_tquery(handle,query);
				if(playerVariables[userID][pGroup] == 1)
				{
					SetPlayerSkin(userID, 284);
					playerVariables[userID][pSkin] = 284;
				}
				if(playerVariables[userID][pGroup] == 2)
				{
					SetPlayerSkin(userID, 163);
					playerVariables[userID][pSkin] = 163;
				}
				if(playerVariables[playerid][pGroup] == 3)
				{
						SetPlayerSkin(playerid, 287);
						playerVariables[playerid][pSkin] = 287;
				}
				if(playerVariables[playerid][pGroup] == 4)
				{
						SetPlayerSkin(playerid, 276);
						playerVariables[playerid][pSkin] = 276;
				}
				if(playerVariables[playerid][pGroup] == 5)
				{
						SetPlayerSkin(playerid, 284);
						playerVariables[playerid][pSkin] = 284;
				}
				if(playerVariables[playerid][pGroup] == 6)
				{
						SetPlayerSkin(playerid, 73);
						playerVariables[playerid][pSkin] = 73;
				}
				if(playerVariables[playerid][pGroup] == 7)
				{
						SetPlayerSkin(playerid, 106);
						playerVariables[playerid][pSkin] = 106;
				}
				if(playerVariables[playerid][pGroup] == 8)
				{
						SetPlayerSkin(playerid, 116);
						playerVariables[playerid][pSkin] = 116;
				}
				if(playerVariables[playerid][pGroup] == 9)
				{
						SetPlayerSkin(playerid, 175);
						playerVariables[playerid][pSkin] = 175;
				}
				if(playerVariables[playerid][pGroup] == 10)
				{
						SetPlayerSkin(playerid, 104);
						playerVariables[playerid][pSkin] = 104;
				}
				if(playerVariables[playerid][pGroup] == 11)
				{
						SetPlayerSkin(playerid, 110);
						playerVariables[playerid][pSkin] = 110;
				}
				if(playerVariables[playerid][pGroup] == 12)
				{
						SetPlayerSkin(playerid, 208);
						playerVariables[playerid][pSkin] = 208;
				}
				if(playerVariables[playerid][pGroup] == 13)
				{
						SetPlayerSkin(playerid, 153);
						playerVariables[playerid][pSkin] = 153;
				}
				if(playerVariables[playerid][pGroup] == 14)
				{
						SetPlayerSkin(playerid, 253);
						playerVariables[playerid][pSkin] = 253;
				}
				if(playerVariables[playerid][pGroup] == 15)
				{
						SetPlayerSkin(playerid, 188);
						playerVariables[playerid][pSkin] = 188;
				}
			}
			else return SCM(playerid, COLOR_WHITE, "Esti deja intr-o factiune [/quitgroup]!");
		}
    }
    return 1;
}
Errors:
Код:
C:\Users\Sorin\Desktop\Bugged RPG (Version 3.3.0)\Bugged RPG (Version 3.3.0)\gamemodes\buggedv330.pwn(32445) : warning 209: function "cmd_enterfaction" should return a value
C:\Users\Sorin\Desktop\Bugged RPG (Version 3.3.0)\Bugged RPG (Version 3.3.0)\gamemodes\buggedv330.pwn(32446) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase
on lines:

Код:
			playerVariables[playerid][pSkin] = 188;
				}
			}
			else return SCM(playerid, COLOR_WHITE, "Esti deja intr-o factiune [/quitgroup]!");
		}
    }-----------------------< Line 32445
    return 1;
}
Reply
#2

Nothing appears to be wrong coded; Or at least I didn't notice any leftovers. You can try upgrading from default ZCMD to iZCMD. ZCMD has a lot of problems these days.

https://sampforum.blast.hk/showthread.php?tid=576114

Give it a try!
Reply
#3

PHP код:
CMD:enterfaction(playeridparams[])
{
    new 
groupID;
    new 
userID playerid;
    if(
sscanf(params"d"groupID)) 
        return 
SendClientMessage(playeridCOLOR_GREYSYNTAX_MESSAGE"/EnterFaction [FactionID]");
    else
    {
        if(
groupID || groupID MAX_GROUPS) return SendClientMessage(playeridCOLOR_GREY"Invalid group ID->:");
        
SendClientMessage(playeridCOLOR_GREY"LSPD(1) - F.B.I(2) - National Guard(3) - Paramedic Departament(4);");
        
SendClientMessage(playeridCOLOR_GREY"Guvernment(5) - The Russian Mafia(6) - Groove Street(7) - Los Aztecas(8);");
        
SendClientMessage(playeridCOLOR_GREY"Ballas(9) - Los Vagos(10) - Hitman Agency(11) - School Instructors(12);");
        
SendClientMessage(playeridCOLOR_GREY"Taxi Company(13) - News Reporters(14) - Las Barrancas Taxi Company(15).");
        if(
playerVariables[userID][pGroup] == 0)
        {
            
format(szMessage256"UPDATE playeraccounts set playerDays = 0 WHERE playerID = '%d'"playerVariables[userID][pInternalID]);
            
mysql_tquery(handle,szMessage);
            
playerVariables[userID][pGroup] = groupID;
            
playerVariables[userID][pGroupRank] = 1;
            
SetPlayerToTeamColor(userID);
            new 
string[256];
            
GetPlayerName(userIDszPlayerNameMAX_PLAYER_NAME);
            
format(stringsizeof(string), "Ai intrat in: %s."szPlayerNamegroupVariables[groupID][gGroupName]);
            
SendClientMessage(playeridCOLOR_WHITEstring);
            
GetPlayerName(userIDszPlayerNameMAX_PLAYER_NAME);
            new 
query[500];
            
format(stringsizeof(string), "<< %s a intrat in factiunea %s. >>"szPlayerName,groupVariables[groupID][gGroupName]);
            
format(querysizeof(query), "INSERT INTO faction_logs (text, playerID) VALUES ('%s', '%d')"string,playerVariables[userID][pInternalID]);
            
mysql_tquery(handle,query);
            
format(querysizeof(query), "INSERT INTO flogs (text, playerID, faction) VALUES ('%s', '%d', '%d')"string,playerVariables[userID][pInternalID], playerVariables[userID][pGroup]);
            
mysql_tquery(handle,query);
            if(
playerVariables[userID][pGroup] == 1)
            {
                
SetPlayerSkin(userID284);
                
playerVariables[userID][pSkin] = 284;
            }
            if(
playerVariables[userID][pGroup] == 2)
            {
                
SetPlayerSkin(userID163);
                
playerVariables[userID][pSkin] = 163;
            }
            if(
playerVariables[playerid][pGroup] == 3)
            {
                    
SetPlayerSkin(playerid287);
                    
playerVariables[playerid][pSkin] = 287;
            }
            if(
playerVariables[playerid][pGroup] == 4)
            {
                    
SetPlayerSkin(playerid276);
                    
playerVariables[playerid][pSkin] = 276;
            }
            if(
playerVariables[playerid][pGroup] == 5)
            {
                    
SetPlayerSkin(playerid284);
                    
playerVariables[playerid][pSkin] = 284;
            }
            if(
playerVariables[playerid][pGroup] == 6)
            {
                    
SetPlayerSkin(playerid73);
                    
playerVariables[playerid][pSkin] = 73;
            }
            if(
playerVariables[playerid][pGroup] == 7)
            {
                    
SetPlayerSkin(playerid106);
                    
playerVariables[playerid][pSkin] = 106;
            }
            if(
playerVariables[playerid][pGroup] == 8)
            {
                    
SetPlayerSkin(playerid116);
                    
playerVariables[playerid][pSkin] = 116;
            }
            if(
playerVariables[playerid][pGroup] == 9)
            {
                    
SetPlayerSkin(playerid175);
                    
playerVariables[playerid][pSkin] = 175;
            }
            if(
playerVariables[playerid][pGroup] == 10)
            {
                    
SetPlayerSkin(playerid104);
                    
playerVariables[playerid][pSkin] = 104;
            }
            if(
playerVariables[playerid][pGroup] == 11)
            {
                    
SetPlayerSkin(playerid110);
                    
playerVariables[playerid][pSkin] = 110;
            }
            if(
playerVariables[playerid][pGroup] == 12)
            {
                    
SetPlayerSkin(playerid208);
                    
playerVariables[playerid][pSkin] = 208;
            }
            if(
playerVariables[playerid][pGroup] == 13)
            {
                    
SetPlayerSkin(playerid153);
                    
playerVariables[playerid][pSkin] = 153;
            }
            if(
playerVariables[playerid][pGroup] == 14)
            {
                    
SetPlayerSkin(playerid253);
                    
playerVariables[playerid][pSkin] = 253;
            }
            if(
playerVariables[playerid][pGroup] == 15)
            {
                    
SetPlayerSkin(playerid188);
                    
playerVariables[playerid][pSkin] = 188;
            }
        }
        else return 
SCM(playeridCOLOR_WHITE"Esti deja intr-o factiune [/quitgroup]!");
    }
    return 
1;

Too many : }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)