Several Errors For Walkie Talkie
#1

Hello SAMP!
Here lately i've been taking it upon myself to learn and PAWN
I've attempted to add a Walkie Talkie function to our server.

I've come to a halt and turn to you all for lessons.


Код:
(60627) : error 033: array must be indexed (variable "pWalkie")
(60629) : error 033: array must be indexed (variable "pWalkieFreq")
(60681) : error 033: array must be indexed (variable "pWalkieFreq")
(60685) : error 033: array must be indexed (variable "pWalkie")
(60687) : error 033: array must be indexed (variable "pWalkieFreq")
(60688) : error 012: invalid function call, not a valid address
(60688) : error 033: array must be indexed (variable "pWalkieFreq")
(60688) : error 029: invalid expression, assumed zero
(60688) : fatal error 107: too many error messages on one line
FIRST ERROR

Код:
new level;
level = strval(tmp);
if(level > 9999 || level < 0) { SendClientMessage(playerid, COLOR_GREY, "Dont go below frequency 0, or above number 9999!"); return 1; }
if (PlayerInfo[playerid][pWalkie] == 1)//Line 60627
{
PlayerInfo[playerid][pWalkieFreq] = level;//Line 60629
format(string, sizeof(string), "   You have set your Walkie Talkie freq to %d",level);
THE REST:
Код:
if(PlayerInfo[playerid][pJailed] > 0)
			{
				SendClientMessage(playerid, TEAM_CYAN_COLOR, "[INFO]: Your radio has been confiscated, You will receive it at the front.");
				return 1;
			}
			if(PlayerInfo[playerid][pWalkieFreq] == 0)//Line 60681
			{
				return 1;
			}
		    if(PlayerInfo[playerid][pWalkie] == 1)//Line 60685
			{
				format(string, sizeof(string), "** Ch[%d] %s: %s **",PlayerInfo[playerid][pWalkieFreq], sendername, result);//Line 60687
				SendWalkieMessage(PlayerInfo[playerid][pWalkieFreq],0x00C6C696, string);//Line 60688
				format(string,sizeof(string), "%s (walkie talkie): %s", sendername, result);
Reply
#2

Can you index variables in enums? Did you [Max_PLAYERS ]; a variable in an enum? Le guess
Reply
#3

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
Can you index variables in enums? Did you [Max_PLAYERS ]; a variable in an enum? Le guess
I do have this, yes.
Код:
new pWalkie[MAX_PLAYERS];
new pWalkieFreq[MAX_PLAYERS];
new SendWalkieMessage[MAX_PLAYERS];
new GiveNameSpace[MAX_PLAYERS];
Reply
#4

The way you are trying to use it is as if those were variables in an array, which they are not. Did you copy this code from somewhere else, or did you write it all yourself?
Reply
#5

This was originally a Filterscript.
I'm playing around with PAWN and attempting to learn some functions and how to code. So i took a look at a Walkie Talkie system from a filterscript and the only thing I changed was the pMuted since the game mode I'm playing around with used that.
Reply
#6

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
Can you index variables in enums? Did you [Max_PLAYERS ]; a variable in an enum? Le guess
enum? I'm not familiar with this.
Reply
#7

Oh okay.

Let's take a look at the differences between your variables, and the one's that you're having errors with.

This is one you're having an error with.

pawn Код:
PlayerInfo[playerid][pWalkie]
This is one of yours:

pawn Код:
pWalkie[playerid]
There's a difference here! The first one is trying to access the "pWalkie" variable in the "PlayerInfo" array (aka. an enum). Your variable, on the other hand, is a standalone variable and the only other value associated with it would be a player's ID.

Does it make sense so far?
Reply
#8

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Oh okay.

Let's take a look at the differences between your variables, and the one's that you're having errors with.

This is one you're having an error with.

pawn Код:
PlayerInfo[playerid][pWalkie]
This is one of yours:

pawn Код:
pWalkie[playerid]
There's a difference here! The first one is trying to access the "pWalkie" variable in the "PlayerInfo" array (aka. an enum). Your variable, on the other hand, is a standalone variable and the only other value associated with it would be a player's ID.

Does it make sense so far?
Ohhh I didn't notice that. So i change it to pWalkie[playerid]
lol makes more sense.
Reply
#9

Quote:
Originally Posted by DJ_Shocker
Посмотреть сообщение
Ohhh I didn't notice that. So i change it to pWalkie[playerid]
lol makes more sense.
Correct. Now, take a look at some of the other pieces of code you posted in your main post. The ones where you received errors when you attempted to compile the code. You probably have the same problem there. Replace the variables with the standalone ones you made and respond on this thread if you have more issues.
Reply
#10

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Correct. Now, take a look at some of the other pieces of code you posted in your main post. The ones where you received errors when you attempted to compile the code. You probably have the same problem there. Replace the variables with the standalone ones you made and respond on this thread if you have more issues.
Thank you so much RealCop. It's almost Midnight here. Lately I've taken up an interest on coding. I've been learning a lot by downloading game modes, filterscripts, etc.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)