Jump to content
  • 0

pomoc [HELp]Marihuana


Palso

Dotaz

Ahoj, potrebujem poradit ako urobit nieco podobne ako je na RZe s tou marihuanou ... ja nepotrebujem zaidne ze sklidit a pod. potrebujem nieco take ze ked hrač zada nrp. /kupitmarihuanu tak mu to za dajmetomu 500$ kupi 5g marihuany. a potom ked da /prodatmarihuanu [iD] [Gramy] tak to preda danemu hracovi a ze ked nebdue mat tolko gramov tak napise Nemas dostatok marihuany ... prosim pomozte ja fakt neviem kao nato :d :D Za kazdu pomoc dakujem :boss::rofl:

Link to comment
Share on other sites

10 odpovědí na tuto otázku

Recommended Posts

  • 0

niekde hore ku include

 

new marihuana[MAXPLAYERS];

 

public OnPlayerCommandText(playerid, cmdtext[])

{

dcmd(prodatmarihuanu,20,cmdtext);

return 1;

}

niekde za publici najlepšie ked už máš nejaké aby si to dal k nim :)

////////////////////////////////////////////////////////////////////////////////

dcmd_prodatmarihuanu(playerid, params[])

{

new ID,GRAMY,CENA;

if(sscanf(params, "iii", ID,GRAMY))

return SendClientMessage(playerid,COLOR_WHITE,"[ ! ] /prodatmarihuanu [iD] [GRAMY] [CENA]");

new id=strval(params);

if(!IsPlayerConnected(id))

return SendClientMessage(playerid,COLOR_WHITE,"[ ! ] Tento hráč nie je na servery");

if(marihuana[playerid] > GRAMY)

{

marihuana[id] +GRAMY;

GivePlayerMoney(playerid, CENA);

GivePlayerMoney(id, -CENA);

 

new hrac1[MAX_PLAYER_NAME];

new hrac2[MAX_PLAYER_NAME];

new sprava[128];

 

GetPlayerName(playerid,hrac1,MAX_PLAYER_NAME);

GetPlayerName(id,hmeno1,MAX_PLAYER_NAME);

format(sprava, sizeof(sprava), "Hráč %s predal hráčovy %s marihuanu za %s", hrac1, hrac2,CENA);

SendClientMessageToAll( TU_DAJ_FARBU , sprava1);

}

else

{

SendClientMessage(playerid,COLOR_RED,"[ ! ] Nemáš toľko marihuany");

}

return 1;

}

////////////////////////////////////////////////////////////////////////////////

neviem či to je dobre pisal som to teraz :)

Su tam iste chyby tak nech ti to opravia :d :D pisal som to nakolene

Link to comment
Share on other sites

  • 0

NEviem co s tym :d

warning 217: loose indentation
C:\Users\Doma\Desktop\test.pwn(107) : error 017: undefined symbol "sscanf"
C:\Users\Doma\Desktop\test.pwn(114) : warning 215: expression has no effect
C:\Users\Doma\Desktop\test.pwn(123) : error 017: undefined symbol "hmeno1"
C:\Users\Doma\Desktop\test.pwn(125) : error 017: undefined symbol "sprava1"
C:\Users\Doma\Desktop\test.pwn(106) : warning 203: symbol is never used: "ID"
C:\Users\Doma\Desktop\test.pwn(106 -- 133) : error 010: invalid function or declaration

Link to comment
Share on other sites

  • 0

 

1. if(sscanf(params, "iii", ID,GRAMY,CENA))

2. marihuana[id] +GRAMY;

3. GetPlayerName(id,hmeno1,MAX_PLAYER_NAME);

4. SendClientMessageToAll( COLOR_GREEN, sprava1);

5. new ID,GRAMY,CENA;

:hallo:

Link to comment
Share on other sites

  • 0

Tady ti posilam zdrojak z RZE74 (v puvodnim stavu), dneska uz takhle hrozne nekodim :D

dcmd_prodatmarihuanu(playerid,params[])
{
	if(IsPlayerConnected(playerid))
	{
	    if(strlen(params) > 10) return SendClientMessage(playerid,BARVA_BILA,"[ ! ] Chybně zadaný příkaz !");
 		new pos;
		new id = strval(params);
		if(!params[0] || !(pos = chrfind(' ',params) + 1) || !params[pos]) return SendClientMessage(playerid,BARVA_BILA,"[ ! ] Použití: /prodatmarihuanu [ ID ] [ GRAMY ]");
		else if(!IsPlayerConnected(id)) return SendClientMessage(playerid,BARVA_BILA,"[ ! ] Hráč není připojený");
		else if(Trava[playerid] == 0) return SendClientMessage(playerid,BARVA_BILA,"[ ! ] Nemáte u sebe žádnou trávu !");
		new Travicka = strval(params[pos]);
		if(Travicka < 1 || Trava[playerid] < Travicka) SendClientMessage(playerid,BARVA_BILA,"[ ! ] Chybně zadané gramy !");
		else if(DistanceBTWPlayers(playerid,id) > 7) return SendClientMessage(playerid,BARVA_BILA,"[ ! ] Hráč je mimo dosah");
		else
		{
  			new string[150];
			format(string,sizeof(string),"Dealer %s prodal %dg marihuany hráči %s",Jmeno(playerid),Travicka,Jmeno(id));
			SendClientMessageToAll(BARVA_MODRA,string);
			Trava[playerid] = Trava[playerid] - Travicka;
			Trava[id] = Trava[id] + Travicka;
		}
	}
	return 1;
}

 

Link to comment
Share on other sites

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