Jump to content
  • 0

Comanda /refill


Marius_Smith

Question

Problema intalnita (descriere): Am incercat sa schimb comanda refill, sa aiba acces cei din factiunea TCC la ea, si nu cei din jobul Mechanic, dar cand intru pe server, fiind in factiune, cand scriu comanda, imi zice ca nu sunt Membru TCC.
Ero(area / rile) / warning-(ul / urile): -
Liniile de cod / sursa / script-ul: 

//-----------------------------------------Comanda-----------------------------------------//
	if(strcmp(cmd, "/refill", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
		    if(PlayerData[playerid][pMember] == 10 || PlayerData[playerid][pLeader] == 10)
		    {
		        SendClientMessage(playerid, COLOR_GREY, "Nu esti membru TCC!");
		        return 1;
		    }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendUsage(playerid,"/refill [playerid/PartOfName] [pret]");
				return 1;
			}
			new playa;
			new money;
			playa = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			money = strval(tmp);
			if(money < 1 || money > 1000) { SendClientMessage(playerid, COLOR_GREY, "Pretul trebuie sa fie cuprins intre $1 si $1000!"); return 1; }
			if(IsPlayerConnected(playa))
			{
			    if(playa != INVALID_PLAYER_ID)
			    {
			        if(ProxDetectorS(8.0, playerid, playa)&& IsPlayerInAnyVehicle(playa))
					{
					    if(playa == playerid) { SendClientMessage(playerid, COLOR_GREY, "Nu poti sa iti bagi benzina tie insuti!"); return 1; }
					    GetPlayerName(playa, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
					    format(string, sizeof(string), "* I-ai oferit la %s sa-i bagi benzina pentru $%d .",giveplayer,money);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Mecanicul %s vrea sa iti bage benzina pentru $%d, (scrie /accept refill pentru a accepta).",sendername,money);
						SendClientMessage(playa, COLOR_LIGHTBLUE, string);
						RefillOffer[playa] = playerid;
						RefillPrice[playa] = money;
					}
					else
					{
					    SendClientMessage(playerid, COLOR_GREY, "Acest jucator nu este langa tine sau intr-o masina.");
					}
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "Acest jucator nu este conectat.");
			}
		}
		return 1;
	}

Imagini / Video (optional): -
Ati incercat sa rezolvati singur?: Da, dar nu reusesc.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0
//-----------------------------------------Comanda-----------------------------------------//
	if(strcmp(cmd, "/refill", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
		    if(PlayerData[playerid][pMember] < 10 || PlayerData[playerid][pLeader] > 10)
		    {
		        SendClientMessage(playerid, COLOR_GREY, "Nu esti membru TCC!");
		        return 1;
		    }
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendUsage(playerid,"/refill [playerid/PartOfName] [pret]");
				return 1;
			}
			new playa;
			new money;
			playa = ReturnUser(tmp);
			tmp = strtok(cmdtext, idx);
			money = strval(tmp);
			if(money < 1 || money > 1000) { SendClientMessage(playerid, COLOR_GREY, "Pretul trebuie sa fie cuprins intre $1 si $1000!"); return 1; }
			if(IsPlayerConnected(playa))
			{
			    if(playa != INVALID_PLAYER_ID)
			    {
			        if(ProxDetectorS(8.0, playerid, playa)&& IsPlayerInAnyVehicle(playa))
					{
					    if(playa == playerid) { SendClientMessage(playerid, COLOR_GREY, "Nu poti sa iti bagi benzina tie insuti!"); return 1; }
					    GetPlayerName(playa, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
					    format(string, sizeof(string), "* I-ai oferit la %s sa-i bagi benzina pentru $%d .",giveplayer,money);
						SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
						format(string, sizeof(string), "* Mecanicul %s vrea sa iti bage benzina pentru $%d, (scrie /accept refill pentru a accepta).",sendername,money);
						SendClientMessage(playa, COLOR_LIGHTBLUE, string);
						RefillOffer[playa] = playerid;
						RefillPrice[playa] = money;
					}
					else
					{
					    SendClientMessage(playerid, COLOR_GREY, "Acest jucator nu este langa tine sau intr-o masina.");
					}
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "Acest jucator nu este conectat.");
			}
		}
		return 1;
	}
Link to comment
Share on other sites

  • 0
//-----------------------------------------Comanda-----------------------------------------//
	if(strcmp(cmd, "/refill", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
		    if(PlayerData[playerid][pMember] == 10 || PlayerData[playerid][pLeader] == 10)
		    {
				tmp = strtok(cmdtext, idx);
				if(!strlen(tmp))
				{
					SendUsage(playerid,"/refill [playerid/PartOfName] [pret]");
					return 1;
				}
				new playa;
				new money;
				playa = ReturnUser(tmp);
				tmp = strtok(cmdtext, idx);
				money = strval(tmp);
				if(money < 1 || money > 1000) { SendClientMessage(playerid, COLOR_GREY, "Pretul trebuie sa fie cuprins intre $1 si $1000!"); return 1; }
				if(IsPlayerConnected(playa))
				{
			    	if(playa != INVALID_PLAYER_ID)
			    	{
			        	if(ProxDetectorS(8.0, playerid, playa)&& IsPlayerInAnyVehicle(playa))
						{
					    	if(playa == playerid) { SendClientMessage(playerid, COLOR_GREY, "Nu poti sa iti bagi benzina tie insuti!"); return 1; }
					    	GetPlayerName(playa, giveplayer, sizeof(giveplayer));
							GetPlayerName(playerid, sendername, sizeof(sendername));
					    	format(string, sizeof(string), "* I-ai oferit la %s sa-i bagi benzina pentru $%d .",giveplayer,money);
							SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
							format(string, sizeof(string), "* Mecanicul %s vrea sa iti bage benzina pentru $%d, (scrie /accept refill pentru a accepta).",sendername,money);
							SendClientMessage(playa, COLOR_LIGHTBLUE, string);
							RefillOffer[playa] = playerid;
							RefillPrice[playa] = money;
						}
						else
						{
					    	SendClientMessage(playerid, COLOR_GREY, "Acest jucator nu este langa tine sau intr-o masina.");
						}
					}
				}
				else
				{
			    	SendClientMessage(playerid, COLOR_GREY, "Acest jucator nu este conectat.");
				}
			}
			SendClientMessage(playerid, COLOR_GREY, "Nu estri membru TCC!");
		}
		return 1;
	}
  • Upvote 1
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.