17.06.2012, 21:16
Is possibile to put a NPC in a vehicle while he's on foot?
|
You should be able to apply normal player functions to NPCs from your gamemode, so I don't think it should be a problem.
Also, judging by this, it should be fine. |
CMD:getonmyhorse(playerid, params[]) {
new
iVehicle = 6,
iSeat = 0,
szPlayerName[MAX_PLAYER_NAME];
foreach(Bot, i) {
GetPlayerName(i, szPlayerName, MAX_PLAYER_NAME);
if(!strcmp(szPlayerName, "Dexter", false)) {
PutPlayerInVehicle(i, iVehicle, iSeat);
}
}
return 1;
}
public OnFilterScriptInit()
{
ConnectNPC("Dexter", "mynpc");
return 1;
}
CMD:npcinvehicle(playerid, params[])
{
new target;
if(sscanf(params, "d", target)) return SendClientMessage(playerid, -1 , " syntax: /npcinvehicle [npcid] ");
if(IsPlayerNPC(target))
{
if(IsPlayerInAnyVehicle(playerid))
{
new vehicle = GetPlayerVehicleID(playerid);
new szPlayerName[MAX_PLAYER_NAME];
foreach(Bot, i)
{
GetPlayerName(i, szPlayerName, MAX_PLAYER_NAME);
if(!strcmp(szPlayerName, "Dexter", false)) {
PutPlayerInVehicle(i, vehicle, 1);
}
}
}
}
return 1;
}
CMD:npcinvehicle(playerid, params[])
{
new target;
if(sscanf(params, "d", target)) return SendClientMessage(playerid, -1 , " syntax: /npcinvehicle [npcid] ");
if(IsPlayerNPC(target))
{
if(IsPlayerInAnyVehicle(playerid))
{
new vehicle = GetPlayerVehicleID(playerid);
new szPlayerName[MAX_PLAYER_NAME];
GetPlayerName(target, szPlayerName, MAX_PLAYER_NAME);
if(!strcmp(szPlayerName, "Dexter", false)) {
PutPlayerInVehicle(target, vehicle, 1);
}
}
}
return 1;
}