17.03.2012, 14:22
Well i got a code from a edit
But i want it like
when a rcon admin type it
it should work like this
/create house [Price] [Level] [Interior]
And create a green house icon for buying..and save the house in
Script file/Houses
If you could help please tell me..
I am clueless and helpless too :/
pawn Код:
command(createhouse, playerid, params[])
{
new Usage[128], string[128];
if(sscanf(params, "z", Usage))
{
if(Player[playerid][AdminLevel] >= 10)
{
SendClientMessage(playerid, WHITE, "Server: /createhouse [usage]");
SendClientMessage(playerid, GREY, "Usage: Interior, Exterior or Complete.");
}
}
else
{
if(Player[playerid][AdminLevel] >= 10)
{
if(strcmp(Usage, "exterior", true) == 0)
{
Player[playerid][HouseExterior]++;
Player[playerid][hExtID] = GetPlayerInterior(playerid);
GetPlayerPos(playerid, Player[playerid][hExtX], Player[playerid][hExtY], Player[playerid][hExtZ]);
format(string, sizeof(string), "Exterior set! (X: %f, Y: %f, Z: %f).", Player[playerid][hExtX], Player[playerid][hExtY], Player[playerid][hExtZ]);
SendClientMessage(playerid, WHITE, string);
}
if(strcmp(Usage, "interior", true) == 0)
{
Player[playerid][HouseInterior]++;
Player[playerid][hIntID] = GetPlayerInterior(playerid);
GetPlayerPos(playerid, Player[playerid][hIntX], Player[playerid][hIntY], Player[playerid][hIntZ]);
format(string, sizeof(string), "Interior set! (X: %f, Y: %f, Z: %f).", Player[playerid][hIntX], Player[playerid][hIntY], Player[playerid][hIntZ]);
SendClientMessage(playerid, WHITE, string);
}
if(strcmp(Usage, "complete", true) == 0)
{
if(Player[playerid][HouseInterior] > 0 || Player[playerid][HouseExterior] > 0)
{
new NewHouseID = SpawnedHouses+1;
if(NewHouseID >= MAX_HOUSES)
{
SendClientMessage(playerid, WHITE, "Too many houses are currently spawned!");
}
else
{
format(string, sizeof(string), "Houses/House_%d.ini", NewHouseID);
if(!fexist(string))
{
Houses[NewHouseID][hInteriorID] = Player[playerid][hIntID];
Houses[NewHouseID][hExteriorID] = Player[playerid][hExtID];
Houses[NewHouseID][hInteriorX] = Player[playerid][hIntX];
Houses[NewHouseID][hInteriorY] = Player[playerid][hIntY];
Houses[NewHouseID][hInteriorZ] = Player[playerid][hIntZ];
Houses[NewHouseID][hExteriorX] = Player[playerid][hExtX];
Houses[NewHouseID][hExteriorY] = Player[playerid][hExtY];
Houses[NewHouseID][hExteriorZ] = Player[playerid][hExtZ];
format(Houses[NewHouseID][hOwner], 255, " ");
Houses[NewHouseID][LockStatus] = 0;
Houses[NewHouseID][HPickupID] = CreateDynamicPickup(1273, 23, Houses[NewHouseID][hExteriorX], Houses[NewHouseID][hExteriorY], Houses[NewHouseID][hExteriorZ], 0, -1, -1, 150.0);
dini_Create(string);
dini_IntSet(string, "InteriorID", Houses[NewHouseID][hInteriorID]);
dini_FloatSet(string, "InteriorX", Houses[NewHouseID][hInteriorX]);
dini_FloatSet(string, "InteriorY", Houses[NewHouseID][hInteriorY]);
dini_FloatSet(string, "InteriorZ", Houses[NewHouseID][hInteriorZ]);
dini_IntSet(string, "HousePrice", 0);
dini_IntSet(string, "ExteriorID", 0);
dini_FloatSet(string, "ExteriorX", Houses[NewHouseID][hExteriorX]);
dini_FloatSet(string, "ExteriorY", Houses[NewHouseID][hExteriorY]);
dini_FloatSet(string, "ExteriorZ", Houses[NewHouseID][hExteriorZ]);
dini_IntSet(string, "VaultMoney", -1);
dini_IntSet(string, "HouseCocaine", -1);
dini_IntSet(string, "HousePot", -1);
dini_IntSet(string, "HouseMaterials", -1);
dini_Set(string, "Owner", "Nobody");
dini_Set(string, "Name", "");
dini_IntSet(string, "LockStatus", Houses[NewHouseID][LockStatus]);
Player[playerid][HouseExterior]--;
Player[playerid][HouseInterior]--;
SpawnedHouses++;
SendClientMessage(playerid, GREY, "Don't forget to /housename, and change the name.");
SetPlayerInterior(playerid, Houses[NewHouseID][hExteriorID]);
SetPlayerPos(playerid, Houses[NewHouseID][hExteriorX], Houses[NewHouseID][hExteriorY], Houses[NewHouseID][hExteriorZ]);
}
else
{
SendClientMessage(playerid, WHITE, "Error: File already exists!");
}
}
}
else
{
SendClientMessage(playerid, WHITE, "You must select an exterior and an interior first!");
}
}
}
}
return 1;
}
when a rcon admin type it
it should work like this
/create house [Price] [Level] [Interior]
And create a green house icon for buying..and save the house in
Script file/Houses
If you could help please tell me..
I am clueless and helpless too :/