/hmenu system house
#1

Bro.. How to make cmd /hmenu to /Buy or Changeinterior?
I use MYSQL DATA...



PHP код:
CMD:createmansion(playerid,params[])
{
   new 
str[30];
   
format(str,sizeof(str),"12000000 0 %d",mansions[random(sizeof(mansions))]);
   
cmd_createhouse(playerid,str);
   return 
1;
}
CMD:gotohouse(playerid,params[])
{
    if(
PlayerInfoplayerid ][ ActionID ] != || PlayerInfoplayerid ][ Challenge ] == 1) return SendClientMessage(playerid,-1,"{FF0000}ERROR: {C8C8C8}You can't teleport to houses while in a DM!");
    new 
i;
    if(
sscanf(params"d"i)) return SendClientMessageplayeridCOLOR_ULTRARED"{15D4ED}INFO: {FFE4C4}Type /gohouse <ID> to teleport to a house ID." ),ShowPlayerDialogplayeridDIALOG_EMPTYDIALOG_STYLE_MSGBOX""ORANGE_"NFS:"LIGHTBLUE_"Houses"""W"Usage:/gotohouse (houseid)""Close""" );
    if(
999) return ShowPlayerDialogplayeridDIALOG_EMPTYDIALOG_STYLE_MSGBOX""ORANGE_"NFS:"LIGHTBLUE_"Houses"""W"Invalid house ID. This house ID does not exist.""Close""" );
    if(
>= 0)
    {
      new 
lstring[256];
      
format(lstring,256,""W"You have teleported to house ID "LBLUE_"%d"W".",i);
      
ShowPlayerDialogplayeridDIALOG_EMPTYDIALOG_STYLE_MSGBOX""ORANGE_"NFS:"LIGHTBLUE_"Houses"lstring"Close""" );
      
SetPlayerPos(playerid,hInfo[i][sX],hInfo[i][sY],hInfo[i][sZ]);
      
SetPlayerFacingAngle(playerid,hInfo[i][SpawnA]);
    }
    return 
1;
}
CMD:housesplayeridparams[ ] )
{
    
gsString] = EOS;
    new 
V;
    new 
lstring[5000];
    
formatlstringsizeoflstring ), "%s"DBLUE_"There are %d houses available:\n\n",lstring,CountHouses());
    for(new 
0sizeof(hInfo); i++)
    {
        if(
hInfo[i][hOwnerID] == -255)
        {
            
formatlstringsizeoflstring ), "%s"W"%d) {FFE4C4}House ID: %d "GRI"(Location: Unknown) (Price: "GREEN_"$%s"GRI")\n",lstring,V,i,FormatNumberhInfo[i][Cost] ) );
            
V++;
        }
    }
    if ( 
== )
        
formatlstringsizeoflstring ), "{FF0000}No house is available for sale!" );
    return 
ShowPlayerDialogplayeridDIALOG_EMPTYDIALOG_STYLE_MSGBOX"{FFE4C4}House List"lstring"Quit""" );
}
stock CountHouses()
{
     new 
count;
     for(new 
0sizeof(hInfo); i++)
     {
       if(
hInfo[i][hOwnerID] == -255count++;
     }
     return 
count;
}
CMD:createhouse(playerid,params[])
{
   if ( !
IsPlayerAdminplayerid ) )
        return 
SendErrorplayerid" {C8C8C8}You are not authorized to use this command!" );
   new 
PrIcE,b,vip;
   if(
sscanf(params,"ddd",PrIcE,vip,b))
   return 
SendClientMessageplayeridCOLOR_ULTRARED,""R"/Createhouse <price> <Vip (1/0)> <interior> ")
   ,
SendClientMessage(playerid,0x9DDB79FF,"*{368C00} You can use {9DDB79}/create(caravan/smallhouse/bighouse/villa/mansion){368C00} for a faster house creation");
   if(
vip != && vip != 1)  return SendClientMessageplayeridCOLOR_ULTRARED,""R"Invalid value for VIP entered!");
   if(
|| sizeof(HouseInteriors)) return SendClientMessageplayeridCOLOR_ULTRARED,""R"invalid interior ,use /interiors to see the list with available interiors");
   new 
