CMD help
#1

When i type the cmd nothing happends maybe u guys can help me out.


PHP код:
else if(strcmp(choose, "putgun", true) == 0)
        {
            new 
hworld = GetPlayerVirtualWorld(playerid);
            new 
house = PlayerInfo[playerid][HouseID];
            if(
house == 0) return SendErrorMessage(playerid, "You don't own any house.");
            for(new 
h = 1; h < sizeof(HouseInfo); h++)
            {
                if(
hworld == HouseInfo[h][hInsideWorld])
                {
                    if(
house == HouseInfo[h][hInsideWorld])
                    {
                        new
                        
slot, playergun, playerammo;
                        
playergun = GetPlayerWeapon(playerid);
                        
playerammo = GetPlayerAmmo(playerid);
                        if(
playergun < 1) return SendErrorMessage(playerid, "You do not have a weapon.");
                        if(
playerammo < 1) return SendErrorMessage(playerid, "You do not have any ammo.");
                        if(
sscanf(params,"d", slot)) return SendSyntaxMessage(playerid, "Usage: /putgun [slot].");
                        if(
slot == 1)
                        {
                            if(
HouseInfo[h][hWeapon1] != 0) return SendErrorMessage(playerid, "There is already a weapon in this slot.");
                            
HouseInfo[h][hWeapon1] = playergun;
                            
HouseInfo[h][hAmmo1] += playerammo;
                            
RemovePlayerWeapon(playerid, playergun);
                            
GetWeaponName(playergun, gunname, sizeof(gunname));
                            
SendServerMessage(playerid, "You have put your %s in slot 1.", gunname);
                            
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "places a weapon in the house vault.");
                            new 
file4[40];
                            
format(file4, sizeof(file4), HPATH, h);
                            new 
INI:File = INI_Open(file4);
                            
INI_SetTag(File,"data");
                            
INI_WriteInt(File,"hWeapon1", HouseInfo[h][hWeapon1]);
                            
INI_WriteInt(File,"hAmmo1", HouseInfo[h][hAmmo1]);
                            
INI_Close(File);
                            return 
1;
                        }
                        else if(
slot == 2)
                        {
                            if(
HouseInfo[h][hWeapon2] != 0) return SendErrorMessage(playerid, "There is already a weapon in this slot.");
                            
HouseInfo[h][hWeapon2] = playergun;
                            
HouseInfo[h][hAmmo2] += playerammo;
                            
RemovePlayerWeapon(playerid, playergun);
                            
GetWeaponName(playergun, gunname, sizeof(gunname));
                            
SendServerMessage(playerid, "You have put your %s in slot 2.", gunname);
                            
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE,  "places a weapon in the house vault.");
                            new 
file4[40];
                            
format(file4, sizeof(file4), HPATH, h);
                            new 
INI:File = INI_Open(file4);
                            
INI_SetTag(File,"data");
                            
INI_WriteInt(File,"hWeapon2", HouseInfo[h][hWeapon2]);
                            
INI_WriteInt(File,"hAmmo2", HouseInfo[h][hAmmo2]);
                            
INI_Close(File);
                            return 
1;
                        }
                        else if(
slot == 3)
                        {
                            if(
HouseInfo[h][hWeapon3] != 0) return SendErrorMessage(playerid, "There is already a weapon in this slot.");
                            
HouseInfo[h][hWeapon3] = playergun;
                            
HouseInfo[h][hAmmo3] += playerammo;
                            
RemovePlayerWeapon(playerid, playergun);
                            
GetWeaponName(playergun, gunname, sizeof(gunname));
                            
SendServerMessage(playerid, "You have put your %s in slot 3.", gunname);
                            
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE,  "places a weapon in the house vault.");
                            new 
file4[40];
                            
format(file4, sizeof(file4), HPATH, h);
                            new 
INI:File = INI_Open(file4);
                            
INI_SetTag(File,"data");
                            
INI_WriteInt(File,"hWeapon3", HouseInfo[h][hWeapon3]);
                            
INI_WriteInt(File,"hAmmo3", HouseInfo[h][hAmmo3]);
                            
INI_Close(File);
                            return 
1;
                        }
                        else if(
slot == 4)
                        {
                            if(
HouseInfo[h][hWeapon4] != 0) return SendErrorMessage(playerid, "There is already a weapon in this slot.");
                            
HouseInfo[h][hWeapon4] = playergun;
                            
HouseInfo[h][hAmmo4] += playerammo;
                            
RemovePlayerWeapon(playerid, playergun);
                            
GetWeaponName(playergun, gunname, sizeof(gunname));
                            
SendServerMessage(playerid, "You have put your %s in slot 4.", gunname);
                            
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE,  "places a weapon in the house vault.");
                            new 
file4[40];
                            
format(file4, sizeof(file4), HPATH, h);
                            new 
INI:File = INI_Open(file4);
                            
INI_SetTag(File,"data");
                            
INI_WriteInt(File,"hWeapon4", HouseInfo[h][hWeapon4]);
                            
INI_WriteInt(File,"hAmmo4", HouseInfo[h][hAmmo4]);
                            
INI_Close(File);
                            return 
1;
                        }
                        if(
slot == 5)
                        {
                            if(
HouseInfo[h][hWeapon5] != 0) return SendErrorMessage(playerid, "There is already a weapon in this slot.");
                            
HouseInfo[h][hWeapon5] = playergun;
                            
HouseInfo[h][hAmmo5] += playerammo;
                            
RemovePlayerWeapon(playerid, playergun);
                            
GetWeaponName(playergun, gunname, sizeof(gunname));
                            
SendServerMessage(playerid, "You have put your %s in slot 5.", gunname);
                            
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE,  "places a weapon in the house vault.");
                            new 
