11.01.2013, 09:57
pawn Код:
CMD:house(playerid,params[])
{
new param1[20];
if(sscanf(params,"s[20]",param1))
{
SendClientMessage(playerid,COLOR_WHITE,"[Usage] /house [command]");
SendClientMessage(playerid,COLOR_WHITE,"buy, sell, buylock, buyalarm");
SendClientMessage(playerid,COLOR_WHITE,"setrent, evict, buybls, buycloset");
if(PlayerInfo[playerid][pAdmin] > 3) { SendClientMessage(playerid,COLOR_WHITE,"create, delete, edit, reload"); }
return 1;
}
if(!strcmp(param1,"buy"))
{
if(PlayerInfo[playerid][pHouse] == 999)
return SendClientMessage(playerid,COLOR_WHITE,"You already own a house.");
for(new h=0;h<MAX_HOUSES;h++)
{
if(!IsPlayerInRangeOfPoint(playerid,2.5,HouseInfo[h][hEntX],HouseInfo[h][hEntY],HouseInfo[h][hEntZ]))
return SendClientMessage(playerid,COLOR_WHITE,"You're not near any house.");
if(strcmp(HouseInfo[h][hOwnerName],"None") != 0 || strcmp(HouseInfo[h][hOwnerName],"Admin") != 0)
return SendClientMessage(playerid,COLOR_WHITE,"That house isn't for sale.");
if(HouseInfo[h][hPrice] > PlayerInfo[playerid][pCash])
return SendClientMessage(playerid,COLOR_WHITE,"You don't have enough money.");
PlayerInfo[playerid][pHouse] = h;
HouseInfo[h][hOwner] = PlayerInfo[playerid][pID];
HouseInfo[h][hOwnerName] = GetName(playerid);
HouseInfo[h][hPrice] = 0;
HouseInfo[h][hRent] = 100;
}
}
if(!strcmp(param1,"create"))
{
new int, price;
if(PlayerInfo[playerid][pAdmin] < 4)
return 1;
if(sscanf(params,"s[20]ii",param1,int,price))
return SendClientMessage(playerid,COLOR_WHITE,"[Usage] /house create [interior] [price]");
new query[180];
new Float:p[3];
GetPlayerPos(playerid,p[0],p[1],p[2]);
format(query,sizeof(query),"INSERT INTO `houses` (`ownerid`,`price`,`locked`,`int`,`vw`,`rent`,`entx`,`enty`,`entz`,`extx`,`exty`,`exyz`,`ownername`) VALUES ('9999','999999','0','%i','%i','1','%.1f','%.1f','%.1f','%.1f','%.1f','%.1f','None'",int,random(20),p[0],p[1],p[2],HouseInts[int][0],HouseInts[int][1],HouseInts[int][2]);
mysql_query(query);
}
if(strcmp(param1,"reload") == 0)
{
if(PlayerInfo[playerid][pAdmin] < 4)
return 1;
for(new i=0; i<MAX_HOUSES; i++)
{
LoadHouse(i);
}
}
return 1;
}
I'm trying to make /house create [intid] [price], I tried a lot of methods and played with it but failed and it still does nothing when I /house create, it doesn't tell me to put in the params.
Please help.