PutPlayerInVehicle problem
#1

Well the cmd is only have working it changes your vw but it isnt putting me into the car am i missing something ?

Код:
	COMMAND:challange(playerid, params[])
{
    if( IsPlayerInRangeOfPoint( playerid, 7.0, 1017.3148, -929.1449, 420.1316 ) ) // change the '1, 2, 3' to the coords for bigjump 1 (example)
    {
     SetPlayerVirtualWorld(playerid, 1);
     PutPlayerInVehicle(playerid, 411, 0);
 	    // when the player is at bigjump 1, do this
    }
    if( IsPlayerInRangeOfPoint( playerid, 7.0, 1946.0314, -1921.3646, 584.5061 ) ) // change the '4, 5, 6' to the coords for bigjump 2 (example)
    {
        SetPlayerVirtualWorld(playerid, 2);
        PutPlayerInVehicle(playerid, 411, 0);
    }
    if( IsPlayerInRangeOfPoint( playerid, 7.0, 2312.9204, 986.5928, 501.5012 ) ) // change the '7, 8, 9' to the coords for driftplace 137 (example)
    {
        SetPlayerVirtualWorld(playerid, 3);
        PutPlayerInVehicle(playerid, 411, 0);
    }
	return 1;
}
Manythanks
Reply
#2

See the usage of PutPlayerInVehicle, it would appear that you are using the vehicle's model ID and not the vehicle ID, which are both different, again, see the documentation I linked to for more information on the usage of this function.
Reply
#3

The only problem i think i will have with that is if 2 or 3 people do the challange at the same time they will lose there vehicle if im not mistaken?

Unless how would i make it so that the player has to be in a vehicle e.g 441
Reply
#4

Quote:
Originally Posted by manchestera
Посмотреть сообщение
The only problem i think i will have with that is if 2 or 3 people do the challange at the same time they will lose there vehicle if im not mistaken?
Well if the vehicle is already occupied it simply won't put them in it.

If multiple people can do the challenge, then it might be a good idea to simply create a vehicle for them specifically for the challenge and then destroy it later, or else you could make a variable to track if the vehicle is taken or not and if it is, put them in the next available vehicle.

I saw you edited your post too, if you wanted to check if the player was in a certain vehicle, you would use GetPlayerVehicleID and GetVehicleModel on the ID returned by GetPlayerVehicleID, then simply compare that to your model ID of choice.
Reply
#5

OK thankyou for your help so far and i think im nearly there just a few errors now, sorry if im being a plain lol.
i havent edit the over parts yet just want to get the first postion working.

Код:
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(96) : error 017: undefined symbol "vehicleid"
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(98) : warning 217: loose indentation
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(101) : warning 217: loose indentation
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(104) : error 010: invalid function or declaration
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(109) : error 010: invalid function or declaration
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(114) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Код:
	COMMAND:challange(playerid, params[])
{
    if( IsPlayerInRangeOfPoint( playerid, 7.0, 1017.3148, -929.1449, 420.1316 ) ) // change the '1, 2, 3' to the coords for bigjump 1 (example)
    {
    if(GetVehicleModel(vehicleid) == 411) // 411 is the infernus model
     SetPlayerVirtualWorld(playerid, 1);
     PutPlayerInVehicle(playerid, 411, 0);
     }
     else SendClientMessage(playerid, 0xFFFFFFFF, "You need to be in a Infernus type /inf to get one.!");
     return 1;
     	    // when the player is at bigjump 1, do this
    }
    if( IsPlayerInRangeOfPoint( playerid, 7.0, 1946.0314, -1921.3646, 584.5061 ) ) // change the '4, 5, 6' to the coords for bigjump 2 (example)
    {
        SetPlayerVirtualWorld(playerid, 2);
        PutPlayerInVehicle(playerid, 411, 0);
    }
    if( IsPlayerInRangeOfPoint( playerid, 7.0, 2312.9204, 986.5928, 501.5012 ) ) // change the '7, 8, 9' to the coords for driftplace 137 (example)
    {
        SetPlayerVirtualWorld(playerid, 3);
        PutPlayerInVehicle(playerid, 411, 0);
    }
	return 1;
}
Reply
#6

Okay you're almost there, but you need to get the vehicleid from somewhere too, as the variable does not exist in this context, for example:

pawn Код:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 411)
{ // 411 is the infernus model
     SetPlayerVirtualWorld(playerid, 1);
     PutPlayerInVehicle(playerid, 411, 0);
}
Reply
#7

still cant get this to work ive got rid of the rest of the location so it ust using one now but still now luck ive messed the braces somewhere too.

