Jump to content
  • 0

pomoc Pole pre zbrane


Paulo*

Dotaz

Zdravim,

 

prichadzam sem lebo si neviem uz poradit potrebujem vytvorit urcite pole pre zbrane ktore hrac ma pri sebe nie ktoru zbran ma v ruke.. a potom pouzit to pole v podmienke if(!pole).

Napr pole[] ={14,25,26} no a ak ma hrac neaku z tychto zbrani (jednu ci dve alebo kolko) tak return 0;

 

ja som to skusal uz hociako ale najlepsie mi to vyslo tak asi ze jednu zbran mi to zachytilo xD

 

stock kupene(playerid)
{
new weapdatas[13][2];
for(new i;i<13;i++) GetPlayerWeaponData(playerid,i,weapdatas[i][0],weapdatas[i][1]);
for(new i;i<13;i++)
{
 if(weapdatas[i][1] >= 1)
 {
	 switch(weapdatas[i][0])
	 {
		 case 8,16,18,26,35,36,37,38,39,40: return true;
	 }
}
}
return false;
}

 

no a pouzil som if(!kupene)

ale nic sa nedeje

 

dam vam sem aj naco to potrebujem aby to bolo lahsie

 

new wstring[32];
new INI:file = INI_Open(UserPath(playerid));
INI_SetTag(file,"Data");
for(new s = 0; s < MAX_WEAPONS; s++)
{
 GetPlayerWeaponData(playerid, s, Weapon_Info[playerid][pWeapon][s], Weapon_Info[playerid][pAmmo][s]);

 if(!kupene(playerid))
 {
 for(new w = 0; w < MAX_WEAPONS; w++)
 {
	 format(wstring, sizeof(wstring), "Weapon%d", w);
	 INI_WriteInt(file, wstring, Weapon_Info[playerid][pWeapon][w]);
 }
 for(new a = 0; a < MAX_WEAPONS; a++)
 {
 format(wstring, sizeof(wstring), "Ammo%d", a);
 INI_WriteInt(file, wstring, Weapon_Info[playerid][pAmmo][a]);
 }
 }
}
INI_Close(file);

Link to comment
Share on other sites

7 odpovědí na tuto otázku

Recommended Posts

  • 0

lol,qwer WTF?

 

napisal si uplne neco odveci co sa mna netyka, preco ak sa nerovna 0 wtf?????? ja potrebujem pole pre "zakazane zbrane" ktore potom chcem pouzit v podmienke a ta aby skumala ci ma hrac u seba tie zbrane z pola..teraz chapes?

 

btw "Čo, na ewweho fóre ti nedokázali pomôcť tak píšeš tu?" kdo by mi tam pomohol povedz mi uprimne nikdo .. mozno ewwe ale no nehovorim nic

Link to comment
Share on other sites

  • 0

Preco ty stale narazas na moje vyjadrovanie (facepalm),nevidis tam if(!pole) to ta mohlo napadnut nn?

 

btw neviem preco nefunguje to,kilnem sa so zbranou ktora je v zakazene a stale mi ju zapise do uctu wtf

Link to comment
Share on other sites

  • 0

lol ved tam kod mas neviem co ti stale je ..

 

new wstring[32];
new INI:file = INI_Open(UserPath(playerid));
INI_SetTag(file,"Data");
for(new s = 0; s < MAX_WEAPONS; s++)
{
	 GetPlayerWeaponData(playerid, s, Weapon_Info[playerid][pWeapon][s], Weapon_Info[playerid][pAmmo][s]);

	 if(!IsBadWeapon(Weapon_Info[playerid][pWeapon][s]))
	 {
	 for(new w = 0; w < MAX_WEAPONS; w++)
	 {
			 format(wstring, sizeof(wstring), "Weapon%d", w);
			 INI_WriteInt(file, wstring, Weapon_Info[playerid][pWeapon][w]);
	 }
	 for(new a = 0; a < MAX_WEAPONS; a++)
	 {
	 format(wstring, sizeof(wstring), "Ammo%d", a);
	 INI_WriteInt(file, wstring, Weapon_Info[playerid][pAmmo][a]);
	 }
	 }
}
INI_Close(file);

Link to comment
Share on other sites

  • 0

Nic qwer.. nejde to,ja proste potrebujem ulozit do premennej zbrane ale zaroven tam chcem mat podmienku ci hrac mal neake tie zakazane zbrane napr ako sme riesily,no a spravit to tak aky do tej premennej ulozilo zbrane okrem tych "zakazanych" ktore by boli teda v tej podmienke chapes ma dufam :/

preto som to skusal

 

Getplayerdata(p,s,zbran,ammo) no a if(zbran != id && zbran != dalsie id) ale takto to nejde

 

po spawne chcem potom dat hracovi zbrane z tej premmenej ale uz okrem tych z podmienky zakazanych

Link to comment
Share on other sites

  • 0

not work wtf

 

onplayerdeath

 

for(new s = 0; s < MAX_WEAPONS; s++)
{
 if(BWeapons(Weapon_Info[pAmmo][s]) == 0)
 {
	    GetPlayerWeaponData(playerid, s, Weapon_Info[pWeapon][s], Weapon_Info[pAmmo][s]);
 }
}

 

onplayerspawn

for(new s = 0; s < MAX_WEAPONS; s++)
{
   GetPlayerWeaponData(playerid, s, Weapon_Info[pWeapon][s], Weapon_Info[pAmmo][s]);
   if(BWeapons(Weapon_Info[pAmmo][s]) == 0)
   {
		  ServerWeapon(playerid, Weapon_Info[pWeapon][s], Weapon_Info[pAmmo][s]);
   }
}

 

stock

 

stock BWeapons(weapon)
{
new yes;
switch(weapon)
{
 case 8,16,18,26,35,36,37,38,39,40:
 {
  yes = 1;
 }
}
return yes;
}

Link to comment
Share on other sites

  • 0
new ZakazaneZbrane[] = {14,25,26};
stock kupene(playerid)
{
new weapdatas[13][2];
for(new i;i<sizeof(weapdatas);i++) GetPlayerWeaponData(playerid,i,weapdatas[i][0],weapdatas[i][1]);
for(new i;i<sizeof(weapdatas);i++)
{
 for(new ii;<ii<sizeof(ZakazaneZbrane);ii++)
 {
if(weapdatas[i][0] == ZakazaneZbrane[ii]) return 0;
}
}
return 1;
}

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...