PutPlayerInVehicle does not work?
#1

Код:
	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.
Reply
#2

Can anyone give me a solution?
Reply
#3

In what callback did you put it?
Reply
#4

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

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

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

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

Well start by deleting the line towards the bottom that says

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

What should I put here then ?

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)