05.06.2010, 23:26
Ok, i got my /register and /login, and it gives one cookie (my variable) on register. and i got a edited money command to /givecookie, and i give myself 50 cookies, but it doesnt save? but everything else does.
Код:
dcmd_login(playerid, params[]) { new file[128]; new string[128], pname[MAX_PLAYER_NAME]; GetPlayerName(playerid, pname, sizeof(pname)); format(file, sizeof(file), "\\Users\\%s.ini", pname); if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /login [password]"); if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_RED, "You are not registered!"); if(logged[playerid]) return SendClientMessage(playerid, COLOR_RED, "You are already logged in!"); new tmp; tmp = dini_Int(file, "hashPW"); if(udb_hash(params) != tmp) { format(string, 256, "You specified the wrong password for %s!", pname); SendClientMessage(playerid, COLOR_RED, string); } else { logged[playerid] = 1; level[playerid] = dini_Int(file, "level"); SetPlayerScore(playerid, dini_Int(file, "score")); SetPVarInt(playerid,"Cookies", dini_Int(file, "Cookies")); GivePlayerMoney(playerid, dini_Int(file, "money")-GetPlayerMoney(playerid)); SendClientMessage(playerid, COLOR_YELLOW, "You have succesfully logged in!"); printf("%s (%i) logged in with password %s", pname, playerid, params); } return 1; }
Код:
dcmd_setcookies(playerid, params[]) { new giveplayerid, amount; if (sscanf(params, "ud", giveplayerid, amount)) SendClientMessage(playerid, 0xFF0000AA, "Usage: /givecookie [playerid/partname] [amount]"); else if (giveplayerid == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found"); else { SetPVarInt(giveplayerid,"Cookies",amount); SendClientMessage(playerid, 0x00FF00AA, "Cookies sent!"); SendClientMessage(giveplayerid, 0x00FF00AA, "Cookies received!"); } return 1; }