RC command help
#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


Messages In This Thread
RC command help - by MichaelWharton101 - 26.03.2013, 22:00
Re: RC command help - by MichaelWharton101 - 26.03.2013, 22:03
Re: RC command help - by MichaelWharton101 - 26.03.2013, 22:55
Re: RC command help - by SilverKiller - 27.03.2013, 00:10
Re: RC command help - by MichaelWharton101 - 27.03.2013, 01:09
Re: RC command help - by MichaelWharton101 - 27.03.2013, 01:25
Re: RC command help - by SilverKiller - 27.03.2013, 07:52
Re: RC command help - by MichaelWharton101 - 27.03.2013, 22:57
Re: RC command help - by SilverKiller - 27.03.2013, 23:00

Forum Jump:


Users browsing this thread: 1 Guest(s)