inconsistent return types (array & non-array)
#1

Hello there, I'm a beginner scripter.
I want to make simple, little commands.
It was all-good until THIS error popped up.
Код:
E:\SampServer\gamemodes\VilcsiTHscript.pwn(95) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(102) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(109) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(116) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(123) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(130) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(137) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(144) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(151) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(158) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(165) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(173) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(177) : error 017: undefined symbol "strtok"
E:\SampServer\gamemodes\VilcsiTHscript.pwn(177) : error 029: invalid expression, assumed zero
E:\SampServer\gamemodes\VilcsiTHscript.pwn(177) : error 017: undefined symbol "string"
E:\SampServer\gamemodes\VilcsiTHscript.pwn(177) : fatal error 107: too many error messages on one line
Here's my script:
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/oles", cmdtext, true, 10) == 0)
	{
		SetPlayerHealth(playerid, 0);
		SendClientMessage(playerid, 0xFF0000FF, "Megpusztultб' he!");
		return 1;
    }

	if (strcmp("/elet", cmdtext, true, 10) == 0)
	{
		SetPlayerHealth(playerid, 100);
		SendClientMessage(playerid, 0x00FF00FF, "Цrцk йlet, mi?");
		return 1;
	}

	if (strcmp("/pancel", cmdtext, true, 10) == 0)
	{
		SetPlayerArmour(playerid, 100.0);
		SendClientMessage(playerid, 0xFFFFFFAA, "Kaptбl pбncйlt kцcsцg.");
		return 1;
	}

	if (strcmp("/felelet", cmdtext, true, 10) == 0)
	{
		SetPlayerHealth(playerid, 50);
		SendClientMessage(playerid, 0xFFFF00FF, "Fйl йlet LOL.");
		return 1;
	}

	if (strcmp("/ak", cmdtext, true, 10) == 0)
	{
		GivePlayerWeapon(playerid, 30, 10000);
		SendClientMessage(playerid, 0xFFFF00FF, "Van AK-d kцcsцg! Csak уvatosan!");
		return 1;
	}

	if (strcmp("/minigun", cmdtext, true, 10) == 0)
	{
		GivePlayerWeapon(playerid, 38, 10000);
		SendClientMessage(playerid, 0xFFFF00FF, "Van Minigun-od kцcsцg! Csak уvatosan!");
		return 1;
	}

	if (strcmp("/cshotgun", cmdtext, true, 10) == 0)
	{
		GivePlayerWeapon(playerid, 27, 10000);
		SendClientMessage(playerid, 0xFFFF00FF, "Van Combat Shotgun-od kцcsцg! Csak уvatosan!");
		return 1;
	}

	if (strcmp("/rlauncher", cmdtext, true, 10) == 0)
	{
		GivePlayerWeapon(playerid, 36, 10000);
		SendClientMessage(playerid, 0xFFFF00FF, "Van HS Launcher-ed(Aknavetőd) kцcsцg! Csak уvatosan!");
		return 1;
	}

	if (strcmp("/penz", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid, 0x00FF00FF, "Kaptбl pйnzt! Уvatosan a vele!");
		GivePlayerMoney(playerid,250000);
		return 1;
	}

	if (strcmp("/grovest", cmdtext, true, 10) == 0)
	{
		SetPlayerPos(playerid, 2475.6655,-1662.9609,13.3326);
		SendClientMessage(playerid, 0x007BFFFF, "Elteleportбltбl a Groove Streetre.");
		return 1;
	}

	if(strcmp("/kocsijavit", cmdtext, true, 10) == 0)
    {
		if(!IsPlayerInAnyVehicle(playerid)){
		SendClientMessage(playerid, 0xFFFF00FF, "Egy kocsiban kell lenned hogy hasznбld ezt a parancsot!");
		return 1;
	}

        new vehicleid = GetPlayerVehicleID(playerid);
        new string[128];
        format(string, sizeof(string), "Megjavнtottad kocsi ID-t: %d.", vehicleid);
        SendClientMessage(playerid, 0xFFFF00FF, string);
        RepairVehicle(vehicleid);
        return 1;
	}


	strtok(const string[], &index)
	{
		new length = strlen(string);
        while ((index < length) && (string[index] <= ' '))
	{
                index++;
	}

        new offset = index;
        new result[20];
        while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
                result[index - offset] = string[index];
                index++;
	}
        result[index - offset] = EOS;
        return result;
	}

	if(strcmp("/kocsi", cmdtext, true, 10) == 0)
	}
    	new tmp[256], tmp2[256], tmp3[256];
    	tmp = strtok(cmdtext, idx);
    	tmp2 = strtok(cmdtext, idx);
    	tmp3 = strtok(cmdtext, idx);

    	new model = strval(tmp);
    	new color1 = strval(tmp2);
    	new color2 = strval(tmp3);

    if(!strlen(tmp)){
        SendClientMessage(playerid, 0xFF0000FF, "Hasznбlat: /kocsi [kocsiid] [elsőszнnid] [mбsodikszнn]");
        return 1;
    }

    if(!strlen(tmp2)){
        SendClientMessage(playerid, 0xFF0000FF, "Hasznбlat: /kocsi [kocsiid] [elsőszнnid] [mбsodikszнn]");
        return 1;
    }

        if(!strlen(tmp3)){
        SendClientMessage(playerid, 0xFF0000FF, "Hasznбlat: /kocsi [kocsiid] [elsőszнnid] [mбsodikszнn]");
        return 1;
	}


        new Float:x, Float:y, Float:z, Float:a;
        GetPlayerPos(playerid, x, y, z);
        GetPlayerFacingAngle(playerid, a);

        CreateVehicle(model, x, y+2, z+1, a, color1, color2, -1);

        new string[128];
        format(string, sizeof(string), "Leraktбl egy %d -t első szнn: %d йs mбsodik szнn: %d.", model, color1, color2);
        SendClientMessage(playerid, 0xFFFF00FF, string);
        return 1;
	}

		return 0;
}
(It has random language in it since I'm hungarian) It has a problem with the returns. It also contains some scripts made by other people, such as the /kocsijavit(Car Fix) or the /kocsi(Car).

Please help, I dunno what the fuq is going on.
Reply
#2

Dude you need to learn how to indent your code as well as how to keep consistency in your code.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/oles", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid, 0);
        SendClientMessage(playerid, 0xFF0000FF, "Megpusztultб' he!");
        return 1;
    }

    if (strcmp("/elet", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid, 100);
        SendClientMessage(playerid, 0x00FF00FF, "Цrцk йlet, mi?");
        return 1;
    }

    if (strcmp("/pancel", cmdtext, true, 10) == 0)
    {
        SetPlayerArmour(playerid, 100.0);
        SendClientMessage(playerid, 0xFFFFFFAA, "Kaptбl pбncйlt kцcsцg.");
        return 1;
    }

    if (strcmp("/felelet", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid, 50);
        SendClientMessage(playerid, 0xFFFF00FF, "Fйl йlet LOL.");
        return 1;
    }

    if (strcmp("/ak", cmdtext, true, 10) == 0)
    {
        GivePlayerWeapon(playerid, 30, 10000);
        SendClientMessage(playerid, 0xFFFF00FF, "Van AK-d kцcsцg! Csak уvatosan!");
        return 1;
    }

    if (strcmp("/minigun", cmdtext, true, 10) == 0)
    {
        GivePlayerWeapon(playerid, 38, 10000);
        SendClientMessage(playerid, 0xFFFF00FF, "Van Minigun-od kцcsцg! Csak уvatosan!");
        return 1;
    }

    if (strcmp("/cshotgun", cmdtext, true, 10) == 0)
    {
        GivePlayerWeapon(playerid, 27, 10000);
        SendClientMessage(playerid, 0xFFFF00FF, "Van Combat Shotgun-od kцcsцg! Csak уvatosan!");
        return 1;
    }

    if (strcmp("/rlauncher", cmdtext, true, 10) == 0)
    {
        GivePlayerWeapon(playerid, 36, 10000);
        SendClientMessage(playerid, 0xFFFF00FF, "Van HS Launcher-ed(Aknavetod) kцcsцg! Csak уvatosan!");
        return 1;
    }

    if (strcmp("/penz", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, 0x00FF00FF, "Kaptбl pйnzt! Уvatosan a vele!");
        GivePlayerMoney(playerid,250000);
        return 1;
    }

    if (strcmp("/grovest", cmdtext, true, 10) == 0)
    {
        SetPlayerPos(playerid, 2475.6655,-1662.9609,13.3326);
        SendClientMessage(playerid, 0x007BFFFF, "Elteleportбltбl a Groove Streetre.");
        return 1;
    }

    if(strcmp("/kocsijavit", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerInAnyVehicle(playerid)){
        SendClientMessage(playerid, 0xFFFF00FF, "Egy kocsiban kell lenned hogy hasznбld ezt a parancsot!");
        new vehicleid = GetPlayerVehicleID(playerid);
        new string[128];
        format(string, sizeof(string), "Megjavнtottad kocsi ID-t: %d.", vehicleid);
        SendClientMessage(playerid, 0xFFFF00FF, string);
        RepairVehicle(vehicleid);
        return 1;
    }

    if(strcmp("/kocsi", cmdtext, true, 10) == 0)
    {
        new tmp[256], tmp2[256], tmp3[256];
        tmp = strtok(cmdtext, idx);
        tmp2 = strtok(cmdtext, idx);
        tmp3 = strtok(cmdtext, idx);
        new model = strval(tmp);
        new color1 = strval(tmp2);
        new color2 = strval(tmp3);
        if(!strlen(tmp)){
            SendClientMessage(playerid, 0xFF0000FF, "Hasznбlat: /kocsi [kocsiid] [elsoszнnid] [mбsodikszнn]");
            return 1;
        }
        if(!strlen(tmp2)){
            SendClientMessage(playerid, 0xFF0000FF, "Hasznбlat: /kocsi [kocsiid] [elsoszнnid] [mбsodikszнn]");
            return 1;
        }
        if(!strlen(tmp3)){
            SendClientMessage(playerid, 0xFF0000FF, "Hasznбlat: /kocsi [kocsiid] [elsoszнnid] [mбsodikszнn]");
            return 1;
        }

       new Float:x, Float:y, Float:z, Float:a;
        GetPlayerPos(playerid, x, y, z);
        GetPlayerFacingAngle(playerid, a);
        CreateVehicle(model, x, y+2, z+1, a, color1, color2, -1);
        new string[128];
        format(string, sizeof(string), "Leraktбl egy %d -t elso szнn: %d йs mбsodik szнn: %d.", model, color1, color2);
        SendClientMessage(playerid, 0xFFFF00FF, string);
        return 1;
    }
    return 0;
}

