SA-MP Forums Archive
CreatePickup error - 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: CreatePickup error (/showthread.php?tid=610258)



CreatePickup error - FishyZ - 21.06.2016

Код:
jobtownhall = CreatePickup(1239, 1,361.8299,173.5686,1008.3828, 0);
Код:
C:\Users\Fishy\Desktop\New folder (2)\gamemodes\ROLEPLAY.pwn(94) : error 022: must be lvalue (non-constant)
Help please.


Re: CreatePickup error - F1N4L - 21.06.2016

https://sampwiki.blast.hk/wiki/CreatePickup


Re: CreatePickup error - FishyZ - 21.06.2016

Quote:
Originally Posted by F1N4L
Посмотреть сообщение
Thanks but it didn't help me do anything.


Re: CreatePickup error - F1N4L - 21.06.2016

Look:
Код:
new PickTest; // Int var

main()
{
    PickTest = CreatePickup(1239, 1,361.8299,173.5686,1008.3828, 0);
}
This example don't have errors. Post your code...


Re: CreatePickup error - Stinged - 21.06.2016

This error is shown when the variable is declared as a const.

For example:
Код:
const jobtownhall;
jobtownhall = CreatePickup(1239, 1,361.8299,173.5686,1008.3828, 0);
For it to work it should be:
Код:
new jobtownhall;
jobtownhall = CreatePickup(1239, 1,361.8299,173.5686,1008.3828, 0);



Re: CreatePickup error - FishyZ - 21.06.2016

Quote:
Originally Posted by Stinged
Посмотреть сообщение
This error is shown when the variable is declared as a const.

For example:
Код:
const jobtownhall;
jobtownhall = CreatePickup(1239, 1,361.8299,173.5686,1008.3828, 0);
For it to work it should be:
Код:
new jobtownhall;
jobtownhall = CreatePickup(1239, 1,361.8299,173.5686,1008.3828, 0);

Код:
new jobtownhall;
jobtownhall = CreatePickup(1239, 1,361.8299,173.5686,1008.3828, 0); //this is /job pickup
and I'm getting these errors, the above are both line 93 and 94.

Код:
C:\Users\Fishy\Desktop\New folder (2)\gamemodes\ROLEPLAY.pwn(93) : error 001: expected token: "-identifier-", but found "-integer value-"
C:\Users\Fishy\Desktop\New folder (2)\gamemodes\ROLEPLAY.pwn(94) : error 022: must be lvalue (non-constant)



Re: CreatePickup error - Stinged - 21.06.2016

Show us the code around it.


Re: CreatePickup error - FishyZ - 21.06.2016

Quote:
Originally Posted by Stinged
Посмотреть сообщение
Show us the code around it.
Код:
public OnGameModeInit()
{
    AddStaticPickup(1239, 1,2303.8369,-16.3016,26.4844, 0); // BANK
    AddStaticPickup(1239, 1, 2273.6565,82.0496,26.4844, 0); //TOWN HALL
    AddStaticPickup(1239, 1, 2269.5369,-74.4108,26.7724, 0); //police station
    new jobtownhall;
    jobtownhall = CreatePickup(1239, 1,361.8299,173.5686,1008.3828, 0); //this is /job pickup
    DisableInteriorEnterExits();
   EnableStuntBonusForAll(0);
   // Don't use these lines if it's a filterscript
   GetGameModeText("Blank Script");
   AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
   return 1;
}



Re: CreatePickup error - Vince - 21.06.2016

Do you have a #define jobtownhall or something? The errors lead me to believe you have something like:

PHP код:
#define jobtownhall 1 
which would then compile to:

PHP код:
new 1;
CreatePickup(/* ... */
And then the errors make sense. The 001 refers to the 1 on the first line, which is an invalid variable name. The 022 refers to the 1 on the second line, saying that it must be a variable instead of a constant value.


Re: CreatePickup error - FishyZ - 21.06.2016

Quote:
Originally Posted by Vince
Посмотреть сообщение
Do you have a #define jobtownhall or something? The errors lead me to believe you have something like:

PHP код:
#define jobtownhall 1 
which would then compile to:

PHP код:
new 1;
CreatePickup(/* ... */
And then the errors make sense. The 001 refers to the 1 on the first line, which is an invalid variable name. The 022 refers to the 1 on the second line, saying that it must be a variable instead of a constant value.
Yes I do have something like this.


Код:
#define jobtownhall 1
EDIT

Код:
C:\Users\Fishy\Desktop\New folder (2)\gamemodes\ROLEPLAY.pwn(93) : warning 204: symbol is assigned a value that is never used: "jobtownhall"

This is the only error I'm getting at the moment