SA-MP Forums Archive
My npc wont talk on player entry - 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: My npc wont talk on player entry (/showthread.php?tid=290749)



My npc wont talk on player entry - Jagofr - 16.10.2011

Hey I'm trying to make my NPC talk when a person enters its vehicle can someone correct this script for me I use it and it doesnt work
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new seatno;
    new VehID;
    VehID = GetPlayerVehicleID(playerid);
    seatno = GetPlayerVehicleSeat(playerid);
    if(VehID > Taxi){
   
        if(seatno > 1) return SendClientMessage(playerid, 0xFFFFFFFF ," I am Driveress. I take you to all the airports in San Andreas. My driiving skill was based on an NRG-500. That is why I might drive poorly.");
        if(seatno > 2) return SendClientMessage(playerid, 0xFFFFFFFF ," I am Driveress. I take you to all the airports in San Andreas. My driiving skill was based on an NRG-500. That is why I might drive poorly.");
        if(seatno > 3) return SendClientMessage(playerid, 0xFFFFFFFF ," I am Driveress. I take you to all the airports in San Andreas. My driiving skill was based on an NRG-500. That is why I might drive poorly.");
        if(seatno > 0) return SetPlayerHealth(playerid, 0); SendClientMessage(playerid, 0xFFFFFF, "How can you jack an NPC's CAR?!"); PutPlayerInVehicle(0, Taxi, 0);
    }
    return 1;
}
Please help Thanks.
Oh! I forgot to add that I put that script extract in the NPC filterscript i created


Re: My npc wont talk on player entry - [MG]Dimi - 16.10.2011

WHy are you getting vehicleid when you have it inside param? also VehID > Taxi means?


Re: My npc wont talk on player entry - SuperViper - 16.10.2011

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new seatno = GetPlayerVehicleSeat(playerid);
    if(vehicleid == Taxi){
   
        if(seatno > 1) return SendClientMessage(playerid, 0xFFFFFFFF ," I am Driveress. I take you to all the airports in San Andreas. My driiving skill was based on an NRG-500. That is why I might drive poorly.");
        if(seatno > 2) return SendClientMessage(playerid, 0xFFFFFFFF ," I am Driveress. I take you to all the airports in San Andreas. My driiving skill was based on an NRG-500. That is why I might drive poorly.");
        if(seatno > 3) return SendClientMessage(playerid, 0xFFFFFFFF ," I am Driveress. I take you to all the airports in San Andreas. My driiving skill was based on an NRG-500. That is why I might drive poorly.");
        if(seatno > 0) return SetPlayerHealth(playerid, 0); SendClientMessage(playerid, 0xFFFFFF, "How can you jack an NPC's CAR?!"); PutPlayerInVehicle(0, Taxi, 0);
    }
    return 1;
}



Re: My npc wont talk on player entry - Jagofr - 16.10.2011

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    new seatno = GetPlayerVehicleSeat(playerid);
    if(vehicleid == Taxi){
   
        if(seatno > 1) return SendClientMessage(playerid, 0xFFFFFFFF ," I am Driveress. I take you to all the airports in San Andreas. My driiving skill was based on an NRG-500. That is why I might drive poorly.");
        if(seatno > 2) return SendClientMessage(playerid, 0xFFFFFFFF ," I am Driveress. I take you to all the airports in San Andreas. My driiving skill was based on an NRG-500. That is why I might drive poorly.");
        if(seatno > 3) return SendClientMessage(playerid, 0xFFFFFFFF ," I am Driveress. I take you to all the airports in San Andreas. My driiving skill was based on an NRG-500. That is why I might drive poorly.");
        if(seatno > 0) return SetPlayerHealth(playerid, 0); SendClientMessage(playerid, 0xFFFFFF, "How can you jack an NPC's CAR?!"); PutPlayerInVehicle(0, Taxi, 0);
    }
    return 1;
}
It only does the last one.. Im trying to edit it though but if I get a responce I would appriciate it.


Re: My npc wont talk on player entry - Jagofr - 17.10.2011

Is there any scripting documentation that can be recomended?


Re: My npc wont talk on player entry - [Diablo] - 17.10.2011

why not use ispassenger?

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(vehicleid == Taxi)
    {
        if(ispassenger)
        {
            SendClientMessage(playerid, 0xFFFFFFFF ," I am Driveress. I take you to all the airports in San Andreas. My driiving skill was based on an NRG-500. That is why I might drive poorly.");
        }
        else
        {
           // code to execute if player tries to hijack the car..
        }
    }  
    return 1;
}
- not tested, because i'm still at work, but something like that would do the trick.


Re: My npc wont talk on player entry - Jagofr - 17.10.2011

Quote:
Originally Posted by [MG]Dimi
Посмотреть сообщение
WHy are you getting vehicleid when you have it inside param? also VehID > Taxi means?
VehID > Taxi Means the car the bot drives. Why do you even need to know that? Dont you just need the snippet that I posted?


Re: My npc wont talk on player entry - Jagofr - 17.10.2011

Quote:
Originally Posted by [Diablo]
Посмотреть сообщение
why not use ispassenger?

pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if(vehicleid == Taxi)
    {
        if(ispassenger)
        {
            SendClientMessage(playerid, 0xFFFFFFFF ," I am Driveress. I take you to all the airports in San Andreas. My driiving skill was based on an NRG-500. That is why I might drive poorly.");
        }
        else
        {
           // code to execute if player tries to hijack the car..
        }
    }  
    return 1;
}
- not tested, because i'm still at work, but something like that would do the trick.
Dont worry to test it man it works,.. Thanks So that I dont run into this problem again is there a docummentation you used or just common knowledge Because I kinda new to scripting


Re: My npc wont talk on player entry - [Diablo] - 17.10.2011

no problem
and link to docs -> https://sampforum.blast.hk/showthread.php?tid=92