25.12.2013, 17:46
Hi,
I would like that my NPC may have id skin 253 for bus System but doesn't work with my source code below because my NPC have a CJ default skin. I would also my NPC and bus vehicle must stop when player approching.
Do you have link or can you offer your help ?
Thanks and merry christmas.
I would like that my NPC may have id skin 253 for bus System but doesn't work with my source code below because my NPC have a CJ default skin. I would also my NPC and bus vehicle must stop when player approching.
Do you have link or can you offer your help ?
Thanks and merry christmas.
Код:
#define FILTERSCRIPT
#include <a_samp>
new bus1, bus2;
new idnpc[2];
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" NPC BUS FILTERSCRIPT");
print("--------------------------------------\n");
// NPCS
ConnectNPC("chauffeura","busa");
ConnectNPC("chauffeurb","busb");
bus1 = CreateVehicle(431,-2002.5649,166.4715,27.6280,0.2747,6,1,5000);
bus2 = CreateVehicle(431,-2002.4308,123.6647,27.6393,359.6707,6,1,5000);
SetTimer("BusCollision",1000,1);
return 1;
}
forward BusCollision();
public BusCollision() {
new Float:x, Float:y, Float:z;
//printf("TIMER BUS COLLISION");
for(new i=0;i<2;i++) {
GetPlayerPos(idnpc[i], x, y, z);
//printf("BOT %d : POSITION %d %d %d",idnpc[i], x, y, z);
if(IsPlayerInRangeOfPoint(idnpc[i], 7.0, x, y, z)) {
new Float:X, Float:Y, Float:Z, VehicleID;
//printf("ATTENTION COLLISION !!!");
VehicleID = GetPlayerVehicleID(idnpc[i]);
GetVehicleVelocity(VehicleID, X, Y, Z);
SetVehicleVelocity(VehicleID, -X, -Y, -Z);
} else {
new Float:X, Float:Y, Float:Z, VehicleID;
VehicleID = GetPlayerVehicleID(idnpc[i]);
GetVehicleVelocity(VehicleID, X, Y, Z);
SetVehicleVelocity(VehicleID, 20, 20, 20);
}
}
}
public OnFilterScriptExit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid))
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname));
SetPlayerSkin(playerid, 253);
if(!strcmp(npcname, "chauffeura", true))
{
PutPlayerInVehicle(playerid, bus1, 0);
idnpc[0] = playerid;
}
else if(!strcmp(npcname, "chauffeurb", true))
{
PutPlayerInVehicle(playerid, bus2, 0);
idnpc[1] = playerid;
}
SpawnPlayer(playerid);
return 1;
}
return 1;
}

