|
Re: Scripting Help [message #420744 is a reply to message #418187] |
Wed, 24 February 2010 00:22 |
|
Gen_Blacky
Messages: 3250 Registered: September 2006
Karma: 1
|
General (3 Stars) |
|
|
Im trying block players from refilling even when they buy a new character. They can buy new characters without the script effecting the players heath if they don't get damaged.
When the Player goes outside of the zone and get's damaged I want the script to somehow return a Boolean value or number to the refill zone. The refill zone will get the players health when they enter the zone and when they exit the zone it will see that they where damaged. It will then set the player health back to what it was when they entered the zone.
Code
void B_Refill_Zone::Entered(GameObject *obj,GameObject *enter)
{
int x;
x = Get_Int_Parameter("Player_Type");
if (CheckPlayerType(enter,x))
{
return;
}
if (Commands->Is_A_Star(enter))
{
//Commands->Start_Timer(obj,this,5,Commands->Get_ID(enter));
return
}
Console_Output("enter.\n");
health = Commands->Get_Health(enter);
shield = Commands->Get_Shield_Strength(enter);
Console_Output("[Refill] Health %d Shiled %d.\n",health, shield );
}
void B_Refill_Zone::Exited(GameObject *obj,GameObject *exit)
{
int x;
x = Get_Int_Parameter("Player_Type");
int player = Get_Player_ID(exit);
if (CheckPlayerType(exit,x))
{
return;
}
if (!Commands->Is_A_Star(exit))
{
return;
}
else if (Commands->Get_Health(exit) > health || Commands->Get_Shield_Strength(exit) > shield )
{
if ( Damage > 0 )
{
Commands->Set_Health(exit,health);
Commands->Set_Shield_Strength(exit,shield);
char message[1000];
sprintf(message,"ppage %d Do Not Refill",Get_Player_ID(exit));
Console_Input(message);
Console_Output("[Refill] %s tried to refill.\n",Get_Player_Name_By_ID(player));
Console_Output("[Refill] is Damaged %d.\n",Get_Player_Name_By_ID(player), Damage);
}
else
{
Console_Output("[Refill] %s Not Damaged %d.\n",Get_Player_Name_By_ID(player),Damage);
}
}
else
{
Console_Output("[Refill] %s did not try to refill.\n",Get_Player_Name_By_ID(player));
}
}
Example of what i want the script to do.
|
|
|
Re: Scripting Help [message #420757 is a reply to message #418187] |
Wed, 24 February 2010 03:35 |
|
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
So wait, what you really want is to just stop people erfilling really?
If it was possible to remove the refill PT icon, that would suit your needs?
|
|
|
|
Re: Scripting Help [message #420779 is a reply to message #418187] |
Wed, 24 February 2010 08:40 |
raven
Messages: 595 Registered: January 2007 Location: Toronto, Ontario
Karma: 0
|
Colonel |
|
|
store everyones health levels in an array and on purchase event set their health to that value
just a thought
-Jelly Administrator
-Exodus Administrator
|
|
|
Re: Scripting Help [message #420781 is a reply to message #418187] |
Wed, 24 February 2010 08:45 |
|
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
I'm still not entirely sure what he really wants. I reckon there's a simple solution.
|
|
|
Re: Scripting Help [message #420783 is a reply to message #418187] |
Wed, 24 February 2010 09:29 |
|
Gen_Blacky
Messages: 3250 Registered: September 2006
Karma: 1
|
General (3 Stars) |
|
|
reborn wrote on Wed, 24 February 2010 04:35 | So wait, what you really want is to just stop people erfilling really?
If it was possible to remove the refill PT icon, that would suit your needs?
|
I want to stop players from completely refilling even when they buy a new character. I don't know how I can explain this any better then I already have.
Tunaman wrote on Wed, 24 February 2010 09:16 | He's saying he doesn't want people to get more health even if they buy a new character.
|
yes.
Lets says A player goes out and gets damaged by another player and they have 100 health and 50 shield. They go back to the pt and buy a new character that has more health then they currently have. Like an mendoza who has 200 health and 100 armor. When they exit the zone their health will just be set back to 100 health and 50 armor because they where damaged. ( Damage Value set to 1)
Lets say the player dies when they spawn they will have 100 heath and 100 armor. They can buy any character they wish that has more health and armor as long as they don't get damaged.
( Damage Value set to 0 )
raven wrote on Wed, 24 February 2010 09:40 | store everyones health levels in an array and on purchase event set their health to that value
just a thought
|
I think that's more complicated then its needs to be. That would be a better way to do it though.
[Updated on: Wed, 24 February 2010 09:32] Report message to a moderator
|
|
|
Re: Scripting Help [message #420798 is a reply to message #418187] |
Wed, 24 February 2010 12:46 |
|
Omar007
Messages: 1711 Registered: December 2007 Location: Amsterdam
Karma: 0
|
General (1 Star) |
|
|
The easiest way to do this is as raven said imo
That's probably how i would do it if i wanted to
You could do this with a Purchase hook too i think. You would still need an array for the players though
[Updated on: Wed, 24 February 2010 12:47] Report message to a moderator
|
|
|
|
Re: Scripting Help [message #420830 is a reply to message #418187] |
Wed, 24 February 2010 14:47 |
|
Omar007
Messages: 1711 Registered: December 2007 Location: Amsterdam
Karma: 0
|
General (1 Star) |
|
|
Here are a few examples
INT Array
example loop to put player ID's in it
for(int i = 0; i < sizeof(myInt); i++)
{
myChar[i] = playerID;
}
Char Array
char myChar[127][255]; //char uses 2 number sets for 1 array. Last set always defines the max number of characters in 1 sentence/spot
example loop to put player names in it
for(int i = 0; i < sizeof(myChar); i++)
{
myChar[i] = playerName;
}
Note that arrays for floats, doubles, longs, bytes etc are the same as an int array
Hope this helped you a bit
[Updated on: Wed, 24 February 2010 14:48] Report message to a moderator
|
|
|
|
|
|
|
Re: Scripting Help [message #424612 is a reply to message #424611] |
Sun, 04 April 2010 02:50 |
|
Gen_Blacky
Messages: 3250 Registered: September 2006
Karma: 1
|
General (3 Stars) |
|
|
Hex wrote on Sun, 04 April 2010 03:44 | Try looking instead of getting everyone else to do the work for you?, just a idea.
|
I did look i just wanted confirmation on how to load it in a plugin. I guess I should of asked more depth what i really wanted.I found the bhs hooks and the ssgm purchase hook. I did not see it in the plugin example so wasn't sure if ssgm plugins had support for it. I did not see where ssgm loads the SSGM_Purchase_Hook into the plugins looking through the ssgm source.
[Updated on: Sun, 04 April 2010 03:08] Report message to a moderator
|
|
|
|