Jump to content
  • 0

Problema "/usedrugs"


bL3s

Question

Am urmatoarea comanda

if(strcmp(cmdtext, "/usedrugs", true) == 0)

{

    if(IsPlayerConnected(playerid))

  {

      if(PlayerBoxing[playerid] > 0)

        {

            SendClientMessage(playerid, COLOR_GREY, "  Cant use Drugs while you are fighting !");

            return 1;

        }

new Float:health;

    GetPlayerHealth(playerid,health);

if(PlayerInfo[playerid][pDrugs] > 4)

{

    SetPlayerHealth (playerid, health+50);

      SendClientMessage(playerid, COLOR_GREY, "  5 Drug Grams used !");

    PlayerInfo[playerid][pDrugs] -= 5;

    GetPlayerName(playerid, sendername, sizeof(sendername));

    format(string, sizeof(string), "* %s used 5 drug grams.", sendername);

    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

    SetTimerEx("Drugs", 150000, 0, "%d", playerid);

}

else

{

    SendClientMessage(playerid, COLOR_GREY, "  You dont have enough Drug Grams left !");

}

}//not connected

return 1;

}

De fiecare data cand o folosesc, se inchide server-ul :))

Aveti idee ce este gresit la comanda?:)

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

	if(strcmp(cmdtext, "/usedrugs", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	   	{
	   	    if(PlayerBoxing[playerid] > 0)
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   Cant use Drugs while you are fighting !");
	            return 1;
	        }
			if(PlayerInfo[playerid][pDrugs] > 1)
			{
			    PlayerStoned[playerid] += 1;
			    if(PlayerStoned[playerid] >= 2) { GameTextForPlayer(playerid, "~w~You are~n~~p~Stoned", 4000, 1); }
			    new Float:health;
			    GetPlayerHealth(playerid, health);
			    if(PlayerInfo[playerid][pDrugPerk] > 0)
			    {
			        new hp = 2 * PlayerInfo[playerid][pDrugPerk]; hp += 20;
					SetPlayerHealth(playerid, health + hp);
			    }
			    else
			    {
			        SetPlayerHealth(playerid, health + 20.0);
			    }
			    SendClientMessage(playerid, COLOR_GREY, "   2 Drug Grams used !");
			    PlayerInfo[playerid][pDrugs] -= 2;
			    if(STDPlayer[playerid]==1)
				{
				     STDPlayer[playerid] = 0;
				     SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You are no longer infected with a STD anymore because of the Drugs !");
				}
				else if(STDPlayer[playerid]==2)
				{
				     STDPlayer[playerid] = 1;
				     SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You lowered the STD to Chlamydia because of the Drugs !");
				}
				else if(STDPlayer[playerid]==3)
				{
				     STDPlayer[playerid] = 2;
				     SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You lowered the STD to Gonorrhea because of the Drugs !");
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "   You dont have any Drug Grams left !");
			}
		}//not connected
		return 1;
	}

Incearc-o pe asta ,trebuie sa-ti mearga 100%

Respir si traiesc !

Link to comment
Share on other sites

	if(strcmp(cmdtext, "/usedrugs", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	   	{
	   	    if(PlayerBoxing[playerid] > 0)
	        {
	            SendClientMessage(playerid, COLOR_GREY, "   Cant use Drugs while you are fighting !");
	            return 1;
	        }
			if(PlayerInfo[playerid][pDrugs] > 1)
			{
			    PlayerStoned[playerid] += 1;
			    if(PlayerStoned[playerid] >= 2) { GameTextForPlayer(playerid, "~w~You are~n~~p~Stoned", 4000, 1); }
			    new Float:health;
			    GetPlayerHealth(playerid, health);
			    if(PlayerInfo[playerid][pDrugPerk] > 0)
			    {
			        new hp = 2 * PlayerInfo[playerid][pDrugPerk]; hp += 20;
					SetPlayerHealth(playerid, health + hp);
			    }
			    else
			    {
			        SetPlayerHealth(playerid, health + 20.0);
			    }
			    SendClientMessage(playerid, COLOR_GREY, "   2 Drug Grams used !");
			    PlayerInfo[playerid][pDrugs] -= 2;
			    if(STDPlayer[playerid]==1)
				{
				     STDPlayer[playerid] = 0;
				     SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You are no longer infected with a STD anymore because of the Drugs !");
				}
				else if(STDPlayer[playerid]==2)
				{
				     STDPlayer[playerid] = 1;
				     SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You lowered the STD to Chlamydia because of the Drugs !");
				}
				else if(STDPlayer[playerid]==3)
				{
				     STDPlayer[playerid] = 2;
				     SendClientMessage(playerid, COLOR_LIGHTBLUE, "* You lowered the STD to Gonorrhea because of the Drugs !");
				}
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "   You dont have any Drug Grams left !");
			}
		}//not connected
		return 1;
	}

