How to make this game mode a filterscript?
#1

I made this game mode where you pick up a pickup and your health is restored to 100. How can i make this a filterscript, because I need the callback OnPlayerPickUpPickup. Help me plz!!!
Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
new pharmacy;
public OnGameModeInit(){
	AddPlayerClass(0,1215.6434,-1323.6664,13.5668,89.0061,0,0,0,0,0,0); //
	pharmacy = CreatePickup(1240,1,1172.2653,-1324.0309,15.4045,-1);
}
public OnPlayerPickUpPickup(playerid,pickupid){
	if(pickupid == pharmacy){
	return Injection(playerid);
	}
	return 1;
}
Injection(playerid){
new notice[85];
new Float:health;
GetPlayerHealth(playerid,health);
format(notice,sizeof(notice),"Your current health level is approximately %.2f.It has been restored to 100",health);
SendClientMessage(playerid,0xd86b93FF,notice);
SetPlayerHealth(playerid,100);
return 1;
}
main(){}
Thanks guys!
Reply
#2

pawn Код:
#include <a_samp>

new pharmacy;

public OnFilterScriptInit()
{
    pharmacy = CreatePickup(1240,1,1172.2653,-1324.0309,15.4045,-1);
    return 1;
}

public OnPlayerPickUpPickup(playerid,pickupid)
{
    if(pickupid == pharmacy)
    {
        new notice[85];
        new Float:health;
        GetPlayerHealth(playerid,health);
        format(notice,sizeof(notice),"Your current health level is approximately %.2f.It has been restored to       100",health);
        SendClientMessage(playerid,0xd86b93FF,notice);
        SetPlayerHealth(playerid,100);
    }
    return 1;
}
1.Put this as a filescript.
2.Compile.
3.Enter in your server.cfg, and at filescript line write your filescript name.
4.Open SA-MP Server.
5.Succesfully, made a filescript.
Reply
#3

Quote:
Originally Posted by HY
Посмотреть сообщение
pawn Код:
#include <a_samp>

new pharmacy;

public OnFilterScriptInit()
{
    pharmacy = CreatePickup(1240,1,1172.2653,-1324.0309,15.4045,-1);
    return 1;
}

public OnPlayerPickUpPickup(playerid,pickupid)
{
    if(pickupid == pharmacy)
    {
        new notice[85];
        new Float:health;
        GetPlayerHealth(playerid,health);
        format(notice,sizeof(notice),"Your current health level is approximately %.2f.It has been restored to       100",health);
        SendClientMessage(playerid,0xd86b93FF,notice);
        SetPlayerHealth(playerid,100);
    }
    return 1;
}
1.Put this as a filescript.
2.Compile.
3.Enter in your server.cfg, and at filescript line write your filescript name.
4.Open SA-MP Server.
5.Succesfully, made a filescript.
Thanks a lot!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)