CMD Help
#1

I have this command, there are no errors within the PAWN... But within game it just says 'You have sold house: 0'

Код:
CMD:asellallhouses(playerid, params[])
{
	if (PlayerInfo[playerid][pAdmin] >= 4)
	{
		new playername[MAX_PLAYER_NAME];
		GetPlayerName(playerid, playername, sizeof(playername));

		new string[128];
		new house;
		for (new i= 0; i != MAX_HOUSES; i++)
		{
		house = i;
		HouseInfo[house][hLock] = 1;
		new ip[32];
		GetPlayerIp(playerid,ip,sizeof(ip));
		format(string,sizeof(string),"Administrator %s (IP: %s) has admin-sold house ID %d (was owned by %s).",GetPlayerNameEx(playerid),ip,house,HouseInfo[house][hOwner]);
		Log("logs/house.log", string);
		ClearHouse(house);
		format( HouseInfo[house][hOwner], 128, "Nobody" );
		HouseInfo[house][hGLUpgrade] = 1;
		PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
		format(string, sizeof(string), "~w~You have sold house %d.", house);
		GameTextForPlayer(playerid, string, 10000, 3);
		SaveHouses();
		DestroyDynamicPickup(HouseInfo[house][hPickupID]);
		HouseInfo[house][hPickupID] = CreateDynamicPickup(1273, 23, HouseInfo[house][hExteriorX], HouseInfo[house][hExteriorY], HouseInfo[house][hExteriorZ]);
		DestroyDynamic3DTextLabel(HouseInfo[house][hTextID]);
		format(string, sizeof(string), "This home is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\n/buyhouse to buy it.",HouseInfo[house][hDescription],HouseInfo[house][hValue],HouseInfo[house][hLevel]);
		HouseInfo[house][hTextID] = CreateDynamic3DTextLabel( string, COLOR_GREEN, HouseInfo[house][hExteriorX], HouseInfo[house][hExteriorY], HouseInfo[house][hExteriorZ]+0.5,30.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1,  -1, 30.0);
		return 1;
		}
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GREY, "You are not authorized to use that command!");
	}
	return 1;
}
I want it to sell all the houses within the game
Reply
#2

Try this
PHP код:
CMD:asellallhouses(playeridparams[])
{
    if (
PlayerInfo[playerid][pAdmin] >= 4)
    {
        new 
playername[MAX_PLAYER_NAME];
        
GetPlayerName(playeridplayernamesizeof(playername));
        new 
string[128];
        for (new 
i0!= MAX_HOUSESi++)
        {
        
HouseInfo[house][hLock] = 1;
        new 
ip[32];
        
GetPlayerIp(playerid,ip,sizeof(ip));
        
format(string,sizeof(string),"Administrator %s (IP: %s) has admin-sold house ID %d (was owned by %s).",GetPlayerNameEx(playerid),ip,house,HouseInfo[house][hOwner]);
        
Log("logs/house.log"string);
        
ClearHouse(house);
        
formatHouseInfo[house][hOwner], 128"Nobody" );
        
HouseInfo[house][hGLUpgrade] = 1;
        
PlayerPlaySound(playerid10520.00.00.0);
        
format(stringsizeof(string), "~w~You have sold house %d."i);
        
GameTextForPlayer(playeridstring100003);
        
SaveHouses();
        
DestroyDynamicPickup(HouseInfo[house][hPickupID]);
        
HouseInfo[house][hPickupID] = CreateDynamicPickup(127323HouseInfo[house][hExteriorX], HouseInfo[house][hExteriorY], HouseInfo[house][hExteriorZ]);
        
DestroyDynamic3DTextLabel(HouseInfo[house][hTextID]);
        
format(stringsizeof(string), "This home is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\n/buyhouse to buy it.",HouseInfo[house][hDescription],HouseInfo[house][hValue],HouseInfo[house][hLevel]);
        
HouseInfo[house][hTextID] = CreateDynamic3DTextLabelstringCOLOR_GREENHouseInfo[house][hExteriorX], HouseInfo[house][hExteriorY], HouseInfo[house][hExteriorZ]+0.5,30.0INVALID_PLAYER_IDINVALID_VEHICLE_ID0, -1, -1,  -130.0);
        return 
1;
        }
    }
    else
    {
        
SendClientMessageEx(playeridCOLOR_GREY"You are not authorized to use that command!");
    }
    return 
1;

Reply
#3

try now