//
stock strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Alright first let me show you something about commands using strcmp(string compare).
For example:
pawn Код:
if (strcmp("/elet", cmdtext, true, 10) == 0)
Here 10 is the no. of letters in your command. Here it is 5(note:including '/'). So it should be:
pawn Код:
if (strcmp("/elet", cmdtext, true, 5) == 0)
You can get more info from here:
https://sampwiki.blast.hk/wiki/Using_strcmp()
and
https://sampwiki.blast.hk/wiki/Strcmp

Peace!
Reply
#3

Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
Dude you need to learn how to indent your code, how to keep consistency in your code too.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/oles", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid, 0);
        SendClientMessage(playerid, 0xFF0000FF, "Megpusztultб' he!");
        return 1;
    }

    if (strcmp("/elet", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid, 100);
        SendClientMessage(playerid, 0x00FF00FF, "Цrцk йlet, mi?");
        return 1;
    }

    if (strcmp("/pancel", cmdtext, true, 10) == 0)
    {
        SetPlayerArmour(playerid, 100.0);
        SendClientMessage(playerid, 0xFFFFFFAA, "Kaptбl pбncйlt kцcsцg.");
        return 1;
    }

    if (strcmp("/felelet", cmdtext, true, 10) == 0)
    {
        SetPlayerHealth(playerid, 50);
        SendClientMessage(playerid, 0xFFFF00FF, "Fйl йlet LOL.");
        return 1;
    }

    if (strcmp("/ak", cmdtext, true, 10) == 0)
    {
        GivePlayerWeapon(playerid, 30, 10000);
        SendClientMessage(playerid, 0xFFFF00FF, "Van AK-d kцcsцg! Csak уvatosan!");
        return 1;
    }

    if (strcmp("/minigun", cmdtext, true, 10) == 0)
    {
        GivePlayerWeapon(playerid, 38, 10000);
        SendClientMessage(playerid, 0xFFFF00FF, "Van Minigun-od kцcsцg! Csak уvatosan!");
        return 1;
    }

    if (strcmp("/cshotgun", cmdtext, true, 10) == 0)
    {
        GivePlayerWeapon(playerid, 27, 10000);
        SendClientMessage(playerid, 0xFFFF00FF, "Van Combat Shotgun-od kцcsцg! Csak уvatosan!");
        return 1;
    }

    if (strcmp("/rlauncher", cmdtext, true, 10) == 0)
    {
        GivePlayerWeapon(playerid, 36, 10000);
        SendClientMessage(playerid, 0xFFFF00FF, "Van HS Launcher-ed(Aknavetod) kцcsцg! Csak уvatosan!");
        return 1;
    }

    if (strcmp("/penz", cmdtext, true, 10) == 0)
    {
        SendClientMessage(playerid, 0x00FF00FF, "Kaptбl pйnzt! Уvatosan a vele!");
        GivePlayerMoney(playerid,250000);
        return 1;
    }

    if (strcmp("/grovest", cmdtext, true, 10) == 0)
    {
        SetPlayerPos(playerid, 2475.6655,-1662.9609,13.3326);
        SendClientMessage(playerid, 0x007BFFFF, "Elteleportбltбl a Groove Streetre.");
        return 1;
    }

    if(strcmp("/kocsijavit", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerInAnyVehicle(playerid)){
        SendClientMessage(playerid, 0xFFFF00FF, "Egy kocsiban kell lenned hogy hasznбld ezt a parancsot!");
        new vehicleid = GetPlayerVehicleID(playerid);
        new string[128];
        format(string, sizeof(string), "Megjavнtottad kocsi ID-t: %d.", vehicleid);
        SendClientMessage(playerid, 0xFFFF00FF, string);
        RepairVehicle(vehicleid);
        return 1;
    }

    if(strcmp("/kocsi", cmdtext, true, 10) == 0)
    {
        new tmp[256], tmp2[256], tmp3[256];
        tmp = strtok(cmdtext, idx);
        tmp2 = strtok(cmdtext, idx);
        tmp3 = strtok(cmdtext, idx);
        new model = strval(tmp);
        new color1 = strval(tmp2);
        new color2 = strval(tmp3);
        if(!strlen(tmp)){
            SendClientMessage(playerid, 0xFF0000FF, "Hasznбlat: /kocsi [kocsiid] [elsoszнnid] [mбsodikszнn]");
            return 1;
        }
        if(!strlen(tmp2)){
            SendClientMessage(playerid, 0xFF0000FF, "Hasznбlat: /kocsi [kocsiid] [elsoszнnid] [mбsodikszнn]");
            return 1;
        }
        if(!strlen(tmp3)){
            SendClientMessage(playerid, 0xFF0000FF, "Hasznбlat: /kocsi [kocsiid] [elsoszнnid] [mбsodikszнn]");
            return 1;
        }

       new Float:x, Float:y, Float:z, Float:a;
        GetPlayerPos(playerid, x, y, z);
        GetPlayerFacingAngle(playerid, a);
        CreateVehicle(model, x, y+2, z+1, a, color1, color2, -1);
        new string[128];
        format(string, sizeof(string), "Leraktбl egy %d -t elso szнn: %d йs mбsodik szнn: %d.", model, color1, color2);
        SendClientMessage(playerid, 0xFFFF00FF, string);
        return 1;
    }
    return 0;
}

