SA-MP Forums Archive
Errors. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Errors. (/showthread.php?tid=648428)



Errors. - Swarn - 21.01.2018

pawn Код:
C:\Users\o\Desktop\BDRP TRD\gamemodes\TRD.pwn(295) : error 001: expected token: ")", but found "["
C:\Users\o\Desktop\BDRP TRD\gamemodes\TRD.pwn(295) : error 029: invalid expression, assumed zero
C:\Users\o\Desktop\BDRP TRD\gamemodes\TRD.pwn(295) : warning 215: expression has no effect
C:\Users\o\Desktop\BDRP TRD\gamemodes\TRD.pwn(295) : error 001: expected token: ";", but found "]"
C:\Users\o\Desktop\BDRP TRD\gamemodes\TRD.pwn(295) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
pawn Код:
stock GetDruggInfo(playerid, slot)
{
    new info[64];
    if(PlayerInfo[playerid][pDrug][slot] == 0) // line 295
    {
        info = "Empty";
    }
    else
    {
        format(info, sizeof(info), "%s(%d)", GetDrugName(PlayerInfo[playerid][pDrug][slot]), PlayerInfo[playerid][pDrugAmount][slot]);
    }
    return info;
}
any ideas?


Re: Errors. - Mtfz13 - 21.01.2018

Aqui:

Код:
if(PlayerInfo[playerid][pDrug][slot] == 0) // line 295
Mude para:
Код:
if(PlayerInfo[playerid][pDrug][slot] == 0); // line 295



Re: Errors. - Ritzy2K - 21.01.2018

Quote:
Originally Posted by Mtfz13
Посмотреть сообщение
Aqui:

Код:
if(PlayerInfo[playerid][pDrug][slot] == 0) // line 295
Mude para:
Код:
if(PlayerInfo[playerid][pDrug][slot] == 0); // line 295
Hell no, lol.

I honestly cant find anything wrong, can you post some lines above the line 295.


Re: Errors. - Dayrion - 21.01.2018

PHP код:
info "Empty"
It doesn't work with an array nor a string.
In this case you simply should use strcat.
PHP код:
strcat(info"Empty"); 



Re: Errors. - Swarn - 21.01.2018

pawn Код:
stock AssignPlayerDrugs(playerid, str[])
{
    new wtmp[MAX_DRUGS][64];
    explode(wtmp,str,"|");
    for(new z = 1; z < MAX_DRUGS; z++)
    {
        new wtmp2[2][64];
        /*Has to be minus 1, don't touch*/
        explode(wtmp2,wtmp[z-1],"=");
        PlayerInfo[playerid][pDrug][z] = strval(wtmp2[0]);
        PlayerInfo[playerid][pDrugAmount][z] = strval(wtmp2[1]);
    }
}
Lines above 295


Re: Errors. - Hypex - 22.01.2018

Can you try doing this instead?
Код:
stock GetDruggInfo(playerid, slot)
{
	new info[64];
 	if(slot == 0)
  	{
		if(PlayerInfo[playerid][pDrug]) // line 295
		{
			info = "Empty";
		}
		else
		{
			format(info, sizeof(info), "%s(%d)", GetDrugName(PlayerInfo[playerid][pDrug][slot]), PlayerInfo[playerid][pDrugAmount][slot]);
		}
	}
	return info;
}
Tell me if it works, I don't really know what "slot" does for you but you may have to remove [slot] from your format.


Re: Errors. - Swarn - 22.01.2018

Nothing is working. It's strange because it works perfectly in another script. I don't know if it's an include missing causing it.


Re: Errors. - Swarn - 22.01.2018

fixed.