SA-MP Forums Archive
equip question - 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: equip question (/showthread.php?tid=349547)



equip question - kepa333 - 09.06.2012

hello i have a question, i have equip script for RP server, and i want to make it u can use it 50 times then u need to refill it with cmd like /refillequip


Код:
	if(strcmp(cmd, "/equip", true) == 0) // By CuervO_NegrO
	{
	    if(IsPlayerConnected(playerid))
	    {
	    	if(PlayerInfo[playerid][pDuty] == 0)
		    {
      			SendClientMessage(playerid,COLOR_GREY,"** You are not On Duty!");
      			return 1;
			}
			if(IsPlayerInRangeOfPoint(playerid, 6, 257.1108,78.0250,1003.6406))//SAPD Lockers
			{
			    if(PlayerInfo[playerid][pMember] != 1 && PlayerInfo[playerid][pLeader] != 1)
			    {
                    SendClientMessage(playerid,COLOR_GREY,"** This Refill Point is Only for the SAPD");
					return 1;
				}
				new sapdequip[] = "1\tCadet Patrol\n2\tOfficer Patrol\n3\tDetective Patrol\n4\tMotorcyclist Patrol\n5\tStandard SWAT\n6\tMedium SWAT\n7\tHeavy SWAT\n8\tSharpshooter SWAT\n9\tArmour+Health\n10\tCeremonial Uniform\n11\tDefault\n12\tHigher Ranked";
	    		ShowPlayerDialog(playerid,50,DIALOG_STYLE_LIST,"List of Equips:",sapdequip,"Select","Cancel");
	    		SendClientMessage(playerid, COLOR_GREY,"* REMEMBER, You may not be able to Select EVERYTHING, Each Item needs it's Specified Rank!");
			}
			else if(IsPlayerInRangeOfPoint(playerid, 6, 223.6328,186.8251,1003.0313))//FBI Lockers (Library)
	        {
	            if(PlayerInfo[playerid][pMember] != 2 && PlayerInfo[playerid][pLeader] != 2)
			    {
                    SendClientMessage(playerid,COLOR_GREY,"** This Refill Point is Only for the FBI");
					return 1;
				}
				new fbiequip[] = "1\tCadet Equipment\n2\tAgent Equipment\n3\tWatching Equipment\n4\tSpy Equipment\n5\tStandard Tactical\n6\tMedium Tactical\n7\tHeavy Tactical\n8\tSharpshooter Tactical\n9\tArmour+Health\n10\tCeremonial Suit\n11\tDefault\n12\tHigher Ranked";
				ShowPlayerDialog(playerid,51,DIALOG_STYLE_LIST,"List of Equips:",fbiequip,"Select","Cancel");
				SendClientMessage(playerid, COLOR_GREY,"* REMEMBER, You may not be able to Select EVERYTHING, Each Item needs it's Specified Rank!");
			}
			else if(IsPlayerInRangeOfPoint(playerid, 6, 233.4989,123.6518,1003.2188))//Army Lockers
	        {
	            if(PlayerInfo[playerid][pMember] != 3 && PlayerInfo[playerid][pLeader] != 3)
			    {
                    SendClientMessage(playerid,COLOR_GREY,"** This Refill Point is Only for the Army");
					return 1;
				}
				new armyequip[] = "1\tPrivate Equipment\n2\tSergeant Equipment\n3\tWatching Equipment\n4\tSpy Equipment\n5\tStandard Special Forces\n6\tMedium Special Forces\n7\tHeavy Special Forces\n8\tSniper Tactical\n9\tArmour+Health\n10\tCeremonial Suit\n11\tDefault\n12\tHigher Ranked";
                ShowPlayerDialog(playerid,52,DIALOG_STYLE_LIST,"List of Equips:",armyequip,"Select","Cancel");
                SendClientMessage(playerid, COLOR_GREY,"* REMEMBER, You may not be able to Select EVERYTHING, Each Item needs it's Specified Rank!");
			}
			new y, m, d;
			new h,mi,s;
			getdate(y,m,d);
			gettime(h,mi,s);
			format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /equip %d",d,m,y,h,mi,s,sendername, strval(tmp));
			CommandLog(string);
			return 1;
		}
	}



Re: equip question - kepa333 - 09.06.2012

any one?


Re: equip question - JhnzRep - 09.06.2012

Under your playerinfo enum put this:
pawn Код:
EquipUses
Then put this under the Dialog Response:
pawn Код:
PlayerInfo[playerid][EquipUses] -= 1;
On refill equip add this:
pawn Код:
PlayerInfo[playerid][EquipUses] = 50;
And lastly under the /equip command add this:
pawn Код:
if(PlayerInfo[playerid][EquipUses] == 0) return SendClientMessage(playerid, -1, "You need to refill your equipment charges.");



Re: equip question - kepa333 - 09.06.2012

ty ill try it


Re: equip question - kepa333 - 12.06.2012

equips is fixed no need any more