//
stock strtok(const string[], &index)
{
    new length = strlen(string);
    while ((index < length) && (string[index] <= ' '))
    {
        index++;
    }

    new offset = index;
    new result[20];
    while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }
    result[index - offset] = EOS;
    return result;
}
Alright first let me show you something about commands using strcmp(string compare).
For example:
pawn Код:
if (strcmp("/elet", cmdtext, true, 10) == 0)
Here 10 is the no. of letters in your command. Here it is 5(note:including '/'). So it should be:
pawn Код:
if (strcmp("/elet", cmdtext, true, 5) == 0)
You can get more info from here:
https://sampwiki.blast.hk/wiki/Using_strcmp()
and
https://sampwiki.blast.hk/wiki/Strcmp

Peace!
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/oles", cmdtext, true, 5) == 0)
	{
		SetPlayerHealth(playerid, 0);
		SendClientMessage(playerid, 0xFF0000FF, "Megpusztultб' he!");
		return 1;
	}

	if (strcmp("/elet", cmdtext, true, 5) == 0)
	{
		SetPlayerHealth(playerid, 100);
		SendClientMessage(playerid, 0x00FF00FF, "Цrцk йlet, mi?");
		return 1;
	}

	if (strcmp("/pancel", cmdtext, true, 7) == 0)
	{
		SetPlayerArmour(playerid, 100.0);
		SendClientMessage(playerid, 0xFFFFFFAA, "Kaptбl pбncйlt kцcsцg.");
		return 1;
	}

	if (strcmp("/felelet", cmdtext, true, 8) == 0)
	{
		SetPlayerHealth(playerid, 50);
		SendClientMessage(playerid, 0xFFFF00FF, "Fйl йlet LOL.");
		return 1;
	}

	if (strcmp("/ak", cmdtext, true, 3) == 0)
	{
		GivePlayerWeapon(playerid, 30, 10000);
		SendClientMessage(playerid, 0xFFFF00FF, "Van AK-d kцcsцg! Csak уvatosan!");
		return 1;
	}

	if (strcmp("/minigun", cmdtext, true, 8) == 0)
	{
		GivePlayerWeapon(playerid, 38, 10000);
		SendClientMessage(playerid, 0xFFFF00FF, "Van Minigun-od kцcsцg! Csak уvatosan!");
		return 1;
	}

	if (strcmp("/cshotgun", cmdtext, true, 9) == 0)
	{
		GivePlayerWeapon(playerid, 27, 10000);
		SendClientMessage(playerid, 0xFFFF00FF, "Van Combat Shotgun-od kцcsцg! Csak уvatosan!");
		return 1;
	}

	if (strcmp("/rlauncher", cmdtext, true, 10) == 0)
	{
		GivePlayerWeapon(playerid, 36, 10000);
		SendClientMessage(playerid, 0xFFFF00FF, "Van HS Launcher-ed(Aknavetőd) kцcsцg! Csak уvatosan!");
		return 1;
	}

	if (strcmp("/penz", cmdtext, true, 5) == 0)
	{
		SendClientMessage(playerid, 0x00FF00FF, "Kaptбl pйnzt! Уvatosan a vele!");
		GivePlayerMoney(playerid,250000);
		return 1;
	}

	if (strcmp("/grovest", cmdtext, true, 8) == 0)
	{
		SetPlayerPos(playerid, 2475.6655,-1662.9609,13.3326);
		SendClientMessage(playerid, 0x007BFFFF, "Elteleportбltбl a Groove Streetre.");
		return 1;
	}

	if(strcmp("/kocsijavit", cmdtext, true, 11) == 0)
	{
		if(!IsPlayerInAnyVehicle(playerid)){
		SendClientMessage(playerid, 0xFFFF00FF, "Egy kocsiban kell lenned hogy hasznбld ezt a parancsot!");
		return 1;
	}

        new vehicleid = GetPlayerVehicleID(playerid);
        new string[128];
        format(string, sizeof(string), "Megjavнtottad kocsi ID-t: %d.", vehicleid);
        SendClientMessage(playerid, 0xFFFF00FF, string);
        RepairVehicle(vehicleid);
        return 1;
	}


	strtok(const string[], &index)
	{
		new length = strlen(string);
        while ((index < length) && (string[index] <= ' '))
	{
                index++;
	}

        new offset = index;
        new result[20];
        while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
                result[index - offset] = string[index];
                index++;
	}
        result[index - offset] = EOS;
        return result;
	}

	if(strcmp("/kocsi", cmdtext, true, 6) == 0)
	}
    	new tmp[256], tmp2[256], tmp3[256];
    	tmp = strtok(cmdtext, idx);
    	tmp2 = strtok(cmdtext, idx);
    	tmp3 = strtok(cmdtext, idx);

    	new model = strval(tmp);
    	new color1 = strval(tmp2);
    	new color2 = strval(tmp3);

    if(!strlen(tmp)){
        SendClientMessage(playerid, 0xFF0000FF, "Hasznбlat: /kocsi [kocsiid] [elsőszнnid] [mбsodikszнn]");
        return 1;
    }

    if(!strlen(tmp2)){
        SendClientMessage(playerid, 0xFF0000FF, "Hasznбlat: /kocsi [kocsiid] [elsőszнnid] [mбsodikszнn]");
        return 1;
    }

        if(!strlen(tmp3)){
        SendClientMessage(playerid, 0xFF0000FF, "Hasznбlat: /kocsi [kocsiid] [elsőszнnid] [mбsodikszнn]");
        return 1;
	}


        new Float:x, Float:y, Float:z, Float:a;
        GetPlayerPos(playerid, x, y, z);
        GetPlayerFacingAngle(playerid, a);

        CreateVehicle(model, x, y+2, z+1, a, color1, color2, -1);

        new string[128];
        format(string, sizeof(string), "Leraktбl egy %d -t első szнn: %d йs mбsodik szнn: %d.", model, color1, color2);
        SendClientMessage(playerid, 0xFFFF00FF, string);
        return 1;
	}

		return 0;
}
I changed it, still the same errors.
Reply
#4

