28.02.2019, 22:59
Hello, is it possible to turn this into a command? Can you help me? Thank you!
PHP код:
public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
if(GetPVarInt(playerid, "HousePickupCooldown") < gettime())
{
if(InHouse[playerid] == INVALID_HOUSE_ID) {
foreach(new i : Houses)
{
if(pickupid == HouseData[i][HousePickup])
{
SetPVarInt(playerid, "HousePickupCooldown", gettime() + HOUSE_COOLDOWN);
SetPVarInt(playerid, "PickupHouseID", i);
if(!strcmp(HouseData[i][Owner], "-")) {
new string[256];
if(PlayerInfo[playerid][pLevel] < 6) return SCM(playerid, COLOR_GRAD1, ""Text");
format(string, sizeof(string), ""Text", convertNumber(HouseData[i][Price]));
ShowPlayerDialog(playerid, DIALOG_BUY_HOUSE, DIALOG_STYLE_MSGBOX, ""C_DIA"House", string, "Buy", "Close");
}else{
if(HouseData[i][SalePrice] > 0 && strcmp(HouseData[i][Owner], Player_GetName(playerid)))
{
new string[256];
if(PlayerInfo[playerid][pLevel] < 6) return SCM(playerid, COLOR_GRAD1, "Text");
format(string, sizeof(string), "Text", HouseData[i][Owner], convertNumber(HouseData[i][SalePrice]));
ShowPlayerDialog(playerid, DIALOG_BUY_HOUSE_FROM_OWNER, DIALOG_STYLE_MSGBOX, ""C_DIA"House", string, "Buy", "Close");
return 1;
}
switch(HouseData[i][LockMode])
{
case LOCK_MODE_NOLOCK: SendToHouse(playerid, i);
case LOCK_MODE_PASSWORD: ShowPlayerDialog(playerid, DIALOG_HOUSE_PASSWORD, DIALOG_STYLE_INPUT, ""C_DIA"House", "Text", "Done", "Close");
case LOCK_MODE_KEYS:
{
new gotkeys = Iter_Contains(HouseKeys[playerid], i);
if(!gotkeys) if(!strcmp(HouseData[i][Owner], Player_GetName(playerid))) gotkeys = 1;
if(gotkeys) {
SendToHouse(playerid, i);
}else{
SCM(playerid, 0xE74C3CFF, "Text");
}
}
case LOCK_MODE_OWNER:
{
if(!strcmp(HouseData[i][Owner], Player_GetName(playerid))) {
SetPVarInt(playerid, "HousePickupCooldown", gettime() + HOUSE_COOLDOWN);
SendToHouse(playerid, i);
}else{
SCM(playerid, 0xE74C3CFF, "Text");
}
}
}
}
return 1;
}
}
}else{
for(new i; i < sizeof(HouseInteriors); ++i)
{
if(pickupid == HouseInteriors[i][intPickup])
{
SetPVarInt(playerid, "HousePickupCooldown", gettime() + HOUSE_COOLDOWN);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerInterior(playerid, 0);
SetPlayerPos(playerid, HouseData[ InHouse[playerid] ][houseX], HouseData[ InHouse[playerid] ][houseY], HouseData[ InHouse[playerid] ][houseZ]);
InHouse[playerid] = INVALID_HOUSE_ID;
return 1;
}
}
}
}
return 1;
}