My npc wont talk on player entry
#1

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
Reply
#2

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

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;
}
Reply
#4

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.
Reply
#5

Is there any scripting documentation that can be recomended?
Reply
#6

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.
Reply
#7

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?
Reply
#8

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
Reply
#9

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


Forum Jump:


Users browsing this thread: 1 Guest(s)