Float:x,Float:y,Float:z,Float:a;
   
GetPlayerPos(playerid,x,y,z);
   
GetPlayerFacingAngle(playerid,a);
   
formatgsQuerysizeof gsQuery"INSERT INTO `houses` VALUES(0,'House For Sale!','No Owner', '%d',  '%f',  '%f',  '%f',  '%f',  '%f',  '%f',  '%f',  '%d',  '%d','0','-255','0')",PrIcE,x,y,z,x,y,z,a,b,vip);
   
mysql_querygsQuery );
   new 
HouseIntID;
   
HouseIntID mysql_insert_id( );
   
hExist[HouseIntID]=true;
   
format(hInfoHouseIntID ][ Name ],50,"House For Sale!");
   
format(hInfoHouseIntID ][ Owner ],24,"No Owner");
   
hInfoHouseIntID ][ hOwnerID ] = -255;
   
hInfoHouseIntID ][ Cost ] =PrIcE;
   
hInfoHouseIntID ][ ExteriorX ]= x;
   
hInfoHouseIntID ][ ExteriorY ]= y;
   
hInfoHouseIntID ][ ExteriorZ ]= z;
   
hInfoHouseIntID ][ sX ] = x;
   
hInfoHouseIntID ][ sY ] = y;
   
hInfoHouseIntID ][ sZ ] = z;
   
hInfoHouseIntID ][ SpawnA ] = a;
   
hInfoHouseIntID ][ PP ] = vip;
   
hInfo[HouseIntID ][Interior] = b;
   
hInfo[HouseIntID ][VirtualWorld] = Hvw;
   
hInfoHouseIntID ][ hLocked ] =0;
   
HousePickup[HouseIntID] = CreatePickup(127323xyz);
   
HouseIcon[HouseIntID] = CreateDynamicMapIcon(x,y,z,31,0,0,-1,-1,500.0);
   new 
str[1000];
   
format(str,sizeof(str),""LIGHTBLUE_"House Name: "W"%s\n"LIGHTBLUE_"House Owner: "W"No Owner\n "LIGHTBLUE_"House Value: "W"%d$\n"LIGHTBLUE_"For Sale: "W"Yes\n"LIGHTBLUE_"House ID: "ORANGE_"%d",hInfoHouseIntID ][ Name ],hInfoHouseIntID ][ Cost ],HouseIntID);
   
House3D[HouseIntID]=CreateDynamic3DTextLabelstr, ~1,x,y,z40.0INVALID_PLAYER_IDINVALID_VEHICLE_ID,0);
   
format(str,sizeof(str)," {FF6600}» House Editor «{FFE100}House id %d has been created",HouseIntID);
   
SendClientMessage(playerid,0xFFE100FF,str);
   
SendClientMessage(playerid,-1,"Use (/housespawn) spawn position on this house");
   
Hvw++;
   
ResetHouseTimeStamp(HouseIntID);
   return 
1;
}
CMD:deletehouse(playerid,params[])
{
   new 
iD;
   
LevelCheckplayerid10 );
   if(
sscanf(params,"i",iD)) return SendClientMessageplayeridCOLOR_ULTRARED,""R"/deletehouse <HouseID>");
   if(
iD 999) return ShowPlayerDialogplayeridDIALOG_EMPTYDIALOG_STYLE_MSGBOX""ORANGE_"NFS:"LIGHTBLUE_"Houses"""W"Invalid house ID. This house ID does not exist.""Close""" );
   if(
hInfoiD ][ hOwnerID ] > 0) return SendClientMessageplayeridCOLOR_ULTRARED,""R"You must approve this house before removing it");
   if(!
IsPlayerInRangeOfPoint(playerid,20.0,hInfoiD ][ ExteriorX ],hInfoiD ][ ExteriorY ],hInfoiD ][ ExteriorZ ])) return SendClientMessageplayeridCOLOR_ULTRARED,""R"You must be near the house");
   
hInfoiD ][ hOwnerID ]= -255;
   
hInfoiD ][ ExteriorX ]= 0.0;
   
hInfoiD ][ ExteriorY ]= 0.0;
   
hInfoiD ][ ExteriorZ ]= 0.0;
   