Buddy you did not changed it... And the array errors are from other lines because their aint any arrays in these commands.
Reply
#5

Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
Buddy you did not changed it... And the array errors are from other lines because their aint any arrays in these commands.
You said to change the numbers in my code to the amout of letters in it. I did that. And I already told you in the first post that the line it's pointing at are returns.

Код:
E:\SampServer\gamemodes\VilcsiTHscript.pwn(95) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(102) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(109) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(116) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(123) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(130) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(137) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(144) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(151) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(158) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(165) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(173) : error 079: inconsistent return types (array & non-array)
E:\SampServer\gamemodes\VilcsiTHscript.pwn(177) : error 017: undefined symbol "strtok"
E:\SampServer\gamemodes\VilcsiTHscript.pwn(177) : error 029: invalid expression, assumed zero
E:\SampServer\gamemodes\VilcsiTHscript.pwn(177) : error 017: undefined symbol "string"
E:\SampServer\gamemodes\VilcsiTHscript.pwn(177) : fatal error 107: too many error messages on one line
Line 95: return 1;(in my first command)
Line 102: return 1;(second)
Line 109: return 1;(third)
And so on, except till line 177
Line 177: strtok(const string[], &index)
I believe it's the part of the Car fix command...?
Код:
	if(strcmp("/kocsijavit", cmdtext, true, 11) == 0)
	{
		if(!IsPlayerInAnyVehicle(playerid)){
		SendClientMessage(playerid, 0xFFFF00FF, "Egy kocsiban kell lenned hogy hasznбld ezt a parancsot!");
		return 1;
	}

        new vehicleid = GetPlayerVehicleID(playerid);
        new string[128];
        format(string, sizeof(string), "Megjavнtottad kocsi ID-t: %d.", vehicleid);
        SendClientMessage(playerid, 0xFFFF00FF, string);
        RepairVehicle(vehicleid);
        return 1;
	}


	strtok(const string[], &index)
	{
		new length = strlen(string);
        while ((index < length) && (string[index] <= ' '))
	{
                index++;
	}

        new offset = index;
        new result[20];
        while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
	{
                result[index - offset] = string[index];
                index++;
	}
        result[index - offset] = EOS;
        return result;
	}
