SA-MP Forums Archive
[HELP] Tunecar by 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: [HELP] Tunecar by command (/showthread.php?tid=195987)



[HELP] Tunecar by command - Larsey123IsMe - 04.12.2010

I did something wrong, and IDK how to fix it =/

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/MyCommand", true) == 0)
    {
        if(IsPlayerInVehicle(playerid, 420 && 431))
        {
            if(IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid,0x00FF00AA,"You're not in a vehicle.");
            SendClientMessage(playerid,0xFFFFFFFFF,"Your veh have been tuned!");
            ChangeVehicleColor(vehicleid, 103, 103); //Here
            AddVehicleComponent(vehicleid,1010); //Here
            AddVehicleComponent(vehicleid,1001); //Here
            AddVehicleComponent(vehicleid,1076); //Here
            AddVehicleComponent(vehicleid,1012); //Here
        }
        return 1;
    }
    return 0;
}
ERROR:
pawn Код:
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\Taxi.pwn(21) : error 017: undefined symbol "vehicleid"
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\Taxi.pwn(22) : error 017: undefined symbol "vehicleid"
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\Taxi.pwn(23) : error 017: undefined symbol "vehicleid"
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\Taxi.pwn(24) : error 017: undefined symbol "vehicleid"
C:\Users\Larsey123\Documents\SAMP Server\My server\filterscripts\Taxi.pwn(25) : error 017: undefined symbol "vehicleid"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


5 Errors.



Re: [HELP] Tunecar by command - iggy1 - 04.12.2010

pawn Код:
if(IsPlayerInVehicle(playerid, 420 && 431))
You do know a player cant be in two vehicles at the same time?
make that
pawn Код:
if(IsPlayerInVehicle(playerid, 431)||IsPlayerInVehicle(playerid, 420))
EDIT: Fix
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/MyCommand", true) == 0)
    {
        if(IsPlayerInVehicle(playerid, 431)||IsPlayerInVehicle(playerid, 420))
        {
            new vehicleid = GetPlayerVehicleID(playerid);
            if(IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid,0x00FF00AA,"You're not in a vehicle.");
            SendClientMessage(playerid,0xFFFFFFFFF,"Your veh have been tuned!");
            ChangeVehicleColor(vehicleid, 103, 103);
            AddVehicleComponent(vehicleid,1010); //Nitro
            AddVehicleComponent(vehicleid,1001); //Spoiler-Win
            AddVehicleComponent(vehicleid,1076); //Wheels-Wires
            AddVehicleComponent(vehicleid,1012); //Hood-Worx-Scoop
        }
        return 1;
    }
    return 0;
}



Re: [HELP] Tunecar by command - Larsey123IsMe - 04.12.2010

LoL Thanks, i have edited my post now, evry lines with //Here is an error


Re: [HELP] Tunecar by command - rjjj - 04.12.2010

I fixed your code:


pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/MyCommand", true) == 0)
    {
        if(IsPlayerInVehicle(playerid, 420 && 431))
        {
            if(IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid,0x00FF00AA,"You're not in a vehicle.");
            SendClientMessage(playerid,0xFFFFFFFFF,"Your veh have been tuned!");
            new vehicleid = GetPlayerVehicleID(playerid);//I put it and the problem was fixed ;D
            ChangeVehicleColor(vehicleid, 103, 103); //Here
            AddVehicleComponent(vehicleid,1010); //Here
            AddVehicleComponent(vehicleid,1001); //Here
            AddVehicleComponent(vehicleid,1076); //Here
            AddVehicleComponent(vehicleid,1012); //Here
        }
        return 1;
    }
    return 0;
}

I hope i have helped


Re: [HELP] Tunecar by command - iggy1 - 04.12.2010

That wont work check the edit in my post for a fix.
pawn Код:
if(IsPlayerInVehicle(playerid, 420 && 431))// i mean realy? if player is in model 420 and 431?



Re: [HELP] Tunecar by command - Larsey123IsMe - 04.12.2010

Thanks


Re: [HELP] Tunecar by command - The_Gangstas - 04.12.2010

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/MyCommand", true) == 0)
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0x00FF00AA,"You're not in a vehicle.");
        if(IsPlayerInVehicle(playerid, 420) || IsPlayerInVehicle(playerid,431))
        {
            SendClientMessage(playerid,0xFFFFFFFFF,"Your veh have been tuned!");
            new vehicleid = GetPlayerVehicleID(playerid);//I put it and the problem was fixed ;D
            ChangeVehicleColor(vehicleid, 103, 103); //Here
            AddVehicleComponent(vehicleid,1010); //Here
            AddVehicleComponent(vehicleid,1001); //Here
            AddVehicleComponent(vehicleid,1076); //Here
            AddVehicleComponent(vehicleid,1012); //Here
        }
        return 1;
    }
    return 0;
}



Re: [HELP] Tunecar by command - iggy1 - 04.12.2010

Quote:
Originally Posted by The_Gangstas
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/MyCommand", true) == 0)
    {
        if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,0x00FF00AA,"You're not in a vehicle.");
        if(IsPlayerInVehicle(playerid, 420) || IsPlayerInVehicle(playerid,431))
        {
            SendClientMessage(playerid,0xFFFFFFFFF,"Your veh have been tuned!");
            new vehicleid = GetPlayerVehicleID(playerid);//I put it and the problem was fixed ;D
            ChangeVehicleColor(vehicleid, 103, 103); //Here
            AddVehicleComponent(vehicleid,1010); //Here
            AddVehicleComponent(vehicleid,1001); //Here
            AddVehicleComponent(vehicleid,1076); //Here
            AddVehicleComponent(vehicleid,1012); //Here
        }
        return 1;
    }
    return 0;
}
LMAO look in all the above solutions. (sorry i had to post that)


Re: [HELP] Tunecar by command - Larsey123IsMe - 04.12.2010

When i am in vehicle ID
420 //taxi
or
431 //bus
Then it dont get tuned, why not?
....
and i want it to say "This is not a bus/taxi, so you cant tune this" if he is in other vehicles that the Bus/taxi


Re: [HELP] Tunecar by command - papedo - 04.12.2010

try this... this should work
Код:
command(tune,playerid,params[]) //zcmd, change to whatever.
{
     if(GetVehicleModel(GetPlayerVehicleID(playerid)) != 420 || GetVehicleModel(GetPlayerVehicleID(playerid)) != 431)
     {
           new vehicleid = GetPlayerVehicleID(playerid);// probably not needed but i cbf re-doing the whole command
           ChangeVehicleColor(vehicleid, 103, 103);
           AddVehicleComponent(vehicleid,1010);
           AddVehicleComponent(vehicleid,1001);
           AddVehicleComponent(vehicleid,1076);
           AddVehicleComponent(vehicleid,1012);

           return 1;
      }
      SendClientMessage(playerid,COLOR,"You cannot tune this vehicle! (bus/taxi)");
      return 1;
}