08.07.2012, 14:44
(
Последний раз редактировалось RedFusion; 08.07.2012 в 14:53.
Причина: Pics
)
Hey, this is going to be my first tutorial on this forum so don't be harsh!
This tutorial is made for newbies.
In this tutorial i will show you readers how to make Repair & Nos pickups for cars.


Add this first of all.
repairpickup and nospickup is what we will call our pickups.
This will print Pickup FS in the serverconsole, and spawn the pickups.
This will destroy the pickups when you unload your filterscript.
This will add the respawner functions. Replace X,Y,Z with your own coords.
nospick and repairpickup is what we added earlier and they are made for asigning an ID to the pickups, which we can use for using, respawning and deleting the pickups.
CreatePickup(Model,type,X,Y,Z,Virtual world)
The model is what it looks like.
1240 is a heart.
1009 is a NOS tube.
The type is how it will work.
Type 14 means that it will only work when the player picks it up with a car.
X,Y,Z is the coords. X is horizontal, Y is Vertical and Z is height.
Moving on.
This is what will happen when you pickup the pickups.
First of it checks if you picked up the nospickup. If you did; It proceeds.
it checks if you are in a vehicle, if you are; it proceeds.
it checks if you are the driver of the vehicle, if you are; it proceeds, again.
This is the point where it checks which VehicleID you have. If you dont have any of those above it proceeds.
But if you do you get the message "You can not add nos to this vehicle"
Those ID's above are Planes, Helis, Bikes and bicycles and some other misc. vehicles.
This adds NOS to your vehicle
This is for the Repair pickup. The first one sets your carhealth to 1000,
GetPlayerVehicleID detects what ID your car has that you sit in at the moment.
And RepairVehicle repairs the visual damage (components)
This Destroys the NOS pickup
This spawns it again.
This executes a sound.
Full script here.
This tutorial is made for newbies.
In this tutorial i will show you readers how to make Repair & Nos pickups for cars.


