Giving a variable problem
#1

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;
}
Reply


Messages In This Thread
Giving a variable problem - by -Rebel Son- - 05.06.2010, 23:26
Re: Giving a variable problem - by (SF)Noobanatior - 05.06.2010, 23:29
Re: Giving a variable problem - by -Rebel Son- - 05.06.2010, 23:32
Re: Giving a variable problem - by (SF)Noobanatior - 05.06.2010, 23:44
Re: Giving a variable problem - by -Rebel Son- - 05.06.2010, 23:54
Re: Giving a variable problem - by (SF)Noobanatior - 05.06.2010, 23:56
Re: Giving a variable problem - by -Rebel Son- - 05.06.2010, 23:57
Re: Giving a variable problem - by (SF)Noobanatior - 06.06.2010, 00:01
Re: Giving a variable problem - by -Rebel Son- - 06.06.2010, 00:07
Re: Giving a variable problem - by (SF)Noobanatior - 06.06.2010, 00:09

Forum Jump:


Users browsing this thread: 1 Guest(s)