textdraw doesn't update
#1

hello all, i'm giving an error from a phone who I downloaded from scripts:
Code:
warning 204: symbol is assigned a value that is never used: "UpdateIPHONETimer"
Code:
UpdateIphone();
UpdateIPHONETimer = SetTimer("UpdateIphone", 60000, true);
these are in OnGameModeInit.
when i'm working with this in my server, the phone doesn't updates and the phone is buggy.
that's the new i created:
Code:
new UpdateIPHONETimer;
how do I can resolve this?
fine, thanks.
i'm giving REP+
Reply
#2

Show your
PHP Code:
public UpdateIphone() 
Reply
#3

Quote:
Originally Posted by Micko123
View Post
Show your
PHP Code:
public UpdateIphone() 
PHP Code:
public UpdateIphone()
{
    new 
HourMinute;
    
gettime(HourMinute);
    new 
str[64];
    
format(str,sizeof(str),"4G________________%02d:%02d",Hour,Minute);
    
TextDrawSetString(TD_iPhone[18], str);
    
format(str,sizeof(str),"%02d:%02d",Hour,Minute);
    
TextDrawSetString(TD_iPhone_Clock[0], str);
    
TextDrawSetString(TD_iPhone[19], str);
    new 
YearMonthDay;
    
getdate(YearMonthDay);
    
format(str,sizeof(str),"%s, %02d %d",GetMonth(Month), DayYear);
    
TextDrawSetString(TD_iPhone[20], str);
    
TextDrawSetString(TD_iPhone_Clock[1], str);
    
ActualizarTiempo();
    return 
1;
}
stock ActualizarTiempo()
{
     new 
weather[64],idwea;
    
GetServerVarAsString("weather"weathersizeof(weather));
    
idwea strval(weather);
    if(
idwea >= && idwea <= 7TextDrawSetString(TD_iPhone_Time[0],"Sunny");
    else if(
idwea == 8TextDrawSetString(TD_iPhone_Time[0],"Stormy");
    else if(
idwea == 9TextDrawSetString(TD_iPhone_Time[0],"Fog");
    else if(
idwea == 10TextDrawSetString(TD_iPhone_Time[0],"Sunny");
    else if(
idwea == 11TextDrawSetString(TD_iPhone_Time[0],"Hot");
    else if(
idwea >= 12 && idwea <= 15TextDrawSetString(TD_iPhone_Time[0],"Aburro");
    else if(
idwea == 16TextDrawSetString(TD_iPhone_Time[0],"Rain");
    else if(
idwea >= 17 && idwea <= 18TextDrawSetString(TD_iPhone_Time[0],"Hot");
    else if(
idwea == 19TextDrawSetString(TD_iPhone_Time[0],"Sand");
    else if(
idwea == 20TextDrawSetString(TD_iPhone_Time[0],"Fog");
    else if(
idwea == 21TextDrawSetString(TD_iPhone_Time[0],"Very dark");
    else if(
idwea == 22TextDrawSetString(TD_iPhone_Time[0],"Very dark");
    else if(
idwea >= 23 && idwea <= 26TextDrawSetString(TD_iPhone_Time[0],"Orange");
    else if(
idwea >= 27 && idwea <= 29TextDrawSetString(TD_iPhone_Time[0],"Sunny");
    else if(
idwea >= 30 && idwea <= 32TextDrawSetString(TD_iPhone_Time[0],"Dark");
    else if(
idwea == 33TextDrawSetString(TD_iPhone_Time[0],"Dark");
    else if(
idwea == 34TextDrawSetString(TD_iPhone_Time[0],"Blue");
    else if(
idwea == 35TextDrawSetString(TD_iPhone_Time[0],"Marron");
    else if(
idwea >= 36 && idwea <= 38TextDrawSetString(TD_iPhone_Time[0],"Brillant");
    else if(
idwea == 39TextDrawSetString(TD_iPhone_Time[0],"Very brillant");
    else if(
idwea >= 40 && idwea <= 42TextDrawSetString(TD_iPhone_Time[0],"Blue/Purple");
    else if(
idwea == 43TextDrawSetString(TD_iPhone_Time[0],"Toxic");
    else if(
idwea == 44TextDrawSetString(TD_iPhone_Time[0],"Black");
    else if(
idwea == 45TextDrawSetString(TD_iPhone_Time[0],"Black");
    return 
1;

Reply
#4

Warning is caused because of:

new UpdateIPHONETimer;

You don't need that if you are not using it (by kill timer for example).

Just remove it and change that:

UpdateIPHONETimer = SetTimer("UpdateIphone", 60000, true);

to:

SetTimer("UpdateIphone", 60000, true);
Reply
#5

Add this at the top
#pragma unused UpdateIPHONETimer

not sure tho
Reply
#6

Quote:
Originally Posted by Rdx
View Post
Warning is caused because of:

new UpdateIPHONETimer;

You don't need that if you are not using it (by kill timer for example).

Just remove it and change that:

UpdateIPHONETimer = SetTimer("UpdateIphone", 60000, true);

to:

SetTimer("UpdateIphone", 60000, true);
Quote:
Originally Posted by Eoussama
View Post
Add this at the top
#pragma unused UpdateIPHONETimer

not sure tho
#pragma unused works but the iphone doesn't updates....
Reply
#7

PHP Code:
public UpdateIphone() 

    new 
HourMinute
    
gettime(HourMinute); 
    new 
str[64]; 
    
format(str,sizeof(str),"4G________________%02d:%02d",Hour,Minute); 
    
TextDrawSetString(TD_iPhone[18], str); 
    
format(str,sizeof(str),"%02d:%02d",Hour,Minute); 
    
TextDrawSetString(TD_iPhone_Clock[0], str); 
    
TextDrawSetString(TD_iPhone[19], str); 
    
TextDrawShow(playeridTD_iPhone_Clock[0]);
    
TextDrawShow(playeridTD_iPhone[19]);
    
    new 
YearMonthDay
    
getdate(YearMonthDay); 
    
format(str,sizeof(str),"%s, %02d %d",GetMonth(Month), DayYear); 
    
TextDrawSetString(TD_iPhone[20], str); 
    
TextDrawSetString(TD_iPhone_Clock[1], str); 
    
TextDrawShow(playeridTD_iPhone_Clock[1]);
    
TextDrawShow(playeridTD_iPhone[20]);
    
ActualizarTiempo(); 
    return 
1

Not sure 100% but try this one..
Reply
#8

Just let the compiler do his thing

Declare it like this:

PHP Code:
new stock UpdateIPHONETimer
aaaand Problem is gone
Reply
#9

Quote:
Originally Posted by Micko123
View Post
PHP Code:
public UpdateIphone() 

    new 
HourMinute
    
gettime(HourMinute); 
    new 
str[64]; 
    
format(str,sizeof(str),"4G________________%02d:%02d",Hour,Minute); 
    
TextDrawSetString(TD_iPhone[18], str); 
    
format(str,sizeof(str),"%02d:%02d",Hour,Minute); 
    
TextDrawSetString(TD_iPhone_Clock[0], str); 
    
TextDrawSetString(TD_iPhone[19], str); 
    
TextDrawShow(playeridTD_iPhone_Clock[0]);
    
TextDrawShow(playeridTD_iPhone[19]);
    
    new 
YearMonthDay
    
getdate(YearMonthDay); 
    
format(str,sizeof(str),"%s, %02d %d",GetMonth(Month), DayYear); 
    
TextDrawSetString(TD_iPhone[20], str); 
    
TextDrawSetString(TD_iPhone_Clock[1], str); 
    
TextDrawShow(playeridTD_iPhone_Clock[1]);
    
TextDrawShow(playeridTD_iPhone[20]);
    
ActualizarTiempo(); 
    return 
1

Not sure 100% but try this one..
Quote:
Originally Posted by Kaliber
View Post
Just let the compiler do his thing

Declare it like this:

PHP Code:
new stock UpdateIPHONETimer
aaaand Problem is gone
With stock it doesn't works ...
@Micko123, the function is not for a player, is for ongamemodeinit with a repetable timer, and textdrawshow doesn't exists in pawno language...
nothing happned, down i will take a photo how the iphone is....

and how it was originally:
https://sampforum.blast.hk/showthread.php?tid=508116
Reply
#10

OnGameModeExit, use the
PHP Code:
KillTimer(UpdateIPHONETimer); 
and it will work
Reply
#11

Quote:
Originally Posted by ALiScripter
View Post
OnGameModeExit, use the
PHP Code:
KillTimer(UpdateIPHONETimer); 
and it will work
Nothingg
Reply
#12

Here you go...

Top of the script after includes:
PHP Code:
new UpdateIPHONETimer
OnGameModeInit:
PHP Code:
UpdateIphone();
UpdateIPHONETimer SetTimer("UpdateIphone"60000true); 
OnGameModeExit:
PHP Code:
KillTimer(UpdateIPHONETimer); 
UpdateIphone function:
PHP Code:
forward UpdateIphone();
public 
UpdateIphone() 

    new 
HourMinuteYearMonthDaystr[64];
    
gettime(HourMinute);
    
getdate(YearMonthDay);
    
format(str,sizeof(str),"4G________________%02d:%02d",Hour,Minute); 
    
TextDrawSetString(TD_iPhone[18], str); 
    
format(str,sizeof(str),"%02d:%02d",Hour,Minute); 
    
TextDrawSetString(TD_iPhone_Clock[0], str); 
    
format(str,sizeof(str),"%s, %02d %d",GetMonth(Month), DayYear); 
    
TextDrawSetString(TD_iPhone[20], str); 
    
ActualizarTiempo(); 
    return 
1

OPTIONAL
OnPlayerSpawn:
PHP Code:
UpdateIphone(); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)