Jump to content
  • 0

Ajutor


Mainstream

Question

Problema intalnita (descriere):Am vrut sa adaug o mica chestie, daca un player are wanted sa nu poata primii respawn si daca e in jail sa nu primeasca /gethere
Ero(area / rile) / warning-(ul / urile):-
Liniile de cod / sursa / script-ul(obligatoriu):

   if(strcmp(cmd, "/respawn", true) == 0) //By Granea27
    {
        if(IsPlayerConnectedEx(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /respawn [playerid/PartOfName]");
                return 1;
            }
            if(WantedLevel[playerid] > 0)
           {
           SendClientMessage(playerid, COLOR_GREY, "Nu trebuie sa ai wanted pentru a folosi comanda !");
           return 1;
            }
            new playa;
              playa = ReturnUser(tmp);
              if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 1)
            {
                if(IsPlayerConnectedEx(playa))
                {
                    if(playa != INVALID_PLAYER_ID)
                    {
                          //if(SpawnChange[playerid])
                        {
                            GetPlayerName(playa, giveplayer, sizeof(giveplayer));
                            if(IsPlayerInAnyVehicle(playa)) SetPlayerHealth(playa, 0.0);
                            else SpawnPlayer(playa);
                            GetPlayerName(playerid, sendername, sizeof(sendername));
                            format(string, sizeof(string), "* You have respawned player %s.", giveplayer);
                            SendClientMessage(playerid, COLOR_LIGHTRED, string);
                             format(string, sizeof(string), "* You have been respawned by %s.", sendername);
                            SendClientMessage(playa, COLOR_LIGHTRED, string);
                            format(string, 256, "News: %s has respawned the player %s (/respawn).", sendername, giveplayer);
                            ABroadCast(COLOR_YELLOW,string,1);
                            SendHelperMessage(COLOR_YELLOW,string);
                            return 1;
                        }
                    }
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GRAD1, " Nu ai voie sa folosesti aceasta comanda!");
            }
        }
        return 1;
    }

si

//----------------------------------[GETHERE]-----------------------------------------------
    if(strcmp(cmd, "/gethere", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /gethere [playerid/PartOfName]");
                return 1;
            }
            if(PlayerInfo[playerid][pJailed])
            {
                SendClientMessage(playerid, COLOR_GREY," This player is in jail.");
                return 1;
            }
            new Float:plocx,Float:plocy,Float:plocz;
            new plo;
            plo = ReturnUser(tmp);
            if (IsPlayerConnected(plo))
            {
                if(plo != INVALID_PLAYER_ID)
                {
                    if (PlayerInfo[plo][pAdmin] > 3)
                    {
                        SendClientMessage(playerid, COLOR_GRAD1, "Ask the admin to goto you.");
                        return 1;
                    }
                    if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 3)
                    {
                        GetPlayerPos(playerid, plocx, plocy, plocz);
                        if(PlayerInfo[playerid][pInt] > 0 || GetPlayerInterior(playerid) > 0)
                        {
                            SetPlayerInterior(plo,GetPlayerInterior(playerid));
                            SetPlayerInterior(plo,PlayerInfo[playerid][pInt]);
                            PlayerInfo[plo][pInt] = PlayerInfo[playerid][pInt];
                            PlayerInfo[plo][pLocal] = PlayerInfo[playerid][pLocal];
                        }
                        if(PlayerInfo[playerid][pInt] == 0)
                        {
                            SetPlayerInterior(plo,0);
                        }
                        if(plocz > 930.0 && PlayerInfo[playerid][pInt] == 0) //the highest land point in sa = 526.8
                        {
                            SetPlayerInterior(plo,1);
                            PlayerInfo[plo][pInt] = 1;
                        }
                        if (GetPlayerState(plo) == 2)
                        {
                            TelePos[plo][0] = 0.0;
                            TelePos[plo][1] = 0.0;
                            new tmpcar = GetPlayerVehicleID(plo);
                            SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
                        }
                        else
                        {
                            SetPlayerPos(plo,plocx,plocy+2, plocz);
                        }
                        SendClientMessage(playerid, COLOR_GREY, "  You teleported a player to you!");
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use the command. ");
                    }
                }
            }
            else
            {
                format(string, sizeof(string), " That player is not connected.", plo);
                SendClientMessage(playerid, COLOR_GRAD1, string);
            }
        }
        return 1;
    }
Imagini / Video (optional):-
Ati incercat sa rezolvati singur?:da
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Incearca asta:

if(strcmp(cmd, "/respawn", true) == 0) //By Granea27
{
	if(IsPlayerConnectedEx(playerid))
	{
		if(WantedLevel[playerid] == 0)
		{
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
			SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /respawn [playerid/PartOfName]");
			return 1;
			}
			new playa;
			playa = ReturnUser(tmp);
			if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 1)
			{
				if(IsPlayerConnectedEx(playa))
				{
					if(playa != INVALID_PLAYER_ID)
					{
						GetPlayerName(playa, giveplayer, sizeof(giveplayer));
						if(IsPlayerInAnyVehicle(playa)) SetPlayerHealth(playa, 0.0);
						else SpawnPlayer(playa);
						GetPlayerName(playerid, sendername, sizeof(sendername));
						format(string, sizeof(string), "* You have respawned player %s.", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTRED, string);
						format(string, sizeof(string), "* You have been respawned by %s.", sendername);
						SendClientMessage(playa, COLOR_LIGHTRED, string);
						format(string, 256, "News: %s has respawned the player %s (/respawn).", sendername, giveplayer);
						ABroadCast(COLOR_YELLOW,string,1);
						SendHelperMessage(COLOR_YELLOW,string);
					}
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, " Nu ai voie sa folosesti aceasta comanda!");
			}
		}
		else
		{
			SendClientMessage(playerid, COLOR_GREY, "Nu trebuie sa ai wanted pentru a folosi comanda !");
		}
	}
	return 1;
}
Link to comment
Share on other sites

  • 0

