CreatePickup error
#1

Код:
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.
Reply
#2

https://sampwiki.blast.hk/wiki/CreatePickup
Reply
#3

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

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...
Reply
#5

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);
Reply
#6

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)
Reply
#7

Show us the code around it.
Reply
#8

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;
}
Reply
#9

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.
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)