Код:
	COMMAND:challange(playerid, params[])
{
    if( IsPlayerInRangeOfPoint( playerid, 7.0, 1017.3148, -929.1449, 420.1316 ) ) // change the '1, 2, 3' to the coords for bigjump 1 (example)
    {
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 411)// 411 is the infernus model
     SetPlayerVirtualWorld(playerid, 1);
     PutPlayerInVehicle(playerid, 411, 0);
	 return 1;
}
Код:
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(100) : warning 217: loose indentation
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(100) : error 029: invalid expression, assumed zero
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(100) : error 004: function "OnPlayerEnterVehicle" is not implemented
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(105) : warning 225: unreachable code
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(105) : error 029: invalid expression, assumed zero
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(105) : error 004: function "OnPlayerExitVehicle" is not implemented
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(110) : warning 225: unreachable code
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(110) : error 029: invalid expression, assumed zero
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(110) : error 004: function "OnPlayerStateChange" is not implemented
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(115) : warning 225: unreachable code
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(115) : error 029: invalid expression, assumed zero
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(115) : error 004: function "Streamer_OnPlayerEnterCP" is not implemented
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(120) : warning 225: unreachable code
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(120) : error 029: invalid expression, assumed zero
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(120) : error 004: function "Streamer_OnPlayerLeaveCP" is not implemented
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(125) : warning 225: unreachable code
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(125) : error 029: invalid expression, assumed zero
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(125) : error 004: function "Streamer_OnPlayerEnterRaceCP" is not implemented
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(130) : warning 225: unreachable code
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(130) : error 029: invalid expression, assumed zero
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(130) : error 004: function "Streamer_OnPlayerLeaveRaceCP" is not implemented
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(135) : warning 225: unreachable code
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(135) : error 029: invalid expression, assumed zero
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(135) : error 004: function "OnRconCommand" is not implemented
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(140) : warning 225: unreachable code
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(140) : error 029: invalid expression, assumed zero
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(140) : error 004: function "OnPlayerRequestSpawn" is not implemented
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(145) : warning 225: unreachable code
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(145) : error 029: invalid expression, assumed zero
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(145) : error 004: function "OnObjectMoved" is not implemented
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(150) : warning 225: unreachable code
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(150) : error 029: invalid expression, assumed zero
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(150) : error 004: function "OnPlayerObjectMoved" is not implemented
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(155) : warning 225: unreachable code
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(155) : error 029: invalid expression, assumed zero
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(155) : error 004: function "Streamer_OnPlayerPickUpPickup" is not implemented
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(160) : warning 225: unreachable code
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(160) : error 029: invalid expression, assumed zero
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(160) : error 004: function "OnVehicleMod" is not implemented

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


26 Errors.
Reply
#8

You're missing a bracket, make sure you're indenting code properly so you can easily see where you're missing it:

pawn Код:
COMMAND:challange(playerid, params[])
{
    if( IsPlayerInRangeOfPoint( playerid, 7.0, 1017.3148, -929.1449, 420.1316 ) ) // change the '1, 2, 3' to the coords for bigjump 1 (example)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 411)// 411 is the infernus model
        {
            SetPlayerVirtualWorld(playerid, 1);
            PutPlayerInVehicle(playerid, 411, 0);
        }
    }
    return 1;
}
Again you still have the problem of putting the player into the vehicle's MODEL instead of the vehicle's ID! You need to specify a vehicle ID.

Model ID's are not unique and therefore there is no possible way of the script knowing which vehicle you want to put the player in, that is why vehicle ID's exist, as they are unique to a specific vehicle in the server, which is why you use it in PutPlayerInVehicle so it knows where you want to put the player.
Reply
#9

I think i understand what you mean but not 100% sure i tried this but got a error but like i said im not sure if im specify a vehicle ID.


Код:
new cars[] = {
411
};
Код:
COMMAND:challange(playerid, params[])
{
    if( IsPlayerInRangeOfPoint( playerid, 7.0, 1017.3148, -929.1449, 420.1316 ) ) // change the '1, 2, 3' to the coords for bigjump 1 (example)
    {
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 411)// 411 is the infernus model
        {
            SetPlayerVirtualWorld(playerid, 1);
            PutPlayerInVehicle(playerid, cars, 1);
        }
    }
    return 1;
}
Код:
C:\Users\GTA ONLY\Desktop\The_Eclipse_V4.8\filterscripts\challange.pwn(100) : error 035: argument type mismatch (argument 2)
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Many thanks
Reply
#10

When you create a vehicle the function returns the ID of the vehicle, so you can store that ID in a variable for later usage, for example:

pawn Код:
new somecar; // Global variable

public OnGameModeInit()
{
    somecar = CreateVehicle(.....); // Create your vehicle, store the ID in the variable.
    return 1;
}

// Then put the player in that vehicle:
PutPlayerInVehicle(playerid, somecar, 0);
Hope that example explains it for you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)