05.06.2013, 15:10
(
Последний раз редактировалось Joksa; 04.08.2013 в 22:41.
)
Hi everyone does anyone know how I can get the position of certain NPC?
I use this FS and want a player when you type the command to know where the NPC bus driver.
pawn Код:
#define FILTERSCRIPT
#include <a_samp>
#if defined FILTERSCRIPT
new DevilBusNPCVehicle;
new BV , BV2;
new CP , CP2 , CP3 , CP4 , CP5 , CP6 , CP7 , CP8;
public OnFilterScriptInit()
{
print("NPC botovi su učitani uspeљno!");
ConnectNPC("Bus_Vozac","BusT1");
ConnectNPC("DevilBusNPC","mynpc");
ConnectNPC("Bus_Vozac2","BVPD1");
DevilBusNPCVehicle = CreateVehicle(431, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
BV = CreateVehicle(431,2040.0071,1353.2748,10.7725,1.0379,92,72,5000);
BV2 = CreateVehicle(431,1535.7441,-1675.1138,13.4873,0.0120,71,59,5000);
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#else
main()
{
print("\n----------------------------------");
print("");
print("----------------------------------\n");
}
#endif
public OnGameModeInit()
{
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerConnect(playerid)
{
GivePlayerMoney(playerid,100000);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid))
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname));
if(!strcmp(npcname, "Bus_Vozac", true))
{
PutPlayerInVehicle(playerid, BV, 0);
}
else if(!strcmp(npcname, "DevilBusNPC", true))
{
PutPlayerInVehicle(playerid, DevilBusNPCVehicle, 0);
}
else if(!strcmp(npcname, "Bus_Vozac2", true))
{
PutPlayerInVehicle(playerid, BV2, 0);
}
return 1;
}
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/PKPD", cmdtext, true, 10) == 0)
{
CP = SetPlayerCheckpoint(playerid,1535.8690,-1672.0857,13.3828,2);
return 1;
}
if (strcmp("/busplusinfo", cmdtext, true, 10) == 0)
{
new Float:x,Float:y,Float:z;
//How to get the Pos of NPC???
SetPlayerCheckpoint(playerid,x,y,z,2);
SendClientMessage(playerid,0xFFFFFFFF,"----------BusPlus Sistem (2013)----------");
SendClientMessage(playerid,0xFFFFFFFF,"Pozicija autobusa ti je označena na mapi");
SendClientMessage(playerid,0xFFFFFFFF,"----------BusPlus Sistem (2013)----------");
SetTimer("DCP",5000,0);
return 1;
}
return 0;
}
forward DCP(playerid);
public DCP(playerid)
{
DisablePlayerCheckpoint(playerid);
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehid = GetPlayerVehicleID(playerid);
new playerState = GetPlayerState(playerid);
if (playerState == PLAYER_STATE_PASSENGER)
{
if(vehid == BV)
{
GivePlayerMoney(playerid, -10);
SendClientMessage(playerid,0xFFFFFFFF,"Dobro dosli u Bus Plus autobus uzivajte u voznji.");
}
}
return 1;
}