hInfoiD ][ sX ] = 0.0;
   
hInfoiD ][ sY ] = 0.0;
   
hInfoiD ][ sZ ] = 0.0;
   
hInfoiD ][ SpawnA ] = 0.0;
   
DestroyPickup(HousePickup[iD]);
   
DestroyDynamicMapIcon(HouseIcon[iD]);
   
HouseIcon[iD]=-1,HousePickup[iD]=-1;
   
Delete3DTextLabel(House3D[iD]);
   new 
str[128];
   
format(str,sizeof(str),"House id %d has been removed",iD);
   
SendClientMessage(playerid,-1,str);
   
formatgsQuery128,  "DELETE FROM `houses` WHERE `ID` = '%d'",iD);
   
mysql_querygsQueryTHREAD_NONEplayerid );
   
hExist[iD]=false;
   return 
1;
}
CMD:house(playerid,params[])
{
   if(
PlayerInfoplayerid ][ ActionID ] != || PlayerInfoplayerid ][ Challenge ] == 1) return SendClientMessage(playerid,-1,"{FF0000}ERROR: {C8C8C8}You can't use this command while in a DM!");
   if(
gettime() - HouseWait[playerid] < 180) return SendClientMessageplayeridCOLOR_ULTRARED,""R"This command can only be used once in 3 minutes");
   
HouseWait[playerid]=gettime();
   new 
h=PlayerInfo[playerid][pHouse];
   if(
>= 0)
   {
      new 
b=hInfo[h][Interior];
      
SetPlayerPos(playerid,HouseInteriors[b][IntPos][0],HouseInteriors[b][IntPos][1],HouseInteriors[b][IntPos][2]);
      
SetPlayerFacingAngle(playerid,HouseInteriors[b][IntPos][3]);
      
SetPlayerInterior(playerid,HouseInteriors[b][IntID]);
      
SetPlayerVirtualWorld(playerid,hInfo[h][VirtualWorld]);
      
InHouse[playerid]=h;
   }
   else 
SendClientMessageplayeridCOLOR_ULTRARED,"{FF0000}ERROR: {C8C8C8}You do not own a house!");
   return 
1;
}
CMD:housespawn(playerid,params[])
{
   new 
iD;
   
LevelCheckplayerid10 );
   if(
sscanf(params,"d",iD)) return SendClientMessageplayeridCOLOR_ULTRARED,""R"/HoudeSpawn <HouseID>");
   if(
iD 999) return ShowPlayerDialogplayeridDIALOG_EMPTYDIALOG_STYLE_MSGBOX""ORANGE_"NFS:"LIGHTBLUE_"Houses"""W"Invalid house ID. This house ID does not exist.""Close""" );
   if(!
IsPlayerInRangeOfPoint(playerid,15.0,hInfoiD ][ ExteriorX ],hInfoiD ][ ExteriorY ],hInfoiD ][ ExteriorZ ])) return SendClientMessageplayeridCOLOR_ULTRARED,""R"You must be near the house");
   new 
Float:x,Float:y,Float:z,Float:a;
   
GetPlayerPos(playerid,x,y,z);
   
GetPlayerFacingAngle(playerid,a);
   
hInfoiD ][ sX ] = x;
   
hInfoiD ][ sY ] = y;
   
hInfoiD ][ sZ ] = z;
   
hInfoiD ][ SpawnA ] = a;
   new 
str[128];
   
format(str,sizeof(str)," {FF6600}»House« {FFE100}House id %d Spawn Point has been changed",iD);
   
SendClientMessage(playerid,-1,str);
   
formatgsQuerysizeof gsQuery,"UPDATE `houses` SET `SpawnX`=%f,`SpawnY`=%f,`SpawnZ`=%f,`SpawnA`=%f WHERE `ID` = %d",hInfoiD ][ sX ],hInfoiD ][ sY ],hInfoiD ][ sZ ],hInfoiD ][ SpawnA ], iD );
   
mysql_querygsQueryTHREAD_NONEplayerid );
   return 
1;

Reply
#2

This board isn't for you to place scripting requests. If you want someone to script something for you go to this topic: https://sampforum.blast.hk/showthread.php?tid=447813
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)