Incearc-o pe asta ,trebuie sa-ti mearga 100%

Eu am intrebat ce este gresit la a mea:|

Nu imi trebuie comanda copiata din alt gm..

Link to comment
Share on other sites

Mai bine pui asa comanda:

[pawn]if(strcmp(cmdtext, "/usedrugs", true) == 0)

{

if(!IsPlayerConnected(playerid)) return 1;

if(PlayerBoxing[playerid] > 0) return SendClientMessage(playerid, COLOR_GREY, "  Can't use Drugs while you are fighting !");

       

new Float:health;

GetPlayerHealth(playerid,health);

if(PlayerInfo[playerid][pDrugs] <= 4) return SendClientMessage(playerid, COLOR_GREY, "  You dont have enough Drug Grams left !");

SetPlayerHealth (playerid, health+50);

SendClientMessage(playerid, COLOR_GREY, "  5 Drug Grams used !");

PlayerInfo[playerid][pDrugs] -= 5;

GetPlayerName(playerid, sendername, sizeof(sendername));

format(string, sizeof(string), "* %s used 5 drug grams.", sendername);

ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

SetTimerEx("Drugs", 150000, 0, "%d", playerid);

return 1;

}[/pawn]

(mai identitata si mai aranjata)

Ca sa descoperi unde da crashul, foloseste print dupa fiecare rand. Uite asa:

[pawn]if(strcmp(cmdtext, "/usedrugs", true) == 0)

{

if(!IsPlayerConnected(playerid)) return 1;

print("UseDrugs Step 1");

if(PlayerBoxing[playerid] > 0) return SendClientMessage(playerid, COLOR_GREY, "  Can't use Drugs while you are fighting !");

print("UseDrugs Step 2");

new Float:health;

print("UseDrugs Step 3");

GetPlayerHealth(playerid,health);

print("UseDrugs Step 4");

if(PlayerInfo[playerid][pDrugs] <= 4) return SendClientMessage(playerid, COLOR_GREY, "  You dont have enough Drug Grams left !");

print("UseDrugs Step 5");

SetPlayerHealth (playerid, health+50);

print("UseDrugs Step 6");

SendClientMessage(playerid, COLOR_GREY, "  5 Drug Grams used !");

print("UseDrugs Step 7");

PlayerInfo[playerid][pDrugs] -= 5;

print("UseDrugs Step 8");

GetPlayerName(playerid, sendername, sizeof(sendername));

print("UseDrugs Step 9");

format(string, sizeof(string), "* %s used 5 drug grams.", sendername);

print("UseDrugs Step 10");

ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

print("UseDrugs Step 11");

SetTimerEx("Drugs", 150000, 0, "%d", playerid);

print("UseDrugs Step 12");

return 1;

}[/pawn]

Dupa ce inlocuiesti comanda ta cu cea cu print, compilezi scriptul, deschizi serverul, folosesti /usedrugs, te uiti in server-log.txt dupa ce ai folosit comanda si dupa ce a dat crash si ne spui la ce "Step" s-a oprit.

Link to comment
Share on other sites

S-a oprit la

"Step"  11

[01:44:55] UseDrugs Step 11

Adica aici

ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
:|

Mai am aceasta linie in gm de multe ori.. nu inteleg ce este gresit X_X

Link to comment
Share on other sites

Probleme rpg-

Asta inseamna godfather asta inseamna tc!

In loc sa comentezi, ai putea sa ma ajuti :|

Am vazut si alte topicuri in care sunt probleme la gamemode-ul godfather sau alt rp si nu s-au inchis:|

Asa ca... shh :shocked:

+ ca aceasta comanda poate fi folosita si pe servere stunt..

Daca am gresit, dati tc!

si dumnezeu cu mila... eu nu mai postez odata.

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.