SA-MP Forums Archive
Problem with code. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with code. (/showthread.php?tid=141631)



Problem with code. - friped93 - 14.04.2010

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.


Re: Problem with code. - Jeffry - 14.04.2010

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.




Re: Problem with code. - Thrarod - 14.04.2010

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



Re: Problem with code. - friped93 - 14.04.2010

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?


Re: Problem with code. - Jeffry - 14.04.2010

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.



Re: Problem with code. - friped93 - 14.04.2010

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)



Re: Problem with code. - Jeffry - 14.04.2010

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.


Re: Problem with code. - pagie1111 - 14.04.2010

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.


Re: Problem with code. - friped93 - 15.04.2010

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?