Jump to content
  • 0

Adaugare 'count' la comanda /areagun


Rayan

Question

Problema intalnita (descriere): Salut, am incercat sa pun 'count' comenzi /areagun (sa arate cati jucatori au primit arme), insa nu mi-a iesit, imi scrie de atatea ori pe chat-ul adminilor, cati jucatori au primit arme, nu stiu daca intelegeti. V-am lasat pozele mai jos
Ero(area / rile) / warning-(ul / urile): Niciuna.
Liniile de cod / sursa / script-ul(obligatoriu):  Comanda principala:

http://pastebin.com/87XKuf2L
Imagini / Video (optional): http://imgur.com/a/LGReP
Ati incercat sa rezolvati singur?: Da, insa cum am spus mai sus, mesajul care se trimite pe chat-ul adminilor, apare de atatea ori, cati jucatori primesc arme

Uitati ce am incercat eu , vreau doar ca mesajul care se trimite adminilor, sa arate cati jucatori au primit arme (count) - %d players

http://pastebin.com/er3m4fbX

 

Ps: Am testat comenzile ce mi le-ati dat aici https://www.sa-mp.ro/forums/topic/24771-problema-count-la-comanda-areagun/ - insa nu merg, la cea a lui @Alberto. imi scrie '-1 players' si la acea a lui @WiDuAlK imi apare la fel '0 players'.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

pune 'count++' sub linia ' GivePlayerWeaponEx(i, gun, ammo); '

unde ai tu count-ul actual,ai linia ' if(GetPlayerState(i) == PLAYER_STATE_PASSENGER) ' careface verificarea daca player-ul este intr-un vehicul ca pasager. Asta ar fii problema pentru care nu ar creste, altfel nu imi pot da seama de ce nu merge, bafta.

Edit: la mine iti daduse -1, deoarece ti-am pus ' count-1 ' ca sa te excluda pe tine, dar nu a crescut.

Edited by Alberto.
Link to comment
Share on other sites

  • 0
CMD:areagun(playerid, params[]) // adaugat 'count'
{
    if(gPlayerLogged[playerid] == 0) 				return SendClientMessage(playerid, COLOR_RED2, "Nu poti folosi nicio comanda pentru ca nu esti logat.");
    if(PlayerInfo[playerid][pAdmin] < 2) 			return SendClientMessage(playerid, COLOR_ERROR, "You are not authorized to use this command.");
	new range,gun,ammo,string[256],sendername[25],wcount=0;
	if(sscanf(params, "iii", range, gun, ammo)) 	return SendClientMessage(playerid,COLOR_WHITE,"Usage: /areagun [range] [weapon id] [ammo]");

	GetPlayerName(playerid, sendername, sizeof(sendername));
	if(gun < 1||gun > 46||gun==19||gun==20||gun==21||gun==45) 	return SendClientMessage(playerid,COLOR_WHITE,"Invalid weapond ID.");
	if(ammo <1||ammo > 1000) 									return SendClientMessage(playerid,COLOR_WHITE,"Invalid ammo (1-1000).");

	foreach(Player,i)
	{
		if(ProxDetectorS(range, playerid, i))
		{
		    wcount++;
			GivePlayerWeaponEx(i, gun, ammo);
			new gun2,tmp;
			GetPlayerWeaponData(i,5,gun2,tmp);
			#pragma unused tmp
			if(gun2)SetPlayerArmedWeapon(i,gun2);
			else SetPlayerArmedWeapon(i,0);
		}
	}
	format(string, sizeof(string), "AdmCmd: {FFFFFF}%s has given gun %d with %d bullets to all players on range %d (Count:%d)", sendername,gun,ammo,range,wcount);
	ABroadCast(COLOR_ADMCOMMANDS,string,1);
	return 1;
}

 

Edited by SoNNy.sys

Sinner.png

Link to comment
Share on other sites

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.