[HowTo] Using dudb 2.4 to save money/stats/whatever (0.2#Ready)

I still Get 4 Errors

Heres in pastebin again but different errors

http://pastebin.com/m1f1270ff
Reply

I didnt correct they lol I just show you something what was wrong
pawn Код:
(GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money")GetPlayerMoney(playerid));
it should it be
pawn Код:
GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money"));
at least the whole code again
pawn Код:
new string[48];
format(string, sizeof(string), "%s Has Joined The Server.", PlayerName(playerid));
SendClientMessageToAll(0xAAAAAAAA, string);
AllowPlayerTeleport( playerid, 1 );
SendClientMessage(playerid, COLOR_SPRINGGREEN, "~<>~<>Welcome To [BJT]Server~<>~<>");
GameTextForPlayer(playerid, "~~by [T_S]whooper~~", 4000, 4);
SendClientMessage(playerid, COLOR_FLBLUE, "~~~Made With Help Of On_Top_Non_Stop~~~");
SendClientMessage(playerid, COLOR_RED, "~~~~PLEASE /REGISTER OR /LOGIN PASSWORD BEFORE SPAWN!!~~~~");
SendClientMessage(playerid, COLOR_LIME, "~~~~Use /help For Commands~~~~");
SendClientMessage(playerid, COLOR_LIME, "~~~~If You See No Objects Or Some Objects, Tele To Somewhere Else, Then Tele Back To Your Place~~~~");
GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money"));
and PlayerName(playerid) is that
pawn Код:
stock PlayerName(playerid) {
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,MAX_PLAYER_NAME);
return pname; }
Reply

Ok now im getting this error

C:\Documents and Settings\Owner.sheldons\Desktop\SWAT_SERVER\gamemo des\whoopers.pwn(1997) : warning 219: local variable "pname1" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Warning.

Line 1997 is:new pname1[MAX_PLAYER_NAME];

and if i left it at PlayerName i get 7 errors saying local variable"PlayerName" shadows...
Reply

Quote:
Originally Posted by pawn-lang.pdf
219 local variable identifier shadows a symbol at a preceding level
A local variable has the same name as a global variable, a function,
a function argument, or a local variable at a lower precedence
level. This is called “shadowing”, as the new local variable makes
the previously defined function or variable inaccessible.
Note: if there are also error messages further on in the script
about missing variables (with these same names) or brace level
problems, it could well be that the shadowing warnings are due to
these syntactical and semantical errors. Fix the errors first before
looking at the shadowing warnings.
Hope that explain the warning
Reply

It doesn't even save not even the file or name itself!
Reply

Quote:
Originally Posted by whooper
It doesn't even save not even the file or name itself!
maybe you didt created it ....
Reply

It won't let me :S

i tried but i dunno how to.
Reply

I love this. I prefer Dini though.
Reply

Well i tried dini but it confused me bnut i can try again
Reply

Quote:
Originally Posted by whooper
It won't let me :S

i tried but i dunno how to.
Look in dudb.inc that will help you when you dont know the function
that would be the right I think
pawn Код:
stock udb_Create(nickname[],pwd[])
Quote:
Originally Posted by [SAP
Francis ]
I love this. I prefer Dini though.
I prefer dini too
Reply

help,

how can i use this to make levels and to set levels like in a admin script

please help :P
Reply

Dini for the win!!! xD
Reply

do i take that as im not getting a answer
Reply

pawn Код:
//OnGameModeInit()
if(!dini_Exists("Levels")) dini_Create("Levels");
pawn Код:
//OnPlayerConnect(playerid)
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,MAX_PLAYER_NAME);
if(!dini_Int("Levels",pname)) dini_IntSet("Levels",pname,0);
pawn Код:
//OnPlayerCommandText(playerid,cmdtext[])
new idx;
if(!strcmp("/setlevel",cmdtext,true))
{
    new Player = strtok(cmdtext, idx);
    if(!strlen(Player)) return SendClientMessage(playerid,COLOR,"/setlevel [playerid] [0-4]");
    new PlayerID = strval(Player);
    if(!IsPlayerConnected(PlayerID)) return SendClientMessage(playerid,COLOR,"Invalid playerid!");
    new Level = strval(strtok(cmdtext, idx));
    if((Level < 0) || (Level > 4)) return SendClientMessage(playerid,COLOR,"/setlevel [playerid] [0-4]");
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(PlayerID,pname,MAX_PLAYER_NAME);
    if(dini_Int("Levels",pname) == Level) return SendClientMessage(playerid,COLOR,"The player already have this level");
    new string[128];
    dini_IntSet("Levels",pname,Level);
    format(string,sizeof(string),"%s(%d) got a new Level (%d)",pname,PlayerID,Level);
    SendClientMessage(playerid,COLOR,string);
}
Dunno if thats works 100% maybe when someone see something wrong pls corret or just say it
Reply

thanksS
Reply

know someone how to get the string out the output from udb_hash ?
so I can get the password again
pawn Код:
stock udb_hash(buf[]) {
 new length=strlen(buf);
  new s1 = 1;
  new s2 = 0;
  new n;
  for (n=0; n<length; n++)
  {
    s1 = (s1 + buf[n]) % 65521;
    s2 = (s2 + s1)   % 65521;
  }
  return (s2 << 16) + s1;
}
Reply

pawn Код:
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\pawno\include\dutils.inc(28) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\pawno\include\dutils.inc(132) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\pawno\include\dutils.inc(172) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\pawno\include\dutils.inc(267) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\pawno\include\dutils.inc(324) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\pawno\include\dutils.inc(366) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(651) : warning 219: local variable "PlayerName" shadows a variable at a preceding level
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(855) : error 017: undefined symbol "dcmd_login"
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(856) : error 017: undefined symbol "dcmd_register"
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(2217) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(3008) : warning 217: loose indentation
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(3008) : error 017: undefined symbol "dcmd_login"
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(3018) : error 017: undefined symbol "params"
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(3020) : error 017: undefined symbol "params"
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(3033) : warning 225: unreachable code
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(3033) : error 017: undefined symbol "dcmd_register"
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(3043) : error 017: undefined symbol "params"
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(3046) : error 017: undefined symbol "params"
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(3051) : warning 225: unreachable code
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(3051) : warning 217: loose indentation
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(6985) : warning 217: loose indentation
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(7013) : warning 217: loose indentation
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(7261) : warning 219: local variable "PlayerName" shadows a variable at a preceding level
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(7350) : error 025: function heading differs from prototype
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(7350) : error 025: function heading differs from prototype
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(7351) : error 021: symbol already defined: "strtok"
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(7366) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(7373) : error 047: array sizes do not match, or destination array is too small
C:\Documents and Settings\Monik&Vlad\Desktop\SA-MP SERVER\gamemodes\Xtreme.GM.pwn(7377) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


15 Errors.
Strange
I did everythini what you sayd in 1st post but i dunno what is the problem
Reply

that are much errors and warnings I think some come because you forgot to add
pawn Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
because he say sometimes undefined symbol "params"
Reply

Quote:
Originally Posted by Nero_3D
that are much errors and warnings I think some come because you forgot to add
pawn Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
because he say sometimes undefined symbol "params"
Dude i have defined it but the same.
Reply

can i put arrays in dudb ?
EX:i wish this:in the dudb file de file say : name[0]=1,name[1]=0

i'm spanish,i don't speak english very well
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)