Goto Command.
#1

Hello Sa-Mp again, I have a concerning about how to teleport myself in player's car if he is in a vehicle with cmd /goto
here is my command I tried to put PutPlayerInVehicle but I spoiled it.. sorry for giving you problems with my stupid commands
Here is my command GOTO.
Код:
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]+2, fPos[1], fPos[2]);
		    }
			else
			{
			    SetPlayerPos(playerid, fPos[0]+2, fPos[1], fPos[2]);
			    SetVehiclePos(GetPlayerVehicleID(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;
}
Thank you very much bros
Reply


Messages In This Thread
Goto Command. - by Digii - 16.05.2016, 11:17
Re: Goto Command. - by F1N4L - 16.05.2016, 11:20
Re: Goto Command. - by Digii - 16.05.2016, 11:25
Re: Goto Command. - by F1N4L - 16.05.2016, 11:28
Re: Goto Command. - by Nin9r - 16.05.2016, 11:54
Re: Goto Command. - by Amunra - 16.05.2016, 11:59
Re: Goto Command. - by Sew_Sumi - 16.05.2016, 12:33
Re: Goto Command. - by Nin9r - 16.05.2016, 13:01
Re: Goto Command. - by Digii - 16.05.2016, 13:31
Re: Goto Command. - by Sew_Sumi - 16.05.2016, 13:49

Forum Jump:


Users browsing this thread: 2 Guest(s)