[Tutorial] Simple basic tutorial with name & vehicleid
#1

Very simple/basic tutorial with names, and vehicleid!
This is my first tutorial, I'm bad with them i guess, Sorry if i mess
ed something up, Tell me what i did wrong, and comment and stuff, Thank you!


Hello there, I'm going to show you, when a player enters a vehicle, if the vehicle is
let's say, a sanchez, It will set the vehicles health to 50000


First, make sure you have the
pawn Code:
public OnPlayerEnterVehicle(playerid, vehicleid)
{
    return 1;
}
in your gamemode/filterscript., If not add it, Now head to it..

First we need to check if the vehicle's id is 468 (Aka sanchez), So:

pawn Code:
if(GetVehicleModel(vehicleid) == 468){
So we've got the vehicleid, Now we have to do something,

[/pawn]SetVehicleHealth(vehicleid, 50000);[/code]

So now if you've done that, It should end up some what like this:

pawn Code:
public OnPlayerEnterVehicle(playerid, vehicleid)
{
    if(GetVehicleModel(vehicleid) == 468){
    SetVehicleHealth(vehicleid, 50000);
    return 1;
}
Hope this helps with whatever you need like this...

Now, for OnPlayerSpawn with playernames.

Make sure you have the
pawn Code:
public OnPlayerSpawn(playerid)
{
    return 1;
}
In your gamemode/filterscript.

First, we need to add the define for the name, and the playersname,

Example:
pawn Code:
new name, DarkClone;
Now we need to get the name when they spawn.

pawn Code:
if(name == DarkClone){
(But, for muti stuff like DarkClone and OtherDude, Use this:
pawn Code:
if(name == DarkClone || OtherDude){
Remember to define OtherDude!

So we got it now, Now let's do something!

pawn Code:
SetPlayerHealth(playerid, 1);
Okay now their health is 1.

Your code should end up like this:

pawn Code:
public OnPlayerSpawn(playerid)
{
   new name, DarkClone;
   if(name == DarkClone){
   SetPlayerHealth(playerid, 1);
   return 1;
   }
   return 1;
}
I believe you could do something like that with OnPlayerConnect too. Also i'm not sure if it works.

Remember, this is my first tutorial, And please don't say it sucks.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)