simple NPC script - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: simple NPC script (
/showthread.php?tid=392094)
simple NPC script -
MatZZPL - 12.11.2012
Hi, could anyone create a simple npc script that i can put in my gamemode ?
Simply connect the NPC to the server then just play the same .rec file when it finishes once, play it again.
The record i made was /vrecord so only a vehicle. Just need the vehicle to drive around, can anyone create the code for me? I tried doing it for hours its just not happening.
I will +rep you for rest of ur lifeeeee!
Re: simple NPC script -
Deron_Green - 12.11.2012
Whats the NPC's name and the recordings name?
Re: simple NPC script -
MatZZPL - 12.11.2012
NPC name Johnny_Driver and recording name bus1

Could anyone help ? Please?
Re: simple NPC script -
Deron_Green - 13.11.2012
Add something like this into your script but change the xyz's with your own and if you have any questions feel free to PM me
pawn Код:
new Bus;
public OnGameModeInit()
{
ConnectNPC("Johnny_Driver","bus1");
Bus = AddStaticVehicle(431,x, y, z, float,0,0);
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
new playername[64];
GetPlayerName(playerid,playername,64);
if(!strcmp(playername,"Johnny_Driver",true))
{
SetSpawnInfo(playerid,69,61,x,y,z,0.0,-1,-1,-1,-1,-1,-1);
}
return 1;
}
public OnPlayerSpawn(playerid)
{
new playername[64];
GetPlayerName(playerid,playername,64);
if(!strcmp(playername,"Johnny_Driver",true))
{
PutPlayerInVehicle(playerid, Bus, 0);
SetPlayerColor(playerid,0xFF0000FF);
}
}
stock SetVehicleTireStatus(vehicleid, tirestatus)
{
new panels, doors, lights, tires;
GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, tirestatus);
}