file4[40];
                            
format(file4, sizeof(file4), HPATH, h);
                            new 
INI:File = INI_Open(file4);
                            
INI_SetTag(File,"data");
                            
INI_WriteInt(File,"hWeapon5", HouseInfo[h][hWeapon5]);
                            
INI_WriteInt(File,"hAmmo5", HouseInfo[h][hAmmo5]);
                            
INI_Close(File);
                            return 
1;
                        }
                        else if(
slot == 6)
                        {
                            if(
HouseInfo[h][hWeapon6] != 0) return SendErrorMessage(playerid, "There is already a weapon in this slot.");
                            
HouseInfo[h][hWeapon6] = playergun;
                            
HouseInfo[h][hAmmo6] += playerammo;
                            
RemovePlayerWeapon(playerid, playergun);
                            
GetWeaponName(playergun, gunname, sizeof(gunname));
                            
SendServerMessage(playerid, "You have put your %s in slot 6.", gunname);
                            
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE,  "places a weapon in the house vault.");
                            new 
file4[40];
                            
format(file4, sizeof(file4), HPATH, h);
                            new 
INI:File = INI_Open(file4);
                            
INI_SetTag(File,"data");
                            
INI_WriteInt(File,"hWeapon6", HouseInfo[h][hWeapon6]);
                            
INI_WriteInt(File,"hAmmo6", HouseInfo[h][hAmmo6]);
                            
INI_Close(File);
                            return 
1;
                        }
                        else if(
slot == 7)
                        {
                            if(
HouseInfo[h][hWeapon7] != 0) return SendErrorMessage(playerid, "There is already a weapon in this slot.");
                            
HouseInfo[h][hWeapon7] = playergun;
                            
HouseInfo[h][hAmmo7] += playerammo;
                            
RemovePlayerWeapon(playerid, playergun);
                            
GetWeaponName(playergun, gunname, sizeof(gunname));
                            
SendServerMessage(playerid, "You have put your %s in slot 7.", gunname);
                            
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE,  "places a weapon in the house vault.");
                            new 
file4[40];
                            
format(file4, sizeof(file4), HPATH, h);
                            new 
INI:File = INI_Open(file4);
                            
INI_SetTag(File,"data");
                            
INI_WriteInt(File,"hWeapon7", HouseInfo[h][hWeapon7]);
                            
INI_WriteInt(File,"hAmmo7", HouseInfo[h][hAmmo7]);
                            
INI_Close(File);
                            return 
1;
                        }
                        else if(
slot == 8)
                        {
                            if(
HouseInfo[h][hWeapon8] != 0) return SendErrorMessage(playerid, "There is already a weapon in this slot.");
                            
HouseInfo[h][hWeapon8] = playergun;
                            
HouseInfo[h][hAmmo8] += playerammo;
                            
RemovePlayerWeapon(playerid, playergun);
                            
GetWeaponName(playergun, gunname, sizeof(gunname));
                            
SendServerMessage(playerid, "You have put your %s in slot 8.", gunname);
                            
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE,  "places a weapon in the house vault.");
                            new 