Andy nu a inteles ce ai vrut sa spui...

 

ia incearca asa:

if(strcmp(cmd, "/respawn", true) == 0) //By Granea27
{
	if(IsPlayerConnectedEx(playerid))
	{
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /respawn [playerid/PartOfName]");
			return 1;
		}
		if(WantedLevel[playerid] > 0)
		{
			SendClientMessage(playerid, COLOR_GREY, "Nu trebuie sa ai wanted pentru a folosi comanda !");
			return 1;
		}
		new playa;
		playa = ReturnUser(tmp);
		if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 1)
		{
			if(IsPlayerConnectedEx(playa))
			{
			  if(playa != INVALID_PLAYER_ID)
				{
					if(PlayerInfo[playerid][pJailed] > 0)
							return SendClientMessage(playerid, -1, "Acest jucator este inchis!");
							
					if(PlayerInfo[playerid][pWanted] > 0)
							return SendClientMessage(playerid, -1, "Acest jucator are Wanted!");
							
					if(SpawnChange[playerid])
					{
						GetPlayerName(playa, giveplayer, sizeof(giveplayer));
						if(IsPlayerInAnyVehicle(playa)) SetPlayerHealth(playa, 0.0);
						else SpawnPlayer(playa);
						GetPlayerName(playerid, sendername, sizeof(sendername));
						format(string, sizeof(string), "* You have respawned player %s.", giveplayer);
						SendClientMessage(playerid, COLOR_LIGHTRED, string);
						format(string, sizeof(string), "* You have been respawned by %s.", sendername);
						SendClientMessage(playa, COLOR_LIGHTRED, string);
						format(string, 256, "News: %s has respawned the player %s (/respawn).", sendername, giveplayer);
						ABroadCast(COLOR_YELLOW,string,1);
						SendHelperMessage(COLOR_YELLOW,string);
						return 1;
					}
				}
			}
		}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, " Nu ai voie sa folosesti aceasta comanda!");
			}
		}
	return 1;
}

si asta:

if(strcmp(cmd, "/gethere", true) == 0)
{
	if(IsPlayerConnected(playerid))
	{
		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /gethere [playerid/PartOfName]");
			return 1;
		}
		if(PlayerInfo[playerid][pJailed])
		{
			SendClientMessage(playerid, COLOR_GREY," This player is in jail.");
			return 1;
		}
		new Float:plocx,Float:plocy,Float:plocz;
		new plo;
		plo = ReturnUser(tmp);
		if (IsPlayerConnected(plo))
		{
			if(plo != INVALID_PLAYER_ID)
			{
				if(PlayerInfo[plo][pJailed] > 0)
						return SendClientMessage(playerid, COLOR_GRAD1, "Playerul acesta este inchis!");
						
				if(PlayerInfo[plo][pWanted] > 0)
						return SendClientMessage(playerid, COLOR_GRAD1, "Playerul acesta are wanted!");
						
				if (PlayerInfo[plo][pAdmin] > 3)
				{
					SendClientMessage(playerid, COLOR_GRAD1, "Ask the admin to goto you.");
					return 1;
				}
				if (PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 3)
				{
					GetPlayerPos(playerid, plocx, plocy, plocz);
					if(PlayerInfo[playerid][pInt] > 0 || GetPlayerInterior(playerid) > 0)
					{
						SetPlayerInterior(plo,GetPlayerInterior(playerid));
						SetPlayerInterior(plo,PlayerInfo[playerid][pInt]);
						PlayerInfo[plo][pInt] = PlayerInfo[playerid][pInt];
						PlayerInfo[plo][pLocal] = PlayerInfo[playerid][pLocal];
					}
					if(PlayerInfo[playerid][pInt] == 0)
					{
						SetPlayerInterior(plo,0);
					}
					if(plocz > 930.0 && PlayerInfo[playerid][pInt] == 0) //the highest land point in sa = 526.8
					{
						SetPlayerInterior(plo,1);
						PlayerInfo[plo][pInt] = 1;
					}
					if (GetPlayerState(plo) == 2)
					{
						TelePos[plo][0] = 0.0;
						TelePos[plo][1] = 0.0;
						new tmpcar = GetPlayerVehicleID(plo);
						SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
					}
					else
					{
						SetPlayerPos(plo,plocx,plocy+2, plocz);
					}
					SendClientMessage(playerid, COLOR_GREY, "You teleported a player to you!");
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use the command. ");
				}
			}
		}
		else
		{
			format(string, sizeof(string), " That player is not connected.", plo);
			SendClientMessage(playerid, COLOR_GRAD1, string);
		}
	}
	return 1;
}
Edited by WiDuAlK.SaMp
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.