Battery Percent System
#2

PHP код:
#include <a_samp>
new batteryprecent[MAX_PLAYERS];
forward OneMinuteTimer();
public 
OneMinuteTimer(){
    for(new 
iMAX_PLAYERSi++){
        if(
batteryprecent[i] != 0){
            
batteryprecent[i] -= 1;
            new 
string[64];
            
format(string64"Your battery precent dropped to %d precent"batteryprecent[i]);
            
SendClientMessage(i0xFFFF00FFstring);
            if(
batteryprecent[i] == 0){
                
SendClientMessage(i0xFF0000FF"You phone battery is dead.");
                
//your code that shuts down the phone here.
            
}
        }
    }
}
public 
OnPlayerConnect(playerid){
    
batteryprecent[playerid] = 100;
    
SendClientMessage(playerid0x00FF00FF"While you were offline, your phone battery charged to 100 precent.");
    return 
1;
}
public 
OnGameModeInit(){
    
SetTimer("OneMinuteTimer"600001); //60000 miliseconds = 60 seconds = 1 minute
    
return 1;

Reply


Messages In This Thread
Battery Percent System - by Hiei - 11.05.2018, 13:58
Re: Battery Percent System - by Vennox - 11.05.2018, 15:19
Re: Battery Percent System - by Hiei - 12.05.2018, 03:40

Forum Jump:


Users browsing this thread: 1 Guest(s)