SA-MP Forums Archive
Need help with 4 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: Need help with 4 errors (/showthread.php?tid=334005)



Need help with 4 errors - thekiller01 - 13.04.2012

I Get these errors:
Код:
C:\Users\Jampie\Desktop\pcash test\gamemodes\grandlarc.pwn(53) : error 029: invalid expression, assumed zero
C:\Users\Jampie\Desktop\pcash test\gamemodes\grandlarc.pwn(53) : warning 215: expression has no effect
C:\Users\Jampie\Desktop\pcash test\gamemodes\grandlarc.pwn(53) : error 001: expected token: ";", but found ")"
C:\Users\Jampie\Desktop\pcash test\gamemodes\grandlarc.pwn(53) : error 029: invalid expression, assumed zero
C:\Users\Jampie\Desktop\pcash test\gamemodes\grandlarc.pwn(53) : fatal error 107: too many error messages on one line
with this command:
Код:
new cmd[256], idx;
	cmd = strtok(cmdtext, idx);

	if(strcmp("/GiveJCash", cmd, true) == 0)
	{
		new tmp[256];
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp)) return SendClientMessage(playerid, red, "You did not give an ID or ammount");
		if(strval(tmp) == playerid) return SendClientMessage(playerid, red, "You can not give yourself PCash");
		if(IsPlayerConnected(strval(tmp)) == 0) return SendClientMessage(playerid, red, "That player is not connected");

		new tmp2[256];
		tmp2 = strtok(cmdtext, idx);
		if(!strlen(tmp2)) return SendClientMessage(playerid, red, "You did not give an ammount");

		new player = strval(tmp);
		new ammount = strval(tmp2);

		if(GetPlayerPCash(playerid) < ammount) return SendClientMessage(playerid, red, "You do not have enough PCash");

		new pname[MAX_PLAYER_NAME];
		GetPlayerName(player, pname, sizeof(pname));

		new oname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, oname, sizeof(oname));

		new string[256];
		format(string, sizeof(string), "You have given %s %d PCash", pname, ammount);
		SendClientMessage(playerid, green, string);

		format(string, sizeof(string), "You have been given %d PCash by %s", ammount, oname);
		SendClientMessage(player, green, string);

		GivePlayerPCash(player, ammount);
		GivePlayerPCash(playerid, -ammount);
		return 1;
	}



Re: Need help with 4 errors - sjvt - 13.04.2012

what is line 53..


Re: Need help with 4 errors - thekiller01 - 13.04.2012

Quote:
Originally Posted by sjvt
Посмотреть сообщение
what is line 53..
here ;p
Код:
if(!strlen(tmp)) return SendClientMessage(playerid, red, "You did not give an ID or ammount");



Re: Need help with 4 errors - sjvt - 13.04.2012

There is nothing wrong with it, btw why you use 256.. 128 is enough for it


Re: Need help with 4 errors - thekiller01 - 13.04.2012

Quote:
Originally Posted by sjvt
Посмотреть сообщение
There is nothing wrong with it, btw why you use 256..
that is line 53 but is there nothing wrong with the cmd??

EDIT: Even when i remove the command i get the 4 errors lol
but its line 53..


Re: Need help with 4 errors - sjvt - 13.04.2012

Did build it in a new.pwn and did change a few functions because i don't use 'GetPlayerPCash, and it compiled correct. So with that command there is nothing wrong


Re: Need help with 4 errors - Sasino97 - 13.04.2012

I think the error has nothing to do with that command, please paste the definition of "red"


Re: Need help with 4 errors - thekiller01 - 13.04.2012

Quote:
Originally Posted by [GF]Sasino97
Посмотреть сообщение
I think the error has nothing to do with that command, please paste the definition of "red"
thats right i did in top of the script #define Red and #define green i replaced them with #define red 0xFF0000AA
and #define green 0x33FF33AA now i only got 1 error:

Код:
C:\Users\Jampie\Desktop\pcash test\gamemodes\grandlarc.pwn(125) : error 021: symbol already defined: "strtok"
srry if its simple error im new ;p


Re: Need help with 4 errors - Phyrunx - 13.04.2012

Search your scripts first 25 lines and remove the line which has Strtok in it


Re: Need help with 4 errors - Sasino97 - 13.04.2012

Quote:
Originally Posted by thekiller01
Посмотреть сообщение
thats right i did in top of the script #define Red and #define green i replaced them with #define red 0xFF0000AA
and #define green 0x33FF33AA
OMG, I don't know how did I guess it, I should be a kind of Sherlock Holmes :P

Quote:
Originally Posted by thekiller01
Посмотреть сообщение
now i only got 1 error:

Код:
C:\Users\Jampie\Desktop\pcash test\gamemodes\grandlarc.pwn(125) : error 021: symbol already defined: "strtok"
srry if its simple error im new ;p
Means that strtok is already made in one of your include file, so you don't need it anymore in the gamemode, Press CTRL+F and search "stock strtok"(or just "strtok" if not working), and where you find the function delete it (Header and body)