Anyways, thanks for helping.
Reply
#6

Oh my bad. Misunderstood. Wait.
Reply
#7

Got it...
You mixed a brace.
pawn Код:
if(strcmp("/kocsijavit", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, 0xFFFF00FF, "Egy kocsiban kell lenned hogy hasznбld ezt a parancsot!");
        new vehicleid = GetPlayerVehicleID(playerid);
        new string[128];
        format(string, sizeof(string), "Megjavнtottad kocsi ID-t: %d.", vehicleid);
        SendClientMessage(playerid, 0xFFFF00FF, string);
        RepairVehicle(vehicleid);
        return 1;
    }
here
pawn Код:
if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, 0xFFFF00FF, "Egy kocsiban kell lenned hogy hasznбld ezt a parancsot!");
I changed that brace to a return.
Cheers!
Reply
#8

You've got "return result" (which is array) at one place, and the rest are integers. Your function must return either an array or non-array (integer or float) value.
You mustn't return, for example, an integer at one point and an array at another point of the same function.

By the way, public functions can't return arrays, only stock ones.
Reply
#9

Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
Got it...
You mixed a brace.
pawn Код:
if(strcmp("/kocsijavit", cmdtext, true, 10) == 0)
    {
        if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, 0xFFFF00FF, "Egy kocsiban kell lenned hogy hasznбld ezt a parancsot!");
        new vehicleid = GetPlayerVehicleID(playerid);
        new string[128];
        format(string, sizeof(string), "Megjavнtottad kocsi ID-t: %d.", vehicleid);
        SendClientMessage(playerid, 0xFFFF00FF, string);
        RepairVehicle(vehicleid);
        return 1;
    }
here
pawn Код:
if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, 0xFFFF00FF, "Egy kocsiban kell lenned hogy hasznбld ezt a parancsot!");
I changed that brace to a return.
Cheers!
Well, thank you, atleast the Vehicle fixing works.
Also, I figured it out. Well, not really, I re-wrote my script and all of my commands suddenly started working... ._.
Thanks everyone!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)