RC command help
#1

So I need a command that will allow me to enter a RC car with a command like /rc and it will put me into the RC car.
Reply
#2

Oh and if i was to type the command when in the RC car it would also exit me then
Reply
#3

Need help very bad please
Reply
#4

pawn Код:
new RC[MAX_PLAYERS]; // At top
The command (strcmp) :

pawn Код:
if (strcmp("/RC", cmdtext, true, 10) == 0)
{
    if(RC[playerid] == 0)
    {
        new Float:X, Float:Y, Float:Z, Float:Angle;
        GetPlayerPos(playerid, X, Y, Z);
        GetPlayerFacingAngle(playerid, Angle);                
        new RCCAR = CreateVehicle(441, X, Y, Z, Angle, 0, 1, 60);
        PutPlayerInVehicle(playerid, RCCAR, 0);
        SendClientMessage(playerid, -1, "You are now in a RC car, type /rc again to exit it.");
        RC[playerid] = 1;
        return 1;
    }
    else if(RC[playerid] == 1)
    {
        new Float:X, Float:Y, Float:Z, Float:Angle;
        GetPlayerPos(playerid, X, Y, Z);
        GetPlayerFacingAngle(playerid, Angle);  
        new RCCAR = CreateVehicle(441, X, Y, Z, Angle, 0, 1, 60);
        DestroyVehicle(RCCAR);
        SendClientMessage(playerid, -1, "You exited the RC car!");
        RC[playerid] = 0;
        return 1;
    }
    return 1;
}
The command (ZCMD) :

pawn Код:
CMD:RC(playerid, params[])
{
    if(RC[playerid] == 0)
    {
        new Float:X, Float:Y, Float:Z, Float:Angle;
        GetPlayerPos(playerid, X, Y, Z);
        GetPlayerFacingAngle(playerid, Angle);                
        new RCCAR = CreateVehicle(441, X, Y, Z, Angle, 0, 1, 60);
        PutPlayerInVehicle(playerid, RCCAR, 0);
        SendClientMessage(playerid, -1, "You are now in a RC car, type /rc again to exit it.");
        RC[playerid] = 1;
        return 1;
    }
    else if(RC[playerid] == 1)
    {
        new Float:X, Float:Y, Float:Z, Float:Angle;
        GetPlayerPos(playerid, X, Y, Z);
        GetPlayerFacingAngle(playerid, Angle);  
        new RCCAR = CreateVehicle(441, X, Y, Z, Angle, 0, 1, 60);
        DestroyVehicle(RCCAR);
        SendClientMessage(playerid, -1, "You exited the RC car!");
        RC[playerid] = 0;
        return 1;
    }
    return 1;
}
Untested, but should work

Next time ask on : https://sampforum.blast.hk/showthread.php?tid=413556
Reply
#5

Thank you so much, I am busty right now but I will let you know if it works when I get a chance
Reply
#6

Okay, I have tested it and it is almost perfect, A few things wrong with it... On /rc when in the RC car it gives me the message i had exit but did not. Also I want it to put me in a RC car that is spawned already, not create a RC car. I am using ZCMD btw
Reply
#7

Try to remove the 2nd return 1; (the one in the else part) and test it..

for putting it in a spawned RC car.. i can't do it cause i'm on mobile...

EDIT : My bad... i tested the command, i did some mistakes, here is the fixed one! :

pawn Код:
CMD:RC(playerid, params[])
{
    if(RC[playerid] == 0)
    {
        new Float:X, Float:Y, Float:Z, Float:Angle;
        GetPlayerPos(playerid, X, Y, Z);
        GetPlayerFacingAngle(playerid, Angle);                
        new RCCAR = CreateVehicle(441, X, Y, Z, Angle, 0, 1, 60);
        PutPlayerInVehicle(playerid, RCCAR, 0);
        SendClientMessage(playerid, -1, "You are now in a RC car, type /rc again to exit it.");
        RC[playerid] = 1;
        return 1;
    }
    else if(RC[playerid] == 1)
    {
        new Float:X, Float:Y, Float:Z, Float:Angle;
        GetPlayerPos(playerid, X, Y, Z);
        GetPlayerFacingAngle(playerid, Angle);  
        new RCCAR = CreateVehicle(441, X, Y, Z, Angle, 0, 1, 60);
        PutPlayerInVehicle(playerid, RCCAR, 0);
        DestroyVehicle(RCCAR);
        SendClientMessage(playerid, -1, "You exited the RC car!");
        RC[playerid] = 0;
    }
    return 1;
}
Reply
#8

Okay will test when I get the chance, any idea how I could make it put me into the rc but not create one?
Reply
#9

Quote:
Originally Posted by MichaelWharton101
Посмотреть сообщение
Okay will test when I get the chance, any idea how I could make it put me into the rc but not create one?
If you mean one in the gamemode itself, then i can't do that..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)