House check code -
Osviux - 28.11.2010
Hi, I need a code that OnPlayerConnect checks if a player has a house. Im he does then something happens i dont know a message apears "You have a house" if not "You dont have a house". I will change the messages for my needs, thanks.
Re: House check code -
sekol - 28.11.2010
It depends on your house system.
Re: House check code -
Osviux - 28.11.2010
Will this do?
//Namo pirkimas
else if(mode == 4)
{
print("namas");
new houseid = playerDB[playerid][rid][3];
if(!strcmp(text,"taip",true))
{
if(GetPlayerMoneyA(playerid) < houseDB[houseid][nkaina])
{
SendClientMessage(playerid,RED,"* Jus neturite tiek pinigu.");
return 0;
}
if(GetPlayerScore(playerid) < 5000){ SendClientMessage(playerid, RED, "* Jus negalite pirkti namo.Jusu per maza patirtis(5000xp)!!"); return 1;}
//Zaidejas turi pakankamai pinigu, duodam jam nama!
GivePlayerMoneyA(playerid,-houseDB[houseid][nkaina]);
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
strmid(houseDB[houseid][owner_name],name,0,MAX_PLAYER_NAME,MAX_PLAYER_NAME);
houseDB[houseid][setting]=random(5);
houseDB[houseid][krumeliai]=0;
// houseDB[houseid][namehash]=tohash(name);
//OK.... zaidejas nama turi ram'e. Bet reikia ir flat file.. so we dump
new file[128];
format(file,sizeof(file),"saves/house/%i",houseid);
if(!fexist(file)) dini_Create(file);
dini_Set(file,"owner_name",name);
dini_IntSet(file,"hash",tohash(name));
dini_IntSet(file,"setting",houseDB[houseid][setting]);
dini_IntSet(file,"kaina",houseDB[houseid][nkaina]);
dini_IntSet(file,"krumeliai",0);
SendClientMessage(playerid, BLUE,"* Namas nupirktas!");
SetPlayerScore(playerid,(GetPlayerScore(playerid)+ 1)+random(2));
return 0;
}
SendClientMessage(playerid, RED,"* Namas nenupirktas.");
return 0;
}
Re: House check code -
Osviux - 29.11.2010
Bump. I need that a player could own only one house, please help.
Re: House check code -
Osviux - 29.11.2010
Could this work?
if(houseDB[playerid][houseid]=0
{
SendClientMessage(playerid,RED,"You already have a house you noob!");
return 0;
}
Re: House check code -
MadeMan - 29.11.2010
pawn Код:
new havehouse;
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid,name,sizeof(name));
for(new i=0; i < sizeof(houseDB); i++)
{
if(!strcmp(houseDB[i][owner_name],name))
{
havehouse = 1;
SendClientMessage(playerid, 0xFFFFFFFF,"You have a house");
break;
}
}
if(havehouse == 0)
{
SendClientMessage(playerid, 0xFFFFFFFF,"You don't have a house");
}