PHP код:
CMD:asellallhouses(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] >= 4)
    {
        new 
playername[MAX_PLAYER_NAME];
        
GetPlayerName(playeridplayernamesizeof(playername));
        new 
string[128];
        for(new 
0MAX_HOUSESi++)
        {
            
HouseInfo[i][hLock] = 1;
            new 
ip[32];
            
GetPlayerIp(playerid,ip,sizeof(ip));
            
format(string,sizeof(string),"Administrator %s (IP: %s) has admin-sold house ID %d (was owned by %s).",GetPlayerNameEx(playerid),ip,i,HouseInfo[i][hOwner]);
            
Log("logs/house.log"string);
            
ClearHouse(i);
            
formatHouseInfo[i][hOwner], 128"Nobody" );
            
HouseInfo[i][hGLUpgrade] = 1;
            
PlayerPlaySound(playerid10520.00.00.0);
            
format(stringsizeof(string), "~w~You have sold house %d."i);
            
GameTextForPlayer(playeridstring100003);
            
SaveHouses();
            
DestroyDynamicPickup(HouseInfo[i][hPickupID]);
            
HouseInfo[i][hPickupID] = CreateDynamicPickup(127323HouseInfo[i][hExteriorX], HouseInfo[i][hExteriorY], HouseInfo[i][hExteriorZ]);
            
DestroyDynamic3DTextLabel(HouseInfo[i][hTextID]);
            
format(stringsizeof(string), "This home is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\n/buyhouse to buy it.",HouseInfo[i][hDescription],HouseInfo[i][hValue],HouseInfo[i][hLevel]);
            
HouseInfo[i][hTextID] = CreateDynamic3DTextLabelstringCOLOR_GREENHouseInfo[i][hExteriorX], HouseInfo[i][hExteriorY], HouseInfo[i][hExteriorZ]+0.5,30.0INVALID_PLAYER_IDINVALID_VEHICLE_ID0, -1, -1,  -130.0);
        }
    }
    else 
SendClientMessageEx(playeridCOLOR_GREY"You are not authorized to use that command!");
    return 
1;

Reply
#4

It is saying 'undefined symbol: 'house'... so I put in :
Код:
new house;
and it does the same thing, just sell house id 0...
Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
Try this
PHP код:
CMD:asellallhouses(playeridparams[])
{
    if (
PlayerInfo[playerid][pAdmin] >= 4)
    {
        new 
playername[MAX_PLAYER_NAME];
        
GetPlayerName(playeridplayernamesizeof(playername));
        new 
string[128];
        for (new 
i0!= MAX_HOUSESi++)
        {
        
HouseInfo[house][hLock] = 1;
        new 
ip[32];
        
GetPlayerIp(playerid,ip,sizeof(ip));
        
format(string,sizeof(string),"Administrator %s (IP: %s) has admin-sold house ID %d (was owned by %s).",GetPlayerNameEx(playerid),ip,house,HouseInfo[house][hOwner]);
        
Log("logs/house.log"string);
        
ClearHouse(house);
        
formatHouseInfo[house][hOwner], 128"Nobody" );
        
HouseInfo[house][hGLUpgrade] = 1;
        
PlayerPlaySound(playerid10520.00.00.0);
        
format(stringsizeof(string), "~w~You have sold house %d."i);
        
GameTextForPlayer(playeridstring100003);
        
SaveHouses();
        
DestroyDynamicPickup(HouseInfo[house][hPickupID]);
        
HouseInfo[house][hPickupID] = CreateDynamicPickup(127323HouseInfo[house][hExteriorX], HouseInfo[house][hExteriorY], HouseInfo[house][hExteriorZ]);
        
DestroyDynamic3DTextLabel(HouseInfo[house][hTextID]);
        
format(stringsizeof(string), "This home is\n for sale!\n Description: %s\nCost: $%d\n Level: %d\n/buyhouse to buy it.",HouseInfo[house][hDescription],HouseInfo[house][hValue],HouseInfo[house][hLevel]);
        
HouseInfo[house][hTextID] = CreateDynamic3DTextLabelstringCOLOR_GREENHouseInfo[house][hExteriorX], HouseInfo[house][hExteriorY], HouseInfo[house][hExteriorZ]+0.5,30.0INVALID_PLAYER_IDINVALID_VEHICLE_ID0, -1, -1,  -130.0);
        return 
1;
        }
    }
    else
    {
        
SendClientMessageEx(playeridCOLOR_GREY"You are not authorized to use that command!");
    }
    return 
1;

Reply
#5

Quote:
Originally Posted by JKent
Посмотреть сообщение
It is saying 'undefined symbol: 'house'... so I put in :
Код:
new house;
and it does the same thing, just sell house id 0...
maybe... just... you know, maybe. that's why?



why are you even creating a new variable I (assuming standing for index) just to then, give another variable house its value? makes no sense to me.


do you even yourself make any logic out of your code or are you just copying and pasting shit around, defining new variables without understanding the logic in it?
Reply
#6

Maybe the "return 1;" inside the "for" loop is causing problem. Because "return 1;" will end the "for" loop. Try removing it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)