need help with textdraws + REP
#2

Lite Example:
PHP код:
new p_alivetimes[MAX_PLAYERS];
public 
OnPlayerSpawn(playerid) {
     
p_alivetimes[playerid] = GetTickCount(); // Reset time
     
return true;
}
public 
OnPlayerUpdate(playerid) {
     new 
msg[256];
     
format(msgsizeof(msg), "Alive_Time: %d seconds", (GetTickCount()-p_alivetimes[playerid]) / 1000); // Last time from spawn
     
TextDrawSetString(stats[15], msg);
     return 
true;

or

Extended:
PHP код:
new p_alivetimes[MAX_PLAYERS];
new 
Text:stats;
public 
OnGameModeInit() {
    
// Other options...
    // Create TextDraws
    
stats TextDrawCreate(517.80023192.759986"Alive_Time:000:00:00");
    
TextDrawLetterSize(stats0.2279991.170666);
    
TextDrawAlignment(stats1);
    
TextDrawColor(stats, -1);
    
TextDrawSetShadow(stats0);
    
TextDrawSetOutline(stats0);
    
TextDrawBackgroundColor(stats255);
    
TextDrawFont(stats1);
    
TextDrawSetProportional(stats1);
    
TextDrawSetShadow(stats0);
    return 
true;
}
public 
OnGameModeExit() {
    
TextDrawHideForAll(stats);
    
TextDrawDestroy(stats);
    return 
true;
}
public 
OnPlayerDisconnect(playeridreason) {
     
TextDrawHideForPlayer(playeridstats);
     return 
true;

public 
OnPlayerSpawn(playerid) {
     
TextDrawShowForPlayer(playeridstats);
     
p_alivetimes[playerid] = GetTickCount(); // Reset time
     
return true;
}
public 
OnPlayerUpdate(playerid) {
     new 
msg[256];
     
format(msgsizeof(msg), "Alive_Time: %d seconds", (GetTickCount()-p_alivetimes[playerid]) / 1000); // Last time from spawn
     
TextDrawSetString(statsmsg);
     return 
true;

Reply


Messages In This Thread
need help with textdraws + REP - by CraTzy - 28.08.2015, 02:33
Re: need help with textdraws + REP - by Logofero - 28.08.2015, 02:41
Re: need help with textdraws + REP - by CraTzy - 28.08.2015, 03:12
Re: need help with textdraws + REP - by Logofero - 28.08.2015, 03:15
Re: need help with textdraws + REP - by CraTzy - 28.08.2015, 03:29
Re: need help with textdraws + REP - by Logofero - 28.08.2015, 03:34
Re: need help with textdraws + REP - by CraTzy - 28.08.2015, 04:13

Forum Jump:


Users browsing this thread: 3 Guest(s)