SA-MP Forums Archive
PutPlayerInVehicle does not work? - 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: PutPlayerInVehicle does not work? (/showthread.php?tid=97237)



PutPlayerInVehicle does not work? - Erkan - 13.09.2009

Код:
	if(strcmp("/drag", cmdtext, true, 8) == 0)
	{
      if(IsPlayerInAnyVehicle(playerid))
      {
     	if (GetDistanceBetweenPlayers(playerid,giveplayerid) > 2.00)
  		{
			SendClientMessage(playerid,COLOR_RED1,"You are too far away!!");
  		return 1;
			}
        if(PlayerData[playerid][Medic] < 2) return SendClientMessage(playerid, RED, "You are not a Medic rank2!");
        tmp = strtok(cmdtext, idx);
        	new otherplayer = strvalEx(tmp);
  			if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /drag (playerid)");
        new Float:X, Float:Y, Float:Z, Float:A;
        GetPlayerPos(playerid, X, Y, Z);
        GetPlayerFacingAngle(playerid, A);
        	new pname[MAX_PLAYER_NAME],pname2[MAX_PLAYER_NAME];
  				GetPlayerName(otherplayer,pname,sizeof(pname));
  				GetPlayerName(playerid,pname2,sizeof(pname2));
	 			format(string, sizeof(string), "Medic %s(%i) has draged you to his Vehicle!", pname2, playerid);
    		SendClientMessage(otherplayer, TEAM_MEDIC, string);
    		format(string, sizeof(string), "You dragged Player %s(%d) to your Vehicle!", pname, playerid);
    		SendClientMessage(playerid, TEAM_MEDIC, string);
				new MyVehicle = CreateVehicle(417, X, Y, Z, A, 0, 0,0);
				PutPlayerInVehicle(playerid, MyVehicle, 2);
        }
		return 1;
	}
Why does this not work it says Unkown command.


Re: PutPlayerInVehicle does not work? - Erkan - 13.09.2009

Can anyone give me a solution?


Re: PutPlayerInVehicle does not work? - Vollzeitfan - 13.09.2009

In what callback did you put it?


Re: PutPlayerInVehicle does not work? - Ov3rl0rd - 13.09.2009

Is it giving you the Server Unknown command just when you type /drag?


Re: PutPlayerInVehicle does not work? - Erkan - 13.09.2009

Yeah, when i do /drag it says /drag playerid, if I type the playerid in it it says Unknown COmmand.


Re: PutPlayerInVehicle does not work? - Ov3rl0rd - 13.09.2009

Are you meaning to create a vehicle with this command?
Код:
new MyVehicle = CreateVehicle(417, X, Y, Z, A, 0, 0,0);



Re: PutPlayerInVehicle does not work? - Erkan - 13.09.2009

No, I don't want to create a Vehicle, I just want to put the player to the Ambulance with /drag [ID].


Re: PutPlayerInVehicle does not work? - Ov3rl0rd - 13.09.2009

Well start by deleting the line towards the bottom that says

Код:
new MyVehicle = CreateVehicle(417, X, Y, Z, A, 0, 0,0);



Re: PutPlayerInVehicle does not work? - Erkan - 13.09.2009

What should I put here then ?

Код:
		PutPlayerInVehicle(playerid, MyVehicle, 2);
I want to put Ambulance ID and Maverick.


Re: PutPlayerInVehicle does not work? - Ov3rl0rd - 13.09.2009

Well you need to create the vehicles in OnGameModeInit (preferably as AddStaticVehicleEx so it respawns) so in OnGameModeInit it would be MyVehicle = AddStaticVehicleEx(blahblah); than at the top of your script add new MyVehicle.