Need help again...
#1

Hi, I make the same topic again because the error is not fixed and I can't bump old topics (more than 12 hours)...

So, I have got problem with this script:


Code:

Код:
if(pickupid == Package)

	new str[128],Nick[24]; //Here are errors
	GetPlayerName(playerid,Nick,24);
	new Cash = (random(30)+20)*5000;
	format(str,128,"~b~Player ~r~%s ~b~found hidden package and won ~g~%d$!",Nick,Cash);
	GameTextForAll(params[(strlen(tmp)+strlen(tmp2)+2)], strval(tmp2), strval(tmp));
	GivePlayerMoney(playerid,Cash);
	DestroyPickup(Package);
	Package=0;
	}
Errors:

...\filterscripts\Adminscript.pwn(497 : error 003: declaration of a local variable must appear in a compound block
...\filterscripts\Adminscript.pwn(497 : error 017: undefined symbol "str"
...\filterscripts\Adminscript.pwn(497 : warning 215: expression has no effect
...\filterscripts\Adminscript.pwn(497 : error 001: expected token: ";", but found "]"
...\filterscripts\Adminscript.pwn(497 : fatal error 107: too many error messages on one line

I'm not sure with other lines, if there are any "bugs", please fix this

I hope someone will help me, I'm waiting for anwser

Lib

Correct me if I'm wrong here
Reply
#2

Код:
if(pickupid == Package)
{
	new str[128], Nick[24]; //Here are errors
	GetPlayerName(playerid,Nick,24);
	new Cash = (random(30)+20)*5000;
	format(str,128,"~b~Player ~r~%s ~b~found hidden package and won ~g~%d$!",Nick,Cash);
	GameTextForAll(params[(strlen(tmp)+strlen(tmp2)+2)], strval(tmp2), strval(tmp));
	GivePlayerMoney(playerid,Cash);
	DestroyPickup(Package);
	Package=0;
	}
you forgot a {
don't know if that was all though
Reply
#3

Quote:
Originally Posted by Sascha
Посмотреть сообщение
Код:
if(pickupid == Package)
{
	new str[128], Nick[24]; //Here are errors
	GetPlayerName(playerid,Nick,24);
	new Cash = (random(30)+20)*5000;
	format(str,128,"~b~Player ~r~%s ~b~found hidden package and won ~g~%d$!",Nick,Cash);
	GameTextForAll(params[(strlen(tmp)+strlen(tmp2)+2)], strval(tmp2), strval(tmp));
	GivePlayerMoney(playerid,Cash);
	DestroyPickup(Package);
	Package=0;
	}
you forgot a {
don't know if that was all though
Thanks, my fail... But I still have errors:

...\filterscripts\Adminscript.pwn(4982) : error 017: undefined symbol "params"
...\filterscripts\Adminscript.pwn(4982) : error 017: undefined symbol "tmp"
...\filterscripts\Adminscript.pwn(4982) : error 029: invalid expression, assumed zero
...\filterscripts\Adminscript.pwn(4982) : fatal error 107: too many error messages on one line

Код:
if(pickupid == Package)
{
	new str[128], Nick[24];
	GetPlayerName(playerid,Nick,24);
	new Cash = (random(30)+20)*5000;
	format(str,128,"~b~Player ~r~%s ~b~found hidden package and won ~g~%d$!",Nick,Cash);
	GameTextForAll(params[(strlen(tmp)+strlen(tmp2)+2)], strval(tmp2), strval(tmp)); //Here are errors
	GivePlayerMoney(playerid,Cash);
	DestroyPickup(Package);
	Package=0;
	}
I knew I something broke here
Reply
#4

Add
pawn Код:
new params[100], tmp[100];
Reply
#5

Quote:
Originally Posted by Claude
Посмотреть сообщение
Add
pawn Код:
new params[100], tmp[100];
No, no:

...pawno\include\dutils.inc(29 : warning 219: local variable "tmp" shadows a variable at a preceding level
...pawno\include\dutils.inc(443) : warning 219: local variable "tmp" shadows a variable at a preceding level
...pawno\include\dutils.inc(462) : warning 219: local variable "tmp" shadows a variable at a preceding level
...pawno\include\dini.inc(46) : warning 219: local variable "tmp" shadows a variable at a preceding level
...pawno\include\dini.inc(54) : warning 219: local variable "tmp" shadows a variable at a preceding level
...filterscripts\Adminscript.pwn(3683) : warning 219: local variable "params" shadows a variable at a preceding level //I get hundreds errors like this
...filterscripts\Adminscript.pwn(3715) : warning 219: local variable "params" shadows a variable at a preceding level
...filterscripts\Adminscript.pwn(372 : warning 219: local variable "params" shadows a variable at a preceding level
...filterscripts\Adminscript.pwn(3746) : warning 219: local variable "params" shadows a variable at a preceding level
...filterscripts\Adminscript.pwn(3784) : warning 219: local variable "tmp" shadows a variable at a preceding level
...filterscripts\Adminscript.pwn(4983) : error 017: undefined symbol "tmp2"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error

______

Please change the "GameTextForAll(params[(strlen(tmp)+strlen(tmp2)+2)], strval(tmp2), strval(tmp));", I think there's the bug, so edit it please.
Reply
#6

Quote:
Originally Posted by Libra_PL
Посмотреть сообщение
No, no:

...pawno\include\dutils.inc(29 : warning 219: local variable "tmp" shadows a variable at a preceding level
...pawno\include\dutils.inc(443) : warning 219: local variable "tmp" shadows a variable at a preceding level
...pawno\include\dutils.inc(462) : warning 219: local variable "tmp" shadows a variable at a preceding level
...pawno\include\dini.inc(46) : warning 219: local variable "tmp" shadows a variable at a preceding level
...pawno\include\dini.inc(54) : warning 219: local variable "tmp" shadows a variable at a preceding level
...filterscripts\Adminscript.pwn(3683) : warning 219: local variable "params" shadows a variable at a preceding level //I get hundreds errors like this
...filterscripts\Adminscript.pwn(3715) : warning 219: local variable "params" shadows a variable at a preceding level
...filterscripts\Adminscript.pwn(372 : warning 219: local variable "params" shadows a variable at a preceding level
...filterscripts\Adminscript.pwn(3746) : warning 219: local variable "params" shadows a variable at a preceding level
...filterscripts\Adminscript.pwn(3784) : warning 219: local variable "tmp" shadows a variable at a preceding level
...filterscripts\Adminscript.pwn(4983) : error 017: undefined symbol "tmp2"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
If you want get rid of errors put

pawn Код:
new params[100], tmp[100] tmp2[100];
Reply
#7

Still the same...

If someone can, please change

Код:
	format(str,128,"~b~Player ~r~%s ~b~found hidden package and won ~g~%d$!",Nick,Cash);
	GameTextForAll(params[(strlen(tmp)+strlen(tmp2)+2)], strval(tmp2), strval(tmp));
As one line, GamerTextForAll...
Reply
#8

pawn Код:
format(str,128,"~b~Player ~r~%s ~b~found hidden package and won ~g~%d$!",Nick,Cash);
GameTextForAll(str,0,5000);
should work
Reply
#9

It works, thanks But when I changed this, I get this error here:

Код:
dcmd_chp(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 5) {
		GetPlayerPos(playerid,P[0],P[1],P[2]); //Errors are here :(
		GetPlayerFacingAngle(playerid,P[3]);
		format(str,128,"You have created a Hidden Package! Use command /say or /announce to tell other to find this!");
		SendClientMessage(blue,str);
		if(Package != 0) DestroyObject(Package);
		P[0] += (1.0 * floatsin(-P[3], degrees));
		P[1] += (1.0 * floatcos(-P[3], degrees));
		Package = CreatePickup(1210,P[0],P[1],P[2]-0.5,0.0,0.0,0.0);
	} else return SendClientMessage(playerid,red,"ERROR: Only Admins with level 5 and higher can use this command");
}

Errors are:

...filterscripts\Adminscript.pwn(2344) : error 017: undefined symbol "P"
...filterscripts\Adminscript.pwn(2344) : warning 215: expression has no effect
...filterscripts\Adminscript.pwn(2344) : error 001: expected token: ";", but found "]"
...filterscripts\Adminscript.pwn(2344) : error 029: invalid expression, assumed zero
...filterscripts\Adminscript.pwn(2344) : fatal error 107: too many error messages on one line

Sorry for that, but I really need help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)