SA-MP Forums Archive
Add teleport, and define a vehicle to give the player? - 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)
+--- Thread: Add teleport, and define a vehicle to give the player? (/showthread.php?tid=340447)



Add teleport, and define a vehicle to give the player? - denNorske - 07.05.2012

Hello!

I am wondering if it is possible to make a teleport (in dcmd) where the player is teleported to the defined coordinates, and after teleporting, he gets a vehicle (i want the vehicle to be the Monster, id 444.). I want this because i am making a "monster derby". Is it possible?

Thanks!

And i am reachable on skype: a380sas (write in the request that you are going to help with the teleport cmd)

Airplanesimen


Re: Add teleport, and define a vehicle to give the player? - ViniBorn - 07.05.2012

Of course...

This vehicle will be created at once, or has been previously created?

pawn Код:
new VehicleID = CreateVehicle(444,X,Y,Z,A,-1,-1,-1);
PutPlayerInVehicle(playerid, VehicleID, 0);
//LinkVehicleToInterior(VehicleID, NUMBER); // if interior > 0
//SetPlayerInterior(VehicleID, NUMBER); // if interior > 0



Re: Add teleport, and define a vehicle to give the player? - Emil123 - 07.05.2012

use PutPlayerInVehicle


Re: Add teleport, and define a vehicle to give the player? - Faisal_khan - 07.05.2012

Add this anywhere in ur script:
pawn Код:
dcmd_monsterderby1(playerid, cmdtext[])
{
    new VehicleID = CreateVehicle(444,X,Y,Z,A,-1,-1,-1);
    PutPlayerInVehicle(playerid, VehicleID, 0);
    SetPlayerPos(playerid, x, y, z);              //here ur co-ordiantes
    return 1;
}
and add this below OnPlayerCommandText:
pawn Код:
dcmd(monsterderby1, 13, cmdtext[])



Re: Add teleport, and define a vehicle to give the player? - ViniBorn - 07.05.2012

Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
pawn Код:
dcmd_monsterderby1(playerid, cmdtext[])
{
    new VehicleID = CreateVehicle(444,X,Y,Z,A,-1,-1,-1);
    PutPlayerInVehicle(playerid, VehicleID, 0);
    SetPlayerPos(playerid, x, y, z);              //here ur co-ordiantes
    return 1;
}
You can't use SetPlayerPos in this case, because the player will leave the car


Re: Add teleport, and define a vehicle to give the player? - denNorske - 07.05.2012

Right!

Thanks guys, really helped me ^^ So-- Solved


Re: Add teleport, and define a vehicle to give the player? - denNorske - 07.05.2012

Quote:
Originally Posted by Faisal_khan
Посмотреть сообщение
Add this anywhere in ur script:
pawn Код:
dcmd_monsterderby1(playerid, cmdtext[])
{
    new VehicleID = CreateVehicle(444,X,Y,Z,A,-1,-1,-1);
    PutPlayerInVehicle(playerid, VehicleID, 0);
    SetPlayerPos(playerid, x, y, z);              //here ur co-ordiantes
    return 1;
}
and add this below OnPlayerCommandText:
pawn Код:
dcmd(monsterderby1, 13, cmdtext[])
That line i have to put under OnPlayerCommandText, what is the second argument for, the number? I have always wondered about that ^^


Re: Add teleport, and define a vehicle to give the player? - HDFord - 07.05.2012

it's just the lenght of the command.
And also to make the command use less space use this.
pawn Код:
dcmd_monsterderby1(playerid, cmdtext[])
{
    PutPlayerInVehicle(playerid,(CreateVehicle(444,X,Y,Z,A,-1,-1,-1)), 0);
    SetPlayerPos(playerid, x, y, z);            
    return 1;
}



Re: Add teleport, and define a vehicle to give the player? - denNorske - 07.05.2012

You cant use SetPlayerPos after putting player in a car. The player will be teleported, and not be in a car ^^ And you sure that 13 is for the lenght?


Re: Add teleport, and define a vehicle to give the player? - HDFord - 07.05.2012

I know that about the SetPlayerPos i did not see it actually just scripted something to make the code easyer.
pawn Код:
dcmd_monsterderby1(playerid, cmdtext[])
{
    PutPlayerInVehicle(playerid,(CreateVehicle(444,X,Y,Z,A,-1,-1,-1)), 0);            
    return 1;
}
also i do not see any other alternative then the lenght. The same shit is in strcmp
pawn Код:
if(strcmp("/command",cmdtext,true,10) == 0)
//or the easy version of strcmp
if(strcmp("/command",cmdtext,true) == 0)
it happens that if you change the number that is 10 in this on to the lenght of the command or more. This is mostly used if the command is in two words.