how to make radiation system ?
#1

someone could teach me how to make a radiation system? for example, you have an area made by gang zone and if the person entering this area the level of radiation rises, reaching 100% the player dies.
Reply
#2

Hello.

You can do this with a timer. I recommend to use the streamer because with that it's very easy to check if a player is in a gang zone.
Then you can check if the player is in this zone and start the timer (and increase an variable always with e.g. 10).
If the variable is on 100 the player die and when the player leave the zone before the variable is on 100 you can kill the timer and put the variable on 0.

Maybe you can do it yourself. If not you can send us your currently code (with that you tested it) and say us what the problem is.
Reply
#3

Quote:
Originally Posted by Mencent
Посмотреть сообщение
Hello.

You can do this with a timer. I recommend to use the streamer because with that it's very easy to check if a player is in a gang zone.
Then you can check if the player is in this zone and start the timer (and increase an variable always with e.g. 10).
If the variable is on 100 the player die and when the player leave the zone before the variable is on 100 you can kill the timer and put the variable on 0.

Maybe you can do it yourself. If not you can send us your currently code (with that you tested it) and say us what the problem is.
I have not done, I have no idea how to do this
Reply
#4

Functions (Streamer):
CreateDynamicRectangle,
CreateDynamicCircle,
IsPlayerInArea

Variables:
To store the radiation zones, use a enumerator and array;

PHP код:
enum Radiation
{
    
ZoneID,
    
ZonePos[4]
}
new 
gRadiation[200][Radiation] =
{
    {
0055},
    {
10101515}
}; 
EDIT: just an example
Reply
#5

Quote:
Originally Posted by ALiScripter
Посмотреть сообщение
Functions (Streamer):
CreateDynamicRectangle,
CreateDynamicCircle,
IsPlayerInArea

Variables:
To store the radiation zones, use a enumerator and array;

PHP код:
enum Radiation
{
    
ZoneID,
    
ZonePos[4]
}
new 
gRadiation[200][Radiation] =
{
    {
0055},
    {
10101515}
}; 
EDIT: just an example
I've done the gangzones now do not know the radiation system, could make a brief tutorial? help me too am looking for a tutorial for a long time!

PHP код:
public OnPlayerEnterDynamicArea(playeridareaid) {
    for (new 
zone=0zone<MAX_ZONESzone++) {
        if (
areaid==zones[zone]) {
            new 
msg[90];
            
format(msg90"Welcome to %s"zones_text[zone]);
            
SendClientMessage(playerid0xFFFFFFFFmsg);
        }
    }
    return 
1;
}
public 
OnPlayerLeaveDynamicArea(playeridareaid) {
    for (new 
zone=0zone<MAX_ZONESzone++) {
        if (
areaid==zones[zone]) {
            new 
msg[90];
            
format(msg90"Goodbye from %s"zones_text[zone]);
            
SendClientMessage(playerid0xFFFFFFFFmsg);
        }
    }
    return 
1;

Reply
#6

When I understood your system then you should make it like this:
PHP код:
//under the includes:
new RadiationPlayer[MAX_PLAYERS],RadiationTimer[MAX_PLAYERS];
//your callback
public OnPlayerEnterDynamicArea(playeridareaid) {
    for (new 
zone=0zone<MAX_ZONESzone++) {
        if (
areaid==zones[zone]) {
            new 
msg[90];
            
format(msg90"Welcome to %s"zones_text[zone]);
            
SendClientMessage(playerid0xFFFFFFFFmsg);
            
RadiationTimer[playerid] = SetTimerEx("OnPlayerRadiationSystem",1000,1,"ii",playerid,areaid);
        }
    }
    return 
1;
}
//callback for the timer
forward OnPlayerRadiationSystem(playerid,areaid);
public 
OnPlayerRadiationSystem(playerid,areaid)
{
    if(
IsPlayerInDynamicArea(playerid,areaid))
    {
        
RadiationPlayer[playerid] += 10;
        if(
RadiationPlayer[playerid] == 100)
        {
            
SetPlayerHealth(playerid,0.0);
            
SendClientMessage(playerid,-1,"Your Radiation is on 100! You die!");
            return 
1;
        }
        new 
string[50];
        
format(string,sizeof string,"RADIATION: + 10 (current: %d)",RadiationPlayer[playerid]);
        
SendClientMessage(playerid,-1,string);
    }
    return 
1;
}
//your callback
public OnPlayerLeaveDynamicArea(playeridareaid) {
    for (new 
zone=0zone<MAX_ZONESzone++) {
        if (
areaid==zones[zone]) {
            new 
msg[90];
            
format(msg90"Goodbye from %s"zones_text[zone]);
            
SendClientMessage(playerid0xFFFFFFFFmsg);
            
KillTimer(RadiationTimer[playerid]);
        }
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)