global asellhouse command -
rekatluos - 15.08.2011
Ok so ive got a property.cfg from an older gamemode and i wanna get rid of all the owners ,the easiest way so far is to use /asellhouse so i was wondering if anyone can help me make a /asellhouse GLOBAL command ,so i wont have to put /asellhouse HOUSEID ,just to make all of them available for sell again .
if any idea,here is the actual asellhouse command
pawn Код:
if(strcmp(cmd, "/asellhouse", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, playername, sizeof(playername));
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /asellhouse [houseid]");
return 1;
}
new house = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 4)
{
HouseInfo[house][hHel] = 0;
HouseInfo[house][hArm] = 0;
HouseInfo[house][hHealthx] = 0;
HouseInfo[house][hHealthy] = 0;
HouseInfo[house][hHealthz] = 0;
HouseInfo[house][hArmourx] = 0;
HouseInfo[house][hArmoury] = 0;
HouseInfo[house][hArmourz] = 0;
HouseInfo[house][hLock] = 1;
HouseInfo[house][hOwned] = 0;
HouseInfo[house][hVec] = 418;
HouseInfo[house][hVcol1] = -1;
HouseInfo[house][hVcol2] = -1;
strmid(HouseInfo[house][hOwner], "The State", 0, strlen("The State"), 255);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~You have sold this property", HouseInfo[house][hValue]);
GameTextForPlayer(playerid, string, 10000, 3);
OnPropUpdate();
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You are not an admin.");
}
}
return 1;
}
the GM is a GF edit ,the reason im using this property cfg is cause i know it works with my gm ,if you know any other one that works perfectly you can gimme link (no owners ) ,cause i dont rly know if they are all just the same ...
Re: global asellhouse command -
rekatluos - 16.08.2011
sry but i gotta bump this,still no-one? ;\
Re: global asellhouse command -
=WoR=Varth - 17.08.2011
Do loop.
EDIT:
https://sampwiki.blast.hk/wiki/Loops
Re: global asellhouse command -
rekatluos - 17.08.2011
i never did so i have no idea how to,can you help ?
Re: global asellhouse command -
KingTurtle - 17.08.2011
I place some random MAX_HOUSES for the loop
Try this. I am honestly not sure if it works [ Make a backup of the files where the houses are in case it fails ]
On top of your script
pawn Код:
#define MAX_HOUSES [put your max houses here]
At the command
pawn Код:
if(PlayerInfo[playerid][pAdmin] >= 4)
{
for(new h; h < MAX_HOUSES; h++)
{
HouseInfo[h][hHel] = 0;
HouseInfo[h][hArm] = 0;
HouseInfo[h][hHealthx] = 0;
HouseInfo[h][hHealthy] = 0;
HouseInfo[h][hHealthz] = 0;
HouseInfo[h][hArmourx] = 0;
HouseInfo[h][hArmoury] = 0;
HouseInfo[h][hArmourz] = 0;
HouseInfo[h][hLock] = 1;
HouseInfo[h][hOwned] = 0;
HouseInfo[h][hVec] = 418;
HouseInfo[h][hVcol1] = -1;
HouseInfo[h][hVcol2] = -1;
strmid(HouseInfo[h][hOwner], "The State", 0, strlen("The State"), 255);
format(string, sizeof(string), "~w~You have sold all properties", HouseInfo[h][hValue]);
GameTextForPlayer(playerid, string, 10000, 3);
}
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
OnPropUpdate();
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You are not an admin.");
}
Re: global asellhouse command -
ElieJabbour - 17.08.2011
pawn Код:
#define SCRIPT_MAXHOUSES [Number of the Houses ya want]
pawn Код:
if(strcmp(cmd, "/asellhouse", true) == 0)
{
if(IsPlayerConnected(playerid))
{
GetPlayerName(playerid, playername, sizeof(playername));
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /asellhouse [houseid]");
return 1;
}
new house = strval(tmp);
if (PlayerInfo[playerid][pAdmin] >= 4)
{
HouseInfo[house][hHel] = 0;
HouseInfo[house][hArm] = 0;
HouseInfo[house][hHealthx] = 0;
HouseInfo[house][hHealthy] = 0;
HouseInfo[house][hHealthz] = 0;
HouseInfo[house][hArmourx] = 0;
HouseInfo[house][hArmoury] = 0;
HouseInfo[house][hArmourz] = 0;
HouseInfo[house][hLock] = 1;
HouseInfo[house][hOwned] = 0;
HouseInfo[house][hVec] = 418;
HouseInfo[house][hVcol1] = -1;
HouseInfo[house][hVcol2] = -1;
SafeInfo[house][sDrugs] = 0;
SafeInfo[house][sMats] = 0;
SafeInfo[house][sGun][0] = 0;
SafeInfo[house][sGun][1] = 0;
SafeInfo[house][sGun][2] = 0;
SafeInfo[house][sGun][3] = 0;
SafeInfo[house][sAmmo][0] = 0;
SafeInfo[house][sAmmo][1] = 0;
SafeInfo[house][sAmmo][2] = 0;
SafeInfo[house][sAmmo][3] = 0;
strmid(HouseInfo[house][hOwner], "The State", 0, strlen("The State"), 255);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
format(string, sizeof(string), "~w~You have sold this property", HouseInfo[house][hValue]);
GameTextForPlayer(playerid, string, 10000, 3);
DestroyPickup(HouseInfo[house][hPickupID]);
HouseInfo[house][hPickupID]=CreatePickup(1273, 1, HouseInfo[house][hEntrancex], HouseInfo[house][hEntrancey], HouseInfo[house][hEntrancez]);
OnPropUpdate();
SaveSafe();
return 1;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "You're not an Admin.");
}
}
return 1;
}