SA-MP Forums Archive
CMD help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: CMD help (/showthread.php?tid=607829)



CMD help - N0FeaR - 24.05.2016

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 
1sizeof(HouseInfo); h++)
            {
                if(
hworld == HouseInfo[h][hInsideWorld])
                {
                    if(
house == HouseInfo[h][hInsideWorld])
                    {
                        new
                        
slotplayergunplayerammo;
                        
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(playeridplayergun);
                            
GetWeaponName(playergungunnamesizeof(gunname));
                            
SendServerMessage(playerid"You have put your %s in slot 1."gunname);
                            
SendNearbyMessage(playerid30.0COLOR_PURPLE"places a weapon in the house vault.");
                            new 
file4[40];
                            
format(file4sizeof(file4), HPATHh);
                            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(playeridplayergun);
                            
GetWeaponName(playergungunnamesizeof(gunname));
                            
SendServerMessage(playerid"You have put your %s in slot 2."gunname);
                            
SendNearbyMessage(playerid30.0COLOR_PURPLE,  "places a weapon in the house vault.");
                            new 
file4[40];
                            
format(file4sizeof(file4), HPATHh);
                            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(playeridplayergun);
                            
GetWeaponName(playergungunnamesizeof(gunname));
                            
SendServerMessage(playerid"You have put your %s in slot 3."gunname);
                            
SendNearbyMessage(playerid30.0COLOR_PURPLE,  "places a weapon in the house vault.");
                            new 
file4[40];
                            
format(file4sizeof(file4), HPATHh);
                            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(playeridplayergun);
                            
GetWeaponName(playergungunnamesizeof(gunname));
                            
SendServerMessage(playerid"You have put your %s in slot 4."gunname);
                            
SendNearbyMessage(playerid30.0COLOR_PURPLE,  "places a weapon in the house vault.");
                            new 
file4[40];
                            
format(file4sizeof(file4), HPATHh);
                            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(playeridplayergun);
                            
GetWeaponName(playergungunnamesizeof(gunname));
                            
SendServerMessage(playerid"You have put your %s in slot 5."gunname);
                            
SendNearbyMessage(playerid30.0COLOR_PURPLE,  "places a weapon in the house vault.");
                            new 
file4[40];
                            
format(file4sizeof(file4), HPATHh);
                            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(playeridplayergun);
                            
GetWeaponName(playergungunnamesizeof(gunname));
                            
SendServerMessage(playerid"You have put your %s in slot 6."gunname);
                            
SendNearbyMessage(playerid30.0COLOR_PURPLE,  "places a weapon in the house vault.");
                            new 
file4[40];
                            
format(file4sizeof(file4), HPATHh);
                            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(playeridplayergun);
                            
GetWeaponName(playergungunnamesizeof(gunname));
                            
SendServerMessage(playerid"You have put your %s in slot 7."gunname);
                            
SendNearbyMessage(playerid30.0COLOR_PURPLE,  "places a weapon in the house vault.");
                            new 
file4[40];
                            
format(file4sizeof(file4), HPATHh);
                            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(playeridplayergun);
                            
GetWeaponName(playergungunnamesizeof(gunname));
                            
SendServerMessage(playerid"You have put your %s in slot 8."gunname);
                            
SendNearbyMessage(playerid30.0COLOR_PURPLE,  "places a weapon in the house vault.");
                            new 
file4[40];
                            
format(file4sizeof(file4), HPATHh);
                            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(playeridplayergun);
                            
GetWeaponName(playergungunnamesizeof(gunname));
                            
SendServerMessage(playerid"You have put your %s in slot 9."gunname);
                            
SendNearbyMessage(playerid30.0COLOR_PURPLE,  "places a weapon in the house vault.");
                            new 
file4[40];
                            
format(file4sizeof(file4), HPATHh);
                            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(playeridplayergun);
                            
GetWeaponName(playergungunnamesizeof(gunname));
                            
SendServerMessage(playerid"You have put your %s in slot 10."gunname);
                            
SendNearbyMessage(playerid30.0COLOR_PURPLE,  "places a weapon in the house vault.");
                            new 
file4[40];
                            
format(file4sizeof(file4), HPATHh);
                            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); 



Re: CMD help - lwilson - 24.05.2016

Maybe you can show us the whole command?


Re: CMD help - DRP - 24.05.2016

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.


Re: CMD help - Dayrion - 24.05.2016

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


Re: CMD help - Stinged - 24.05.2016

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



Re: CMD help - N0FeaR - 24.05.2016

Thanks for the answer, but already fixed it!