Help NPC
#1

Help Please

Error:
Код:
C:\Users\Mush\Desktop\gm\filterscripts\bus.pwn(449) : error 029: invalid expression, assumed zero
Code in gm:
Код:
new Float:busx, Float:busy, Float:busz, Float:angle;
                if(BusID[playerid] == 1)
                {
                    GetVehiclePos(NPCBlueBus, busx, busy, busz);
                    GetVehicleZAngle(NPCBlueBus, angle);
                }
                else
                {
                    GetVehiclePos(NPCBlackBus, busx, busy, busz);
                    GetVehicleZAngle(NPCBlackBus, angle);
                }
                else
                {
                    GetVehiclePos(NPCRedBus, busx, busy, busz);
                    GetVehicleZAngle(NPCRedBus, angle);
                }
Reply
#2

Код:
if(BusID[playerid] == 1)
{
    GetVehiclePos(NPCBlueBus, busx, busy, busz);
    GetVehicleZAngle(NPCBlueBus, angle);
}
else
{
    GetVehiclePos(NPCBlackBus, busx, busy, busz);
    GetVehicleZAngle(NPCBlackBus, angle);
}
Use 'else if' if you need to add more checks.

Review https://sampwiki.blast.hk/wiki/Control_Structures

EDIT: Just realized that code does the same thing in both blocks, because you dont change the variables 'NPCBlueBus', 'busx', 'busy' and 'busz'. So it will not do what you want it to.
Reply
#3

blue and black bus with the bus go , but when you put it on the red bus gives me error,and the error pawno else if I give my close
Reply
#4

Oh yes i missed that.

Set it up like this:

Код:
if(BusID[playerid] == 1)
{
    GetVehiclePos(NPCBlueBus, busx, busy, busz);
    GetVehicleZAngle(NPCBlueBus, angle);
}
else if(BusID[playerid] == 2)//change '2' to the blackbus id
{
    GetVehiclePos(NPCBlackBus, busx, busy, busz);
    GetVehicleZAngle(NPCBlackBus, angle);
}
else if(BusID[playerid] == 3)//change '3' to the blackbus id
{
    GetVehiclePos(NPCRedBus, busx, busy, busz);
    GetVehicleZAngle(NPCRedBus, angle);
}
else
{
    //it's not a black, blue or red bus
}
Will be easier to read/edit if you define the constants.

Код:
#define NPC_BLUE_BUS 1

//then you can do
if(BusID[playerid] == NPC_BLUE_BUS)
Reply
#5

thanks man, I have a misunderstanding if you can help me how can I change a file from rec npcmodes
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)