Help - CommandText
#1

Heyo Guys,

Im trying to use command text, to teleport car to the player who just command the text.

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    if (
strcmp("/infernus"cmdtexttrue10) == 0)
    {
    new 
Float:xFloat:yFloat:zFloat:a;
    
GetPlayerPos(playerid,x,y,z);
    
GetPlayerFacingAngle(playerida);
    
PutPlayerInVehicle(playerid4110);
    
SendClientMessage(playerid0xADD8E6FF"You have been teleported Infernus to your position.");
        return 
1;
    }
    return 
0;

Its working but ain't teleporting Infernus to the player who just type it,
what im want is that player who type /infernus he get infernus and he is in the vehicle = PutPlayerInVehicle(playerid, 411, 0);

IM New so please try to explain me!

Thanks!
Reply
#2

You need to create a vehicle, store the vehicleid and then use the vehicleid instead of 411 in PutPlayerInVehiclle function. The second parameter of it needs the vehicleid, not the modelid.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/infernus", cmdtext, true))
    {
        new Float:x, Float:y, Float:z, Float:a, vehicle;
        GetPlayerPos(playerid,x,y,z);
        GetPlayerFacingAngle(playerid, a);
        vehicle = CreateVehicle(411, x, y, z, a, -1, -1, 60);
        PutPlayerInVehicle(playerid, vehicle, 0);
        SendClientMessage(playerid, 0xADD8E6FF, "You have been teleported Infernus to your position.");
        return 1;
    }
    return 0;
}
Reply
#3

new Float, Float:y, Float:z, Car;
GetPlayerPos(playerid,x,y,z);
Car = AddStaticVehicle(411,x,y,z,0,0,0,0,0);
PutPlayerInVehicle(playerid,Car,0);
Reply
#4

pawn Код:
if(!strcmp(cmdtext, "/infernus", true))
{
    new Float:PPosX, Float:PPosY, Float:PPosZ, infernus;
    GetPlayerPos(playerid, PPosX, PPosY, PPosZ);
    infernus = CreateVehicle(411, PPosX, PPosY, PPosZ, 0, 1, 0, 1000);
    PutPlayerInVehicle(playerid, infernus, 1);
}
Reply
#5

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You need to create a vehicle, store the vehicleid and then use the vehicleid instead of 411 in PutPlayerInVehiclle function. The second parameter of it needs the vehicleid, not the modelid.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/infernus", cmdtext, true))
    {
        new Float:x, Float:y, Float:z, Float:a, vehicle;
        GetPlayerPos(playerid,x,y,z);
        GetPlayerFacingAngle(playerid, a);
        vehicle = CreateVehicle(411, x, y, z, a, -1, -1, 60);
        PutPlayerInVehicle(playerid, vehicle, 0);
        SendClientMessage(playerid, 0xADD8E6FF, "You have been teleported Infernus to your position.");
        return 1;
    }
    return 0;
}
Thank's! its working about the PutPlayerInVehicle, im just trying it i didn't really know what im doing,
You really help me!. Have a nice day,.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)