02.05.2012, 22:18
We begin by opening a brand new pawno window, and opening the script of your choosing. This is a very easy function to do in pawn, but can be very helpful in game, for all kinds of gamemodes. With pickups, you can make them show a player text, or even teleport the player, all up to you, the scripter. Let us begin:
Step one:
Now that we have opened our Pawno window, and opened our script, press CTRL+F, and look search for:
In this is everything that you want to load when your gamemode starts, or initiates. Now we begin the coding, we want to create a new pickup:
Step Two:
Inside of the public function type this:
CreatePickup(pickupmodel, pickuptype, coordx, coordy, coordz, virtualworld);
Now you must change the pickupmodel, pickuptype, coordx, coordy, coordz, and virtualworld to your choosing, here is a example:
If you don't know the virtual world, keep it at 0... To get the right model and type, click on the pickuptype and pickupmodel and it will take you to a link.
Now we have created a pickup, but we have not distinguished this pickup from any other... So if we want to give this pickup a function, we can't, at this time. So to make this pickup special, we give it a name, to do so go to where you created it, and before the
add this:
So it would look something like this:
Now our script understands that pickupone, is the one it created.
Step Three:
Now we want to make our pickup do a special task, when the player picks it up, so now press CTRL+F again, and search for:
Now type this inside of it:
Now when our player picks up the this pickup we named pickupone, it will send him the message we put... But we can also make it teleport them or even kill them, here are some examples of what you can do:
Kill or set their health:
Teleport them:
Give them a weapon:
Overall you can see how this can be quite a useful part of your scripting. With this you can have many possibilities and make many different outcomes come true, good luck with your scripting, and have fun!
Step one:
Now that we have opened our Pawno window, and opened our script, press CTRL+F, and look search for:
pawn Code:
public OnGameModeInit()
Step Two:
Inside of the public function type this:
CreatePickup(pickupmodel, pickuptype, coordx, coordy, coordz, virtualworld);
Now you must change the pickupmodel, pickuptype, coordx, coordy, coordz, and virtualworld to your choosing, here is a example:
pawn Code:
CreatePickup(1318, 23, 0, 0, 0, 0);
Now we have created a pickup, but we have not distinguished this pickup from any other... So if we want to give this pickup a function, we can't, at this time. So to make this pickup special, we give it a name, to do so go to where you created it, and before the
pawn Code:
CreatePickup
pawn Code:
new pickupname =
pawn Code:
new pickupone = CreatePickup(1318, 23, 0, 0, 0, 0);
Step Three:
Now we want to make our pickup do a special task, when the player picks it up, so now press CTRL+F again, and search for:
pawn Code:
public OnPlayerPickUpPickup(playerid, pickupid)
pawn Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == pickupone)
{
SendClientMessage(playerid, COLOR_WHITE, "You picked me up!");
return 1;
}
return 1;
}
Kill or set their health:
pawn Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == pickupone)
{
SetPlayerHealth(playerid, 0);
return 1;
}
return 1;
}
pawn Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == pickupone)
{
SetPlayerPos(playerid, 1, 1, 1);
return 1;
}
return 1;
}
pawn Code:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == pickupone)
{
GivePlayerWeapon(playerid, 24, 9999);
return 1;
}
return 1;
}