Problem with code.
#1

Hello, I got a problem with my code it gives me one error.

Codeline 135)
Код:
else if (password != dini_Get(file,"password")) return SendClientMessage(playerid, Yellow, "FAIL: Wrong Password.");
Error:
Код:
C:\Users\Filip\Desktop\SA-MP Serv\gamemodes\rp.pwn(135) : error 033: array must be indexed (variable "dini_Get")
would love if someone can help me with it.
Reply
#2

Try this:

pawn Код:
new playerpass[100];
playerpass=dini_Get(file,"password");
if(!strcmp(password,"create",false)) return SendClientMessage(playerid, Yellow, "FAIL: Wrong Password.");
Hope this works, didnt test it.

Reply
#3

Код:
new playerpass[32]; //Why waste 100 digits?
playerpass=dini_Get(file,"password");
if(!strcmp(password,"create",false)) return SendClientMessage(playerid, Yellow, "FAIL: Wrong Password.");
Reply
#4

Quote:
Originally Posted by Jeffry
Try this:

pawn Код:
new playerpass[100];
playerpass=dini_Get(file,"password");
if(!strcmp(password,"create",false)) return SendClientMessage(playerid, Yellow, "FAIL: Wrong Password.");
Hope this works, didnt test it.

I don't get it to work and BTW I don't Se the logic in that how that should even work?
Reply
#5

pawn Код:
new playerpass[100];
playerpass=dini_Get(file,"password");
if(!strcmp(password,playerpass,false)) return SendClientMessage(playerid, Yellow, "FAIL: Wrong Password.");
Damn copy paste mistakes. Try this now.
Reply
#6

Quote:
Originally Posted by Jeffry
pawn Код:
new playerpass[100];
playerpass=dini_Get(file,"password");
if(!strcmp(password,playerpass,false)) return SendClientMessage(playerid, Yellow, "FAIL: Wrong Password.");
Damn copy paste mistakes. Try this now.
130layerpass=dini_Get(file,"password");
135:if(!strcmp(password,playerpass,false)) return SendClientMessage(playerid, Yellow, "FAIL: Wrong Password.");
Код:
C:\Users\Filip\Desktop\SA-MP Serv\gamemodes\rp.pwn(130) : error 047: array sizes do not match, or destination array is too small
C:\Users\Filip\Desktop\SA-MP Serv\gamemodes\rp.pwn(135) : error 035: argument type mismatch (argument 1)
Reply
#7

hmm.
maybe:

pawn Код:
if(strcmp(password,playerpass,true)==0) return SendClientMessage(playerid, Yellow, "FAIL: Wrong Password.");
If you use dini, you may also use DUDB, which has this function:

pawn Код:
(udb_CheckLogin(PlayerName(playerid),password))
More I cant help. Dont know anymore.
Reply
#8

DINI uses a MAX_STRING size of 256 cells.

You can't get a 256 cell string to go into a 128 cell string.

256 - 128 = 128 cells needed that do not exist.

You can fix this in two ways.

First is open your dini and change the define DINI_MAX_STRING to 128

or change playerpass[128] to playerpass[256];

Your choice, have fun.
Reply
#9

Okey did get it to work but now when I enter the correct Password it adds SERVER: UNKNOWN COMMAND? why? and how can I turn it of?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)