Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CMD:createhouse(playerid, params[])
- {
- if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
- if(IsPlayerConnected(playerid))
- {
- if(PlayerInfo[playerid][pAdmin] >= 6)
- {
- new house[64],Float:pX,Float:pY,Float:pZ,string[128],PropertyString[256],query[500];
- if(sscanf(params, "s[64]", house)) return SendClientMessage(playerid, 0xFFFFFFFF, "{FFFFFF}Syntax: {FFFFFF}/createhouse <exterior/interior/complete>");
- if(strcmp(house,"exterior",true) == 0)
- {
- GetPlayerPos(playerid, pX, pY, pZ);
- SetPVarFloat(playerid, "pHeX", pX);
- SetPVarFloat(playerid, "pHeY", pY);
- SetPVarFloat(playerid, "pHeZ", pZ);
- SetPVarInt(playerid, "hExt", 1);
- SendClientMessage(playerid, COLOR_YELLOW, "House exterior position configured.");
- }
- if(strcmp(house,"interior",true) == 0)
- {
- GetPlayerPos(playerid, pX, pY, pZ);
- SetPVarFloat(playerid, "pHiX", pX);
- SetPVarFloat(playerid, "pHiY", pY);
- SetPVarFloat(playerid, "pHiZ", pZ);
- SetPVarInt(playerid, "pHiID", GetPlayerInterior(playerid));
- SetPVarInt(playerid, "pHiVW", GetPlayerVirtualWorld(playerid));
- SetPVarInt(playerid, "hInt", 1);
- SendClientMessage(playerid, COLOR_YELLOW, "House interior position configured.");
- }
- if(strcmp(house,"complete",true) == 0)
- {
- if(GetPVarInt(playerid, "hExt") != 1 || GetPVarInt(playerid, "hInt") != 1)
- return SendClientMessage(playerid, COLOR_RED, "You haven't configured either the house exterior or interior. Creation attempt failed.");
- new i = housess+1;
- mysql_format(SQL, query, sizeof(query), "INSERT INTO houses (Owner, Lockk, Hel, Arm, Level, Rentabil, Rent, Owned, Discription, Value, Takings) VALUES('AdmBot', '0', '0', '0', '10', '1', '500', '0', 'House', '10000000', '0')");
- mysql_tquery(SQL, query, "", "");
- HouseInfo[i][hID] = i;
- HouseInfo[i][hEntrancex] = GetPVarFloat(playerid, "pHeX");
- HouseInfo[i][hEntrancey] = GetPVarFloat(playerid, "pHeY");
- HouseInfo[i][hEntrancez] = GetPVarFloat(playerid, "pHeZ");
- HouseInfo[i][hExitx] = GetPVarFloat(playerid, "pHiX");
- HouseInfo[i][hExity] = GetPVarFloat(playerid, "pHiY");
- HouseInfo[i][hExitz] = GetPVarFloat(playerid, "pHiZ");
- format(HouseInfo[i][hOwner], 64, "The State");
- format(HouseInfo[i][hDiscription], 64, "House");
- HouseInfo[i][hValue] = 10000000;
- HouseInfo[i][hHel] = 0;
- HouseInfo[i][hArm] = 0;
- HouseInfo[i][hInterior] = GetPVarInt(playerid, "pHiID");
- HouseInfo[i][hLock] = 0;
- HouseInfo[i][hOwned] = 0;
- HouseInfo[i][hRent] = 500;
- HouseInfo[i][hRentabil] = 1;
- HouseInfo[i][hTakings] = 0;
- HouseInfo[i][hLevel] = 10;
- HouseInfo[i][hVirtual] = GetPVarInt(playerid, "pHiVW");
- mysql_format(SQL, query, sizeof(query), "UPDATE `houses` SET `Entrancex`='%f',`Entrancey`='%f',`Entrancez`='%f',`Exitx`='%f',`Exity`='%f',`Exitz`='%f',`Interior`='%d',`Virtual`='%d' WHERE `ID`='%d'",HouseInfo[i][hEntrancex],HouseInfo[i][hEntrancey],HouseInfo[i][hEntrancez],HouseInfo[i][hExitx],HouseInfo[i][hExity],HouseInfo[i][hExitz],HouseInfo[i][hInterior],HouseInfo[i][hVirtual],i);
- mysql_tquery(SQL,query,"","");
- DeletePVar(playerid, "pHeX");
- DeletePVar(playerid, "pHeY");
- DeletePVar(playerid, "pHeZ");
- DeletePVar(playerid, "pHiX");
- DeletePVar(playerid, "pHeY");
- DeletePVar(playerid, "pHeZ");
- DeletePVar(playerid, "pHiID");
- DeletePVar(playerid, "pHiVW");
- DeletePVar(playerid, "pExt");
- DeletePVar(playerid, "pInt");
- DestroyDynamic3DTextLabel(HouseLabel[i]);
- format(PropertyString, sizeof(PropertyString),"{FFFFFF}House {FF0000}%d \n{FF0000}This house is for sale(/buyhouse) ! \n{FFFFFF}Description: {FF0000}%s \n{FFFFFF}Price: {FF0000}$%s \n{FFFFFF}Level: {FF0000}%d",i,HouseInfo[i][hDiscription],FormatNumber(HouseInfo[i][hValue]),HouseInfo[i][hLevel]);
- HouseLabel[i] = CreateDynamic3DTextLabel(PropertyString ,0x09FF00CC,HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez],25, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, -1, -1, -1, 100.0);
- DestroyDynamicPickup(HousePickup[i]);
- HousePickup[i] = CreateDynamicPickup(1273, 23, HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]);
- SetPlayerInterior(playerid, 0);
- SetPlayerVirtualWorld(playerid, 0);
- SetPlayerPos(playerid, HouseInfo[i][hEntrancex], HouseInfo[i][hEntrancey], HouseInfo[i][hEntrancez]);
- housess++;
- format(string,sizeof(string),"House %d created!",i);
- SendClientMessage(playerid, COLOR_YELLOW, string);
- }
- }
- else return SendClientMessage(playerid, COLOR_ERROR, AdminOnly);
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement