SA-MP Forums Archive
Help - CommandText - 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: Help - CommandText (/showthread.php?tid=464498)



Help - CommandText - wakeuptomer - 17.09.2013

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!


Re: Help - CommandText - Konstantinos - 17.09.2013

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;
}



Re: Help - CommandText - Marshall32 - 17.09.2013

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);


Re: Help - CommandText - alinategh - 17.09.2013

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);
}



Re: Help - CommandText - wakeuptomer - 17.09.2013

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