pawn Код:
#define filterscript
#include <a_samp>
new repairpickup, nospickup;
repairpickup and nospickup is what we will call our pickups.
pawn Код:
public OnFilterScriptInit()
{
print("Pickup FS");
respawnnos();
respawnrepair();
return 1;
}
pawn Код:
public OnFilterScriptExit()
{
DestroyPickup(nospickup);
DestroyPickup(repairpickup);
return 1;
}
pawn Код:
forward respawnnos();
public respawnnos()
{
nospickup = CreatePickup(1009,14,X,Y,Z,-1);//NOS
}
forward respawnrepair();
public respawnrepair()
{
repairpickup = CreatePickup(1240,14,X,Y,Z,-1);//Repair
}
nospick and repairpickup is what we added earlier and they are made for asigning an ID to the pickups, which we can use for using, respawning and deleting the pickups.
CreatePickup(Model,type,X,Y,Z,Virtual world)
The model is what it looks like.
1240 is a heart.
1009 is a NOS tube.
The type is how it will work.
Type 14 means that it will only work when the player picks it up with a car.
X,Y,Z is the coords. X is horizontal, Y is Vertical and Z is height.
Moving on.
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == nospickup)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
DestroyPickup(nospickup);
SetTimer("respawnnos",500,false);
switch(GetVehicleModel( GetPlayerVehicleID(playerid) ))
{
case 449,448,461,462,463,468,471,509,510,521,522,523,581,586,481,450,441,464,465,501,564,594,611,610,608,607,606,595,592,593,591,590,584,577,570,569,563,554,548,538,537,520,519,513,512,511,497,493,488,487,484,476,473,472,496,460,452,447,446,435,432,430,417,409,407:
return SendClientMessage(playerid,0xFF0000AA,"You can not add nos to this vehicle!");
}
AddVehicleComponent(GetPlayerVehicleID(playerid),1010);
PlayerPlaySound(playerid,1133,0.0,0.0,0.0);
}
}
}
if(pickupid == repairpickup)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
DestroyPickup(repairpickup);
SetTimer("respawnrepair",500,false);
switch(GetVehicleModel( GetPlayerVehicleID(playerid) ))
{
case 509,510,481,449,450,441,464,465,501,564,594,611,610,608,607,606,595,592,593,591,590,584,577,570,569,563,554,548,538,537,520,519,513,512,511,497,493,488,487,484,476,473,472,496,460,452,447,446,435,432,430,417,409,407:
return SendClientMessage(playerid,0xFF0000AA,"You can not repair this vehicle!");
}
SetVehicleHealth(GetPlayerVehicleID(playerid),1000);
RepairVehicle(GetPlayerVehicleID(playerid));
PlayerPlaySound(playerid,1133,0.0,0.0,0.0);
}
}
}
return 1;
}
pawn Код:
if(pickupid == nospickup)
pawn Код:
if(IsPlayerInAnyVehicle(playerid))
pawn Код:
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
pawn Код:
switch(GetVehicleModel( GetPlayerVehicleID(playerid) ))
{
case 449,448,461,462,463,468,471,509,510,521,522,523,581,586,481,450,441,464,465,501,564,594,611,610,608,607,606,595,592,593,591,590,584,577,570,569,563,554,548,538,537,520,519,513,512,511,497,493,488,487,484,476,473,472,496,460,452,447,446,435,432,430,417,409,407:
return SendClientMessage(playerid,0xFF0000AA,"You can not add nos to this vehicle!");
}
But if you do you get the message "You can not add nos to this vehicle"
Those ID's above are Planes, Helis, Bikes and bicycles and some other misc. vehicles.
pawn Код:
AddVehicleComponent(GetPlayerVehicleID(playerid),1010);
pawn Код:
SetVehicleHealth(GetPlayerVehicleID(playerid),1000);
RepairVehicle(GetPlayerVehicleID(playerid));
GetPlayerVehicleID detects what ID your car has that you sit in at the moment.
And RepairVehicle repairs the visual damage (components)
pawn Код:
DestroyPickup(nospickup);
pawn Код:
SetTimer("respawnnos",500,false);
pawn Код:
PlayerPlaySound(playerid,1133,0.0,0.0,0.0);
Full script here.
pawn Код:
#define filterscript
#include <a_samp>
new repairpickup, nospickup;
public OnFilterScriptInit()
{
print("Pickup FS");
respawnnos();
respawnrepair();
return 1;
}
public OnFilterScriptExit()
{
DestroyPickup(nospickup);
DestroyPickup(repairpickup);
return 1;
}
forward respawnnos();
public respawnnos()
{
nospickup = CreatePickup(1009,14,2063.7432,1344.5387,10.6719,-1);//NOS
}
forward respawnrepair();
public respawnrepair()
{
repairpickup = CreatePickup(1240,14,2069.7778,1343.7512,10.6797,-1);//Repair
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == nospickup)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
DestroyPickup(nospickup);
SetTimer("respawnnos",500,false);
switch(GetVehicleModel( GetPlayerVehicleID(playerid) ))
{
case 449,448,461,462,463,468,471,509,510,521,522,523,581,586,481,450,441,464,465,501,564,594,611,610,608,607,606,595,592,593,591,590,584,577,570,569,563,554,548,538,537,520,519,513,512,511,497,493,488,487,484,476,473,472,496,460,452,447,446,435,432,430,417,409,407:
return SendClientMessage(playerid,0xFF0000AA,"You can not add nos to this vehicle!");
}
AddVehicleComponent(GetPlayerVehicleID(playerid),1010);
PlayerPlaySound(playerid,1133,0.0,0.0,0.0);
}
}
}
if(pickupid == repairpickup)
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
DestroyPickup(repairpickup);
SetTimer("respawnrepair",500,false);
switch(GetVehicleModel( GetPlayerVehicleID(playerid) ))
{
case 509,510,481,449,450,441,464,465,501,564,594,611,610,608,607,606,595,592,593,591,590,584,577,570,569,563,554,548,538,537,520,519,513,512,511,497,493,488,487,484,476,473,472,496,460,452,447,446,435,432,430,417,409,407:
return SendClientMessage(playerid,0xFF0000AA,"You can not repair this vehicle!");
}
SetVehicleHealth(GetPlayerVehicleID(playerid),1000);
RepairVehicle(GetPlayerVehicleID(playerid));
PlayerPlaySound(playerid,1133,0.0,0.0,0.0);
}
}
}
return 1;
}