SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

Thread Tools Display Modes
Old 19/02/2010, 08:32 PM   #1
Huge Clucker
Join Date: Mar 2009
Posts: 336
Reputation: 0
Default House system problem.

Hello there, I have a following problem. I am using Antironix House System. Problem is, when I buy a house, the cash returns to the account when the player returns to the server and logs back in.

This is the code:

  #pragma unused params
	new str[255],str1[255],pname[24], housenumber;
	housenumber = GetHouseID(playerid);
	if(housenumber == -1) return SendClientMessage(playerid, COLOR_ADMIN, "*** Nie jestes w ikonce domu!");

	GetPlayerName(playerid, pname, 24);
	format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname));
		if (dini_Int(str1, "Houseid")!=-255) return SendClientMessage(playerid, COLOR_YELLOW, "*** Możesz kupić tylko jeden dom!");
	format(str1, sizeof(str1), "Houses/houseid%d", housenumber);
	if (strcmp(hInfo[housenumber][Name],"ForSale",true)) return SendClientMessage(playerid, COLOR_YELLOW, "*** Ten dom nie jest na sprzedaż!");
	if(GetPlayerMoney(playerid)<hInfo[housenumber][Cost]) return SendClientMessage(playerid, COLOR_ADMIN, "*** Nie masz wystarczająco pieniędzy przy sobie!");
	SendClientMessage(playerid, COLOR_GREEN, "*** Gratulacje, własnie stałes się włascicielem tej parceli! Wpisz /househelp aby zobaczyć komendy własciciela domu!");
	format(str, sizeof(str), "%s has bought houseid 0",pname);
  GivePlayerMoney(playerid, -hInfo[housenumber][Cost]);
  dini_Set(str1, "Name", pname);
  dini_IntSet(str1, "Cash", GetPlayerMoney(playerid));
  hInfo[housenumber][Locked] = dini_IntSet(str1,"Locked",0);

	format(str1, sizeof(str1), "Houses/Users/%s", udb_encode(pname));
	if (!dini_Exists(str1)) dini_Create(str1);
	new Float:sy, Float:sx, Float:sz;
	dini_IntSet(str1, "Houseid", housenumber);
		dini_IntSet(str1, "Rentid", -255);
	GetPlayerPos(playerid, sx,sy,sz);
	dini_FloatSet(str1, "SpawnX", sx);
	dini_FloatSet(str1, "SpawnY", sy);
	dini_FloatSet(str1, "SpawnZ", sz);
	dini_IntSet(str1, "SpawnInt", GetPlayerInterior(playerid));
	HousePickup[housenumber] = CreatePickup(1272, 23, hInfo[housenumber][iconx], hInfo[housenumber][icony], hInfo[housenumber][iconz]);
	return 1;
I wonder whether it's the /buy code problem or the login code problem. I will include /login code too..

	if(strcmp(cmd, "/login", true) == 0)
	  new PlayerName[24];
	  tmp = strtok(cmdtext, idx);
	  if(strlen(tmp) == 0) return SendClientMessage(playerid, 0xFFFFFFFF, "UŻYCIE: /login [hasło]");
		new name[MAX_PLAYER_NAME];
		if(IsLogged[playerid] == 1)
			SendClientMessage(playerid, COLOR_GREEN, "Jestes już zalogowany!");
			return 1;
			GetPlayerName(playerid, name, sizeof(name));
		  	tmp2 = dini_Get(file, "Password");
			 	if(udb_hash(tmp) != strval(tmp2))
				  SendClientMessage(playerid, COLOR_ADMIN, "Login się nie powiódł!");
	 			  GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
	 			  printf("%s nie zalogował się poprawnie.", name);
				 	IsLogged[playerid] = 1;
				 	SetPlayerSkin(playerid, dini_Int(file, "Skin"));
				 	SetPlayerMoney(playerid, dini_Int(file, "Cash"));
					SendClientMessage(playerid, COLOR_GREEN, "[SYSTEM]: Zalogowałes się na konto!");
		return 1;
I would be glad if anyone could help me.

Thanks and Regards,
Puzi is offline  

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] [FS] v1.6e || Simple House System || 1 line = 1 house Antironix Filterscripts 1307 28/04/2016 01:22 PM
[FS] v1.6e || Simple House System ---- Problem TheDrifter Help Archive 1 17/05/2010 11:30 AM
House System is Reading 22 House] MahmutBey Help Archive 2 01/05/2010 11:52 AM
Problem with my house system ... Universal Help Archive 9 07/02/2010 03:04 PM
stefans elite house system problem bartje01 Help Archive 7 07/02/2010 12:47 PM

All times are GMT. The time now is 02:01 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.