Jump to content

Cerere Tutorials /goto


shake4god

Recommended Posts

Descriere tutorial: Sall deci as dorii sa ma ajutati si pe mn sa implantez comanda /goto [id] dar sa ma dea si in masina daca merge cu ea...

Asta e comanda incercata de mine dar nu ma da in masina player-ului.

 

CMD:goto(playerid, params[])
{
	if(playerVariables[playerid][pAdminLevel] >= 1)
	{
	    new userID;
	    new vehicleid = GetPlayerVehicleID(userID);
		if(sscanf(params, "u", userID)) {
		 return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/goto [playerid]");
		}
		else {
		    if(!IsPlayerConnected(userID)) return SendClientMessage(playerid, COLOR_GREY, "The specified player ID is either not connected or has not authenticated.");
		    new messageString[64];
		    new Float: fPos[3];
		    GetPlayerPos(userID, fPos[0], fPos[1], fPos[2]);
		    if(IsPlayerInAnyVehicle(userID) && GetPlayerState(userID) == PLAYER_STATE_DRIVER)
		    {
				LinkVehicleToInterior(GetPlayerVehicleID(playerid), GetPlayerInterior(userID));
				SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), GetPlayerVirtualWorld(userID));
		 		PutPlayerInVehicle(playerid, vehicleid, 0);
		 		SetPlayerPos(playerid, fPos[0], fPos[1]+2, fPos[2]);
		    }
			else
			{
			    SetPlayerPos(playerid, fPos[0], fPos[1]+2, fPos[2]);
			}
   			SetPlayerInterior(playerid, GetPlayerInterior(userID));
			SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(userID));
   			GetPlayerName(userID, szPlayerName, MAX_PLAYER_NAME);
			format(messageString, sizeof(messageString), "You have teleported to %s.", szPlayerName);
			SendClientMessage(playerid, COLOR_WHITE, messageString);
			IsOnDM[playerid] = IsOnDM[userID];
			InBizz[playerid] = InBizz[userID];
			InHouse[playerid] = InHouse[userID];
			InHQ[playerid] = InHQ[userID];
		}
	}
	return 1;
}

 

Link to comment
Share on other sites

Banuiesc ca vrei sa INPLEMENTEZI aceasta comanda nu sa o IMPLANTEZI

Problema este aici

PutPlayerInVehicle(playerid, vehicleid, 0);

Inlocuiesti 0 cu 1 si daca cineva este deja pe locul al doilea al masinii trebuie sa pui 2-3-4 si tot asa, dar trebuie sa pui un for pentru toti playerii sa vezi care este locul sau in masina playerului tau

Edited by Mister
  • Upvote 1

 

    __  ____      __           
   /  |/  (_)____/ /____  _____
  / /|_/ / / ___/ __/ _ \/ ___/
 / /  / / (__  ) /_/  __/ /    
/_/  /_/_/____/\__/\___/_/     
SERVICII SCRIPTING DE CALITATE
Pagina     Scripting     pawn
Link to comment
Share on other sites

Am pus 1 in loc de 0 dar tot asa e...uite

CMD:goto(playerid, params[])
{
	if(playerVariables[playerid][pAdminLevel] >= 1)
	{
	    new userID;
	    new vehicleid = GetPlayerVehicleID(userID);
		if(sscanf(params, "u", userID)) {
		 return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/goto [playerid]");
		}
		else {
		    if(!IsPlayerConnected(userID)) return SendClientMessage(playerid, COLOR_GREY, "The specified player ID is either not connected or has not authenticated.");
		    new messageString[64];
		    new Float: fPos[3];
		    GetPlayerPos(userID, fPos[0], fPos[1], fPos[2]);
		    if(IsPlayerInAnyVehicle(userID) && GetPlayerState(userID) == PLAYER_STATE_DRIVER)
		    {
				LinkVehicleToInterior(GetPlayerVehicleID(playerid), GetPlayerInterior(userID));
				SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), GetPlayerVirtualWorld(userID));
		 		PutPlayerInVehicle(playerid, vehicleid, 1);
		 		SetPlayerPos(playerid, fPos[0], fPos[1]+2, fPos[2]);
		    }
			else
			{
			    SetPlayerPos(playerid, fPos[0], fPos[1]+2, fPos[2]);
			}
   			SetPlayerInterior(playerid, GetPlayerInterior(userID));
			SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(userID));
   			GetPlayerName(userID, szPlayerName, MAX_PLAYER_NAME);
			format(messageString, sizeof(messageString), "You have teleported to %s.", szPlayerName);
			SendClientMessage(playerid, COLOR_WHITE, messageString);
			IsOnDM[playerid] = IsOnDM[userID];
			InBizz[playerid] = InBizz[userID];
			InHouse[playerid] = InHouse[userID];
			InHQ[playerid] = InHQ[userID];
		}
	}
	return 1;
}

 

