SA-MP Forums Archive
Help with /to & /get - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with /to & /get (/showthread.php?tid=164851)



Help with /to & /get - soulas85 - 02.08.2010

This is my /to and /get commands:
Код:
		if(!strcmp(cmdtext, "/to", true,3))
		{
    		if(cmdtext[3]==0){SendClientMessage(playerid, BLUE, "* Keliauti pas (be masinos): /to [dalis vardo]"); return 1;}
    		new vardas[MAX_PLAYER_NAME];
 			strmid(vardas,cmdtext[4],0,MAX_PLAYER_NAME);
 			new id = GetPlayeridMid(vardas);
 			if (id == INVALID_PLAYER_ID){ SendClientMessage(playerid, RED, "* Tokio zaidejo nera"); return 1;}
 			if (GetPlayerVirtualWorld(id)>0){SendClientMessage(playerid, RED, "* Zaidejas savo namuose, isibrauti negrazu"); return 1;}
			SetPlayerInterior(playerid,GetPlayerInterior(id));
			new Float:tempcoo[3];
 			GetPlayerPos(id,tempcoo[0],tempcoo[1],tempcoo[2]);
   			 SetPlayerPos(playerid,tempcoo[0],tempcoo[1],tempcoo[2]);
 			SetCameraBehindPlayer(playerid);
    		return 1;
  		}

    	if(!strcmp(cmdtext, "/get", true,4))
		{
    		if(cmdtext[4]==0){SendClientMessage(playerid, BLUE, "* Gauti zaideja: /get [dalis vardo]"); return 1;}
    		new vardas[MAX_PLAYER_NAME];
 			strmid(vardas,cmdtext[5],0,MAX_PLAYER_NAME);
 			new id = GetPlayeridMid(vardas);
 			if (id == INVALID_PLAYER_ID){ SendClientMessage(playerid, RED, "* Tokio zaidejo nera"); return 1;}
 			if (GetPlayerVirtualWorld(playerid)>0){SendClientMessage(playerid, RED, "* Tu namuose, pakviesk zaidejus.. nekilnok ju"); return 1;}
 			if (playerDB[id][ikalintas]) {SendClientMessage(playerid, RED, "* Zaidejas kalejime."); return 1;}
			SetPlayerInterior(id,GetPlayerInterior(playerid));
			new Float:tempcoo[3];
 			GetPlayerPos(playerid,tempcoo[0],tempcoo[1],tempcoo[2]);
 			SetPlayerPos(id,tempcoo[0],tempcoo[1],tempcoo[2]);
 			SetCameraBehindPlayer(id);
    		return 1;
		}
What i need to change that player Teleport's with Vehicle?
(please write codes)


Re: Help with /to & /get - Finn - 02.08.2010

pawn Код:
if(IsPlayerInAnyVehicle(playerid))
{
    SetVehiclePos(GetPlayerVehicleID(playerid), tempcoo[0], tempcoo[1], tempcoo[2]);
}
else
{
    SetPlayerPos(playerid, tempcoo[0], tempcoo[1], tempcoo[2]);
}



Re: Help with /to & /get - [MWR]Blood - 02.08.2010

You should add that:
pawn Код:
new vehicleid = GetPlayerVehicleID(playerid);
new State = GetPlayerState(playerid);
if (IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_DRIVER)
{

LinkVehicleToInterior(vehicleid, 0);
SetPlayerInterior(playerid, 0);
SetVehicleZAngle(vehicleid,0);
return SetVehiclePos(vehicleid, x,y,z);
}else{
SetPlayerPos(playerid, x,y,z);



Re: Help with /to & /get - soulas85 - 02.08.2010

if i use Finn code my /get function stops working , but /to works perfectly


Re: Help with /to & /get - soulas85 - 02.08.2010

any other suggestion's?


Re: Help with /to & /get - Finn - 03.08.2010

Obviously you have to change the player id to target id.

You have brains, why don't you use them?

Check ikarus' post aswell, you might need to link the vehicle to target's (or player's) interior & VW for these commands to work.


Re: Help with /to & /get - KennethRandall - 03.08.2010

Use ReturnUser from ******