file4[40];
                            
format(file4, sizeof(file4), HPATH, h);
                            new 
INI:File = INI_Open(file4);
                            
INI_SetTag(File,"data");
                            
INI_WriteInt(File,"hWeapon4", HouseInfo[h][hWeapon4]);
                            
INI_WriteInt(File,"hAmmo4", HouseInfo[h][hAmmo4]);
                            
INI_Close(File);
                            return 
1;
                        }
                        else if(
slot == 9)
                        {
                            if(
HouseInfo[h][hWeapon9] != 0) return SendErrorMessage(playerid, "There is already a weapon in this slot.");
                            
HouseInfo[h][hWeapon9] = playergun;
                            
HouseInfo[h][hAmmo9] += playerammo;
                            
RemovePlayerWeapon(playerid, playergun);
                            
GetWeaponName(playergun, gunname, sizeof(gunname));
                            
SendServerMessage(playerid, "You have put your %s in slot 9.", gunname);
                            
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE,  "places a weapon in the house vault.");
                            new 
file4[40];
                            
format(file4, sizeof(file4), HPATH, h);
                            new 
INI:File = INI_Open(file4);
                            
INI_SetTag(File,"data");
                            
INI_WriteInt(File,"hWeapon9", HouseInfo[h][hWeapon9]);
                            
INI_WriteInt(File,"hAmmo9", HouseInfo[h][hAmmo9]);
                            
INI_Close(File);
                            return 
1;
                        }
                        else if(
slot == 10)
                        {
                            if(
HouseInfo[h][hWeapon10] != 0) return SendErrorMessage(playerid, "There is already a weapon in this slot.");
                            
HouseInfo[h][hWeapon10] = playergun;
                            
HouseInfo[h][hAmmo10] += playerammo;
                            
RemovePlayerWeapon(playerid, playergun);
                            
GetWeaponName(playergun, gunname, sizeof(gunname));
                            
SendServerMessage(playerid, "You have put your %s in slot 10.", gunname);
                            
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE,  "places a weapon in the house vault.");
                            new 
file4[40];
                            
format(file4, sizeof(file4), HPATH, h);
                            new 
INI:File = INI_Open(file4);
                            
INI_SetTag(File,"data");
                            
INI_WriteInt(File,"hWeapon10", HouseInfo[h][hWeapon10]);
                            
INI_WriteInt(File,"hAmmo10", HouseInfo[h][hAmmo10]);
                            
INI_Close(File); 
Reply
#2

Maybe you can show us the whole command?
Reply
#3

I have a similar code but mine works, this is a bit of it, if it helps


Код:
			else if(strcmp(weaponchoice, "tec9", true, strlen(weaponchoice)) == 0)
			{
				if( PlayerInfo[playerid][pGuns][4] == 32 && PlayerInfo[playerid][pAGuns][4] == 0 )
				{
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, "You have deposited a tec9 in your gun locker.");
					weapon = PlayerInfo[playerid][pGuns][4];
					ammo = PlayerInfo[playerid][pGunAmmo][4];
					format(string,sizeof(string), "* %s deposited their tec9 in their house safe.", GetPlayerNameEx(playerid));
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					SetPVarInt(playerid, "GiveWeaponTimer", 10); SetTimerEx("OtherTimerEx", 1000, false, "ii", playerid, TYPE_GIVEWEAPONTIMER);
				}
			}
			if(weapon == 0) return SendClientMessageEx(playerid, COLOR_GREY, "You don't have that weapon.");
			if(HouseInfo[PlayerInfo[playerid][pPhousekey]][hWeapons][slot-1] == 0)
			{
				HouseInfo[PlayerInfo[playerid][pPhousekey]][hWeapons][slot-1] = weapon;
				HouseInfo[PlayerInfo[playerid][pPhousekey]][hWepAmmo][slot-1] = ammo;
				RemovePlayerWeapon(playerid, weapon);
				SaveHouses();
				return 1;
			}
Basically stores the weapon within the houses, makes a weapon slot within the house saving system.
Reply
#4

Did you try to put some print to see where is the problem?
Reply
#5

Код:
if(house == HouseInfo[h][hInsideWorld])
Isn't it supposed to be:
Код:
if(house == HouseInfo[h][HouseID])
Reply
#6

Thanks for the answer, but already fixed it!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)