Edited by shake4god
Link to comment
Share on other sites

Incearca asta 

Spoiler

CMD:goto(playerid, params[])
{
    if(gPlayerLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "You need to login first.");
    if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pHelper] >= 3)
    {
        new id,string[256],sendername[30],giveplayer[30];
        if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0xFFFFFFFF, "{FF9900}Scrie: {33CCFF}/goto <Name/Playerid>");
        {
            if(id != INVALID_PLAYER_ID)
            {
                new Float:ax,Float:ay,Float:az;
                GetPlayerPos(playerid,ax,ay,az);
                posxxx[playerid] = ax;
                posyyy[playerid] = ay;
                poszzz[playerid] = az;
                new Float:x, Float:y, Float:z;
                GetPlayerPos(id, x, y, z);
                new tmpcar = GetPlayerVehicleID(playerid);
                if (GetPlayerState(playerid) == 2)
                {
                    SetVehiclePos(tmpcar, x, y+4, z);
                }
                else
                {
                    SetPlayerPosEx(playerid,x,y+2, z);
                }
                SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(id));
                SetPlayerInterior(playerid, GetPlayerInterior(id));
                if(InHouse[id] > 0)
                {
                    InHouse[playerid] = InHouse[id];
                    if(strlen(housestring[InHouse[playerid]]) > 0)
                    {
                        StopAudioStreamForPlayer(playerid);
                        PlayAudioStreamForPlayer(playerid, housestring[InHouse[playerid]]);
                    }
                }
                if(InHQ[id] > 0)
                {
                    InHQ[playerid] = InHQ[id];
                }
                if(InBussines[id] > 0)
                {
                    InBussines[playerid] = InBussines[id];
                }
                GetPlayerName(playerid,sendername,sizeof(sendername));
                GetPlayerName(id,giveplayer,sizeof(giveplayer));
                format(string,sizeof(string),"You have been teleported to %s.",giveplayer);
                SendClientMessage(playerid, COLOR_GRAD1, string);
                format(string,sizeof(string),"Admin %s teleported to you.",sendername);
                SendClientMessage(id, COLOR_GRAD1, string);
                format(string,sizeof(string),"AdmCmd: %s used /goto on %s.",sendername,giveplayer);
                if(PlayerInfo[id][pAdmin] > 0 || PlayerInfo[id][pHelper] > 0)
                {
                    ABroadCast(COLOR_YELLOW,string,1);
                }
                Adminlog(string);
            }
            else return SendClientMessage(playerid, COLOR_WHITE, "{FFFFCC}Error: Player not connected.");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_WHITE, "{5CAD5C}Error: Your admin/helper level isn't high enough to use this command.");
    }
    return 1;
}

 

Edited by Uzzi25

2c4AJX1.png

Link to comment
Share on other sites

Mda,imi da asta

.pwn(33622) :error 017: undefined symbol "gPlayerLogged"
.pwn(33622) : warning 215: expression has no effect
.pwn(33622) : error 001: expected token: ";", but found "]"
.pwn(33622) : error 029: invalid expression, assumed zero
.pwn(33622) : fatal error 107: too many error messages on one line

 

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.