SA-MP Forums Archive
Adding a AddVehicleComponent Command - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Adding a AddVehicleComponent Command (/showthread.php?tid=274124)



Adding a AddVehicleComponent Command - Bonez84 - 04.08.2011

So I'm trying to make some Commands for Admins
if they type
I would like it to work in any vehicle

/lowrider they get

Hydraulics ID 1087 & Wheels ID 1076

or

/runner they get

Nos ID 1010 & Wheels ID 1097


Re: Adding a AddVehicleComponent Command - [HiC]TheKiller - 04.08.2011

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/lowrider", cmdtext, true)
    {
        AddVehicleComponent(GetPlayerVehicleID(playerid), 1087);
        AddVehicleComponent(GetPlayerVehicleID(playerid), 1076);
        return SendClientMessage(playerid, -1, "Low rider car modified!");
    }
    if(!strcmp("/runner", cmdtext, true)
    {
        AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
        AddVehicleComponent(GetPlayerVehicleID(playerid), 1097);
        return SendClientMessage(playerid, -1, "Runner car modified!");
    }
    return 0;
}
You may also want to check around for the IsVehicleModdable function.


Re: Adding a AddVehicleComponent Command - Bonez84 - 04.08.2011

Thx alot, Oh I forgot what if I only want an admin to be able to use it ?


Re: Adding a AddVehicleComponent Command - Bonez84 - 04.08.2011

file(92) : error 001: expected token: ")", but found "{"
file(9 : error 001: expected token: ")", but found "{"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.


AW: Adding a AddVehicleComponent Command - Drebin - 04.08.2011

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/lowrider", cmdtext, true))
    {
        AddVehicleComponent(GetPlayerVehicleID(playerid), 1087);
        AddVehicleComponent(GetPlayerVehicleID(playerid), 1076);
        return SendClientMessage(playerid, -1, "Low rider car modified!");
    }
    if(!strcmp("/runner", cmdtext, true))
    {
        AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
        AddVehicleComponent(GetPlayerVehicleID(playerid), 1097);
        return SendClientMessage(playerid, -1, "Runner car modified!");
    }
    return 0;
}



Re: Adding a AddVehicleComponent Command - Bonez84 - 04.08.2011

what was the difference ?
ahh the extra ) behind the others


Re: Adding a AddVehicleComponent Command - Bonez84 - 05.08.2011

does this not work with Quad vehicle ID 471 ?


AW: Re: Adding a AddVehicleComponent Command - Drebin - 05.08.2011

Quote:
Originally Posted by Bonez84
Посмотреть сообщение
does this not work with Quad vehicle ID 471 ?
No, the Quad is a vehicle you can not add wheels or nos to.


Re: Adding a AddVehicleComponent Command - Toreno - 05.08.2011

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    //if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You are not admin!");
    // This toggles all your commands, and only admin can use them.
    // If you prefer to set each command if he's not admin or not, then check the method below.
    if(!strcmp("/lowrider", cmdtext, true))
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You are not admin!");
        AddVehicleComponent(GetPlayerVehicleID(playerid), 1087);
        AddVehicleComponent(GetPlayerVehicleID(playerid), 1076);
        return SendClientMessage(playerid, -1, "Low rider car modified!");
    }
    if(!strcmp("/runner", cmdtext, true))
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You are not admin!");
        AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
        AddVehicleComponent(GetPlayerVehicleID(playerid), 1097);
        return SendClientMessage(playerid, -1, "Runner car modified!");
    }
    return 0;
}



Re: Adding a AddVehicleComponent Command - iPLEOMAX - 05.08.2011

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp("/lowrider", cmdtext, true))
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You are not an admin!");
        AddVehicleComponent(GetPlayerVehicleID(playerid), 1087);
        AddVehicleComponent(GetPlayerVehicleID(playerid), 1076);
        return SendClientMessage(playerid, -1, "Low rider car modified!");
    }
    if(!strcmp("/runner", cmdtext, true))
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You are not an admin!");
        AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
        AddVehicleComponent(GetPlayerVehicleID(playerid), 1097);
        return SendClientMessage(playerid, -1, "Runner car modified!");
    }
    return 0;
}
Edited Killer's post.