Can someone tell me whats wrong with this code?
#1

Hi, Everytime I'm trying to script this my pawn compiler crashes so theres a big problem with it
Please it would be grateful if someone points me in the right direction

Код:
if(strcmp(cmd, "/buyweaponpackage", true) == 0)
{
    if(IsPlayerConnected(playerid)) {
        if(PlayerInfo[playerid][pJob] = 24) {
			if(!strcmp(tmp, "deagle",true)) {
			new idx;
         	tmp = strtok(cmdtext, idx);
         	else if(strcmp(tmp, "1", true) == 0) {
         	    if (PlayerToPoint(2.0, playerid,1066.2465,2087.4011,10.8203)) {
                	PlayerInfo[playerid][pWeaponPackage1] = 1;
                	GivePlayerPCash(playerid,-5000);
                	SendClientMessage(playerid, COLOR_LIGHTRED, "SLOT 1: You have just bought a Desert Eagle(100) package for Slot 1.");
                 	return 1;
                    }
                }
                else {
                    SendClientMessage(playerid, COLOR_GREY, "Your are not at the Black Market!");
                }
                return 1;
            }
         	else if(strcmp(tmp, "2", true) == 0) {
         	    if (PlayerToPoint(2.0, playerid,1066.2465,2087.4011,10.8203)) {
                	PlayerInfo[playerid][pWeaponPackage2] = 1;
                	GivePlayerPCash(playerid,-5000);
                	SendClientMessage(playerid, COLOR_LIGHTRED, "SLOT 2: You have just bought a Desert Eagle(100) package for Slot 2.");
                 	return 1;
                    }
                }
                else {
                    SendClientMessage(playerid, COLOR_GREY, "Your are not at the Black Market!");
                }
                return 1;
            }
            else if(strcmp(tmp, "3", true) == 0) {
         	    if (PlayerToPoint(2.0, playerid,1066.2465,2087.4011,10.8203)) {
                	PlayerInfo[playerid][pWeaponPackage3] = 1;
                	GivePlayerPCash(playerid,-5000);
                	SendClientMessage(playerid, COLOR_LIGHTRED, "SLOT 3: You have just bought a Desert Eagle(100) package for Slot 3.");
                 	return 1;
                    }
                }
                else {
                    SendClientMessage(playerid, COLOR_GREY, "Your are not at the Black Market!");
                }
                return 1;
            }
            else if(strcmp(tmp, "4", true) == 0) {
         	    if (PlayerToPoint(2.0, playerid,1066.2465,2087.4011,10.8203)) {
                	PlayerInfo[playerid][pWeaponPackage4] = 1;
                	GivePlayerPCash(playerid,-5000);
                	SendClientMessage(playerid, COLOR_LIGHTRED, "SLOT 4: You have just bought a Desert Eagle(100) package for Slot 4.");
                 	return 1;
                    }
                }
                else {
                    SendClientMessage(playerid, COLOR_GREY, "Your are not at the Black Market!");
                }
                return 1;
            }
            else if(strcmp(tmp, "5", true) == 0) {
         	    if (PlayerToPoint(2.0, playerid,1066.2465,2087.4011,10.8203)) {
                	PlayerInfo[playerid][pWeaponPackage5] = 1;
                	GivePlayerPCash(playerid,-5000);
                	SendClientMessage(playerid, COLOR_LIGHTRED, "SLOT 5: You have just bought a Desert Eagle(100) package for Slot 5.");
                 	return 1;
                    }
                }
                else {
                    SendClientMessage(playerid, COLOR_GREY, "Your are not at the Black Market!");
                }
                return 1;
            }
            else if(strcmp(tmp, "6", true) == 0) {
         	    if (PlayerToPoint(2.0, playerid,1066.2465,2087.4011,10.8203)) {
                	PlayerInfo[playerid][pWeaponPackage6] = 1;
                	GivePlayerPCash(playerid,-5000);
                	SendClientMessage(playerid, COLOR_LIGHTRED, "SLOT 6: You have just bought a Desert Eagle(100) package for Slot 6.");
                 	return 1;
                    }
                }
                else {
                    SendClientMessage(playerid, COLOR_GREY, "Your are not at the Black Market!");
                }
                return 1;
            }
            else if(strcmp(tmp, "7", true) == 0) {
         	    if (PlayerToPoint(2.0, playerid,1066.2465,2087.4011,10.8203)) {
                	PlayerInfo[playerid][pWeaponPackage7] = 1;
                	GivePlayerPCash(playerid,-5000);
                	SendClientMessage(playerid, COLOR_LIGHTRED, "SLOT 7: You have just bought a Desert Eagle(100) package for Slot 7.");
                 	return 1;
                    }
                }
                else {
                    SendClientMessage(playerid, COLOR_GREY, "Your are not at the Black Market!");
                }
                return 1;
            }
            else if(strcmp(tmp, "8", true) == 0) {
         	    if (PlayerToPoint(2.0, playerid,1066.2465,2087.4011,10.8203)) {
                	PlayerInfo[playerid][pWeaponPackage8] = 1;
                	GivePlayerPCash(playerid,-5000);
                	SendClientMessage(playerid, COLOR_LIGHTRED, "SLOT 8: You have just bought a Desert Eagle(100) package for Slot 8.");
                 	return 1;
                    }
                }
                else {
                    SendClientMessage(playerid, COLOR_GREY, "Your are not at the Black Market!");
                }
                return 1;
            }
            else if(strcmp(tmp, "9", true) == 0) {
         	    if (PlayerToPoint(2.0, playerid,1066.2465,2087.4011,10.8203)) {
                	PlayerInfo[playerid][pWeaponPackage9] = 1;
                	GivePlayerPCash(playerid,-5000);
                	SendClientMessage(playerid, COLOR_LIGHTRED, "SLOT 9: You have just bought a Desert Eagle(100) package for Slot 9.");
                 	return 1;
                    }
                }
                else {
                    SendClientMessage(playerid, COLOR_GREY, "Your are not at the Black Market!");
                }
                return 1;
            }
            else if(strcmp(tmp, "10", true) == 0) {
         	    if (PlayerToPoint(2.0, playerid,1066.2465,2087.4011,10.8203)) {
                	PlayerInfo[playerid][pWeaponPackage10] = 1;
                	GivePlayerPCash(playerid,-5000);
                	SendClientMessage(playerid, COLOR_LIGHTRED, "SLOT 10: You have just bought a Desert Eagle(100) package for Slot 10.");
                 	return 1;
                    }
                }
                else {
                    SendClientMessage(playerid, COLOR_GREY, "Your are not at the Black Market!");
                }
                return 1;
            }
            if(!strcmp(tmp, "ak47",true)) {
         	tmp = strtok(cmdtext, idx);
         	if(!strlen(tmp)) {
         	SendClientMessage(playerid, COLOR_WHITE, "USAGE: /buyweaponpackage [name] [slot1-10]");
         	SendClientMessage(playerid, COLOR_WHITE, "Available Packages: deagle, ak47");
         	return 1;
         	}
         	if(strcmp(tmp, "1", true) == 0) {
         	    if (PlayerToPoint(2.0, playerid,1066.2465,2087.4011,10.8203)) {
                	PlayerInfo[playerid][pWeaponPackage1] = 2;
                	GivePlayerPCash(playerid,-5000);
                	SendClientMessage(playerid, COLOR_LIGHTRED, "SLOT 1: You have just bought a AK-47(200) package for Slot 1.");
                 	return 1;
                    }
                }
                else {
                    SendClientMessage(playerid, COLOR_GREY, "Your are not at the Black Market!");
                }
                return 1;
            }
         	else if(strcmp(tmp, "2", true) == 0) {
         	    if (PlayerToPoint(2.0, playerid,1066.2465,2087.4011,10.8203)) {
                	PlayerInfo[playerid][pWeaponPackage2] = 2;
                	GivePlayerPCash(playerid,-5000);
                	SendClientMessage(playerid, COLOR_LIGHTRED, "SLOT 2: You have just bought a AK-47(200) package for Slot 2.");
                 	return 1;
                    }
                }
                else {
                    SendClientMessage(playerid, COLOR_GREY, "Your are not at the Black Market!");
                }
                return 1;
            }
            else if(strcmp(tmp, "3", true) == 0) {
         	    if (PlayerToPoint(2.0, playerid,1066.2465,2087.4011,10.8203)) {
                	PlayerInfo[playerid][pWeaponPackage3] = 2;
                	GivePlayerPCash(playerid,-5000);
                	SendClientMessage(playerid, COLOR_LIGHTRED, "SLOT 3: You have just bought a AK-47(200) package for Slot 3.");
                 	return 1;
                    }
                }
                else {
                    SendClientMessage(playerid, COLOR_GREY, "Your are not at the Black Market!");
                }
                return 1;
            }
            else if(strcmp(tmp, "4", true) == 0) {
         	    if (PlayerToPoint(2.0, playerid,1066.2465,2087.4011,10.8203)) {
                	PlayerInfo[playerid][pWeaponPackage4] = 2;
                	GivePlayerPCash(playerid,-5000);
                	SendClientMessage(playerid, COLOR_LIGHTRED, "SLOT 4: You have just bought a AK-47(200) package for Slot 4.");
                 	return 1;
                    }
                }
                else {
                    SendClientMessage(playerid, COLOR_GREY, "Your are not at the Black Market!");
                }
                return 1;
            }
            else if(strcmp(tmp, "5", true) == 0) {
         	    if (PlayerToPoint(2.0, playerid,1066.2465,2087.4011,10.8203)) {
                	PlayerInfo[playerid][pWeaponPackage5] = 2;
                	GivePlayerPCash(playerid,-5000);
                	SendClientMessage(playerid, COLOR_LIGHTRED, "SLOT 5: You have just bought a AK-47(200) package for Slot 5.");
                 	return 1;
                    }
                }
                else {
                    SendClientMessage(playerid, COLOR_GREY, "Your are not at the Black Market!");
                }
                return 1;
            }
            else if(strcmp(tmp, "6", true) == 0) {
         	    if (PlayerToPoint(2.0, playerid,1066.2465,2087.4011,10.8203)) {
                	PlayerInfo[playerid][pWeaponPackage6] = 2;
                	GivePlayerPCash(playerid,-5000);
                	SendClientMessage(playerid, COLOR_LIGHTRED, "SLOT 6: You have just bought a AK-47(200) package for Slot 6.");
                 	return 1;
                    }
                }
                else {
                    SendClientMessage(playerid, COLOR_GREY, "Your are not at the Black Market!");
                }
                return 1;
            }
            else if(strcmp(tmp, "7", true) == 0) {
         	    if (PlayerToPoint(2.0, playerid,1066.2465,2087.4011,10.8203)) {
                	PlayerInfo[playerid][pWeaponPackage7] = 2;
                	GivePlayerPCash(playerid,-5000);
                	SendClientMessage(playerid, COLOR_LIGHTRED, "SLOT 7: You have just bought a AK-47(200) package for Slot 7.");
                 	return 1;
                    }
                }
                else {
                    SendClientMessage(playerid, COLOR_GREY, "Your are not at the Black Market!");
                }
                return 1;
            }
            else if(strcmp(tmp, "8", true) == 0) {
         	    if (PlayerToPoint(2.0, playerid,1066.2465,2087.4011,10.8203)) {
                	PlayerInfo[playerid][pWeaponPackage8] = 2;
                	GivePlayerPCash(playerid,-5000);
                	SendClientMessage(playerid, COLOR_LIGHTRED, "SLOT 8: You have just bought a AK-47(200) package for Slot 8.");
                 	return 1;
                    }
                }
                else {
                    SendClientMessage(playerid, COLOR_GREY, "Your are not at the Black Market!");
                }
                return 1;
            }
            else if(strcmp(tmp, "9", true) == 0) {
         	    if (PlayerToPoint(2.0, playerid,1066.2465,2087.4011,10.8203)) {
                	PlayerInfo[playerid][pWeaponPackage9] = 2;
                	GivePlayerPCash(playerid,-5000);
                	SendClientMessage(playerid, COLOR_LIGHTRED, "SLOT 9: You have just bought a AK-47(200) package for Slot 9.");
                 	return 1;
                    }
                }
                else {
                    SendClientMessage(playerid, COLOR_GREY, "Your are not at the Black Market!");
                }
                return 1;
            }
            else if(strcmp(tmp, "10", true) == 0) {
         	    if (PlayerToPoint(2.0, playerid,1066.2465,2087.4011,10.8203)) {
                	PlayerInfo[playerid][pWeaponPackage10] = 2;
                	GivePlayerPCash(playerid,-5000);
                	SendClientMessage(playerid, COLOR_LIGHTRED, "SLOT 10: You have just bought a AK-47(200) package for Slot 10.");
                 	return 1;
                    }
                }
                else {
                    SendClientMessage(playerid, COLOR_GREY, "Your are not at the Black Market!");
                    return 1;
				}
			}
		}
	}
	return 1;
}
Reply
#2

Looks fine to me.

Are you using ZCMD?
What are you using?
Reply
#3

Quote:
Originally Posted by dannyk0ed
Посмотреть сообщение
Are you using ZCMD?
Does it look like ZCMD?

pawn Код:
if(PlayerInfo[playerid][pJob] = 24) {
should be:
pawn Код:
if(PlayerInfo[playerid][pJob] == 24) {
However, I'm not sure that's the only problem as that mistake would probably only give an unintended assignment warning.
Reply
#4

Indentation looks poor. I won't even look at the rest. Generally if the coder can't indent, there will be alot wrong with the code.


TIP: You can click and drag to select code, then press 'tab' and hey presto code block indented.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)