How to assign this to array?
#1

How do i assign this to an array?

Heres what i have

pawn Код:
PlayersInput[playerid] = inputtext;
But that brings error: Must be assigned to array
Reply
#2

pawn Код:
format(PlayersInput[playerid], sizeof(PlayersInput), "%s", inputtext);
Reply
#3

Quote:
Originally Posted by Don Correlli
pawn Код:
format(PlayersInput[playerid], sizeof(PlayersInput), "%s", inputtext);
It is enough to do:

pawn Код:
format(PlayersInput[playerid], sizeof(PlayersInput), inputtext);
Reply
#4

Quote:
Originally Posted by Don Correlli
pawn Код:
format(PlayersInput[playerid], sizeof(PlayersInput), "%s", inputtext);
Yeah that works, How to check if a player didnt type in anything?
Reply
#5

It looks like PlayersInput is only an one dimensional array, so that what your problem will be. Your original example of...

Код:
PlayersInput[playerid] = inputtext;
... could actually work, if you made it correctly. Maybe make it something like this?

Код:
new PlayersInput[MAX_PLAYERS][130];
Reply
#6

Quote:
Originally Posted by Joe Torran C
Quote:
Originally Posted by Don Correlli
pawn Код:
format(PlayersInput[playerid], sizeof(PlayersInput), "%s", inputtext);
Yeah that works, How to check if a player didnt type in anything?
Reply
#7

Quote:
Originally Posted by Joe Torran C
Yeah that works, How to check if a player didnt type in anything?
https://sampwiki.blast.hk/wiki/Strlen
Reply
#8

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by Joe Torran C
Yeah that works, How to check if a player didnt type in anything?
https://sampwiki.blast.hk/wiki/Strlen
Cool ty
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)