#1

PHP код:
CMD:test(playerid,params[]){
new 
HourSecondMinuteDayMonthYear;
gettime(Hour,Second,Minute);
getdate(DayMonthYear);
format(Stringsizeof(String),"Time: %i:%i:%i | Date: %i/%i/%i",Hour,Minute,Second,Day,Month,Year);
MSG(playerid,C_RED,String);
return 
1;} 
such as simple cmd and so many errors etc, never happened to me before

PHP код:
C:\Users\Lirbo\Desktop\GRRP\gamemodes\Register.pwn(812) : warning 219local variable "Hour" shadows a variable at a preceding level
C
:\Users\Lirbo\Desktop\GRRP\gamemodes\Register.pwn(812) : warning 219local variable "Second" shadows a variable at a preceding level
C
:\Users\Lirbo\Desktop\GRRP\gamemodes\Register.pwn(812) : warning 219local variable "Minute" shadows a variable at a preceding level
C
:\Users\Lirbo\Desktop\GRRP\gamemodes\Register.pwn(812) : warning 219local variable "Day" shadows a variable at a preceding level
C
:\Users\Lirbo\Desktop\GRRP\gamemodes\Register.pwn(812) : warning 219local variable "Month" shadows a variable at a preceding level
C
:\Users\Lirbo\Desktop\GRRP\gamemodes\Register.pwn(812) : warning 219local variable "Year" shadows a variable at a preceding level
C
:\Users\Lirbo\Desktop\GRRP\gamemodes\Register.pwn(813) : error 035argument type mismatch (argument 1)
C:\Users\Lirbo\Desktop\GRRP\gamemodes\Register.pwn(814) : error 035argument type mismatch (argument 1)
C:\Users\Lirbo\Desktop\GRRP\gamemodes\Register.pwn(815) : warning 213tag mismatch
C
:\Users\Lirbo\Desktop\GRRP\gamemodes\Register.pwn(815) : warning 213tag mismatch
C
:\Users\Lirbo\Desktop\GRRP\gamemodes\Register.pwn(815) : warning 213tag mismatch
C
:\Users\Lirbo\Desktop\GRRP\gamemodes\Register.pwn(815) : warning 213tag mismatch
C
:\Users\Lirbo\Desktop\GRRP\gamemodes\Register.pwn(815) : warning 213tag mismatch
C
:\Users\Lirbo\Desktop\GRRP\gamemodes\Register.pwn(815) : warning 213tag mismatch
C
:\Users\Lirbo\Desktop\GRRP\gamemodes\Register.pwn(812) : warning 203symbol is never used"Year"
C:\Users\Lirbo\Desktop\GRRP\gamemodes\Register.pwn(812) : warning 203symbol is never used"Month"
C:\Users\Lirbo\Desktop\GRRP\gamemodes\Register.pwn(812) : warning 203symbol is never used"Day"
C:\Users\Lirbo\Desktop\GRRP\gamemodes\Register.pwn(812) : warning 203symbol is never used"Minute"
C:\Users\Lirbo\Desktop\GRRP\gamemodes\Register.pwn(812) : warning 203symbol is never used"Second" 
Reply
#2

In your script, instead of %i use %02d. Also, you have not made a new string, so add String[256]; to new.
Reply
#3

Код:
warning 219: local variable "Year" shadows a variable at a preceding level
This means that you have created a global array or integer named "Year".
The command compiles fine in my script (after changing MSG to SendClientMessage, and C_RED to a color I have defined in my script).

Try removing that line:
pawn Код:
CMD:test(playerid,params[]){
gettime(Hour,Second,Minute);
getdate(Day, Month, Year);
format(String, sizeof(String),"Time: %i:%i:%i | Date: %i/%i/%i",Hour,Minute,Second,Day,Month,Year);
MSG(playerid,C_RED,String);
return 1;}
Reply
#4

Hello!

Try this:
PHP код:
CMD:test(playerid,params[])
{
    new 
Hour2,Second2,Minute2,Day2,Month2,Year2,String[145];
    
gettime(Hour2,Second2,Minute2);
    
getdate(Day2,Month2,Year2);
    
format(String,sizeof String,"Time: %i:%i:%i | Date: %02d/%02d/%i",Hour2,Minute2,Second2,Day2,Month2,Year2);
    
MSG(playerid,C_RED,String);
    return 
1;

- Mencent
Reply
#5

Quote:
Originally Posted by Gazzy
Посмотреть сообщение
In your script, instead of %i use %02d. Also, you have not made a new string, so add String[256]; to new.
There's nothing wrong with %i, %02d is NOT what he's currently trying to do. %02d just means "add a zero if integer is less than 10." (1 = 01 etc.)

And he probably have created a GLOBAL array called "String", and the size 256 is DOUBLE the size of what is possible to send to a client, so it is very stupid.
Reply
#6

Quote:
Originally Posted by Gazzy
Посмотреть сообщение
In your script, instead of %i use %02d. Also, you have not made a new string, so add String[256]; to new.
Unless you want to waste your memory use it...
That's very bad advice , why using 256 instead of less + he's not sending a big message , it's just waste of kilobytes
Reply
#7

Quote:
Originally Posted by Wizzard2H
Посмотреть сообщение
Unless you want to waste your memory use it...
That's very bad advice , why using 256 instead of less + he's not sending a big message , it's just waste of kilobytes
Sorry I'm not a pro scripter lol
Reply
#8

Quote:
Originally Posted by Wizzard2H
Посмотреть сообщение
Unless you want to waste your memory use it...
That's very bad advice , why using 256 instead of less + he's not sending a big message , it's just waste of kilobytes
256 bits = 32 bytes to be exact, which is 0.032 kilobytes. It's not a lot. Though, it's something you can easily avoid and should avoid.
Reply
#9

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

Try this:
PHP код:
CMD:test(playerid,params[])
{
    new 
Hour2,Second2,Minute2,Day2,Month2,Year2,String[145];
    
gettime(Hour2,Second2,Minute2);
    
getdate(Day2,Month2,Year2);
    
format(String,sizeof String,"Time: %i:%i:%i | Date: %02d/%02d/%i",Hour2,Minute2,Second2,Day2,Month2,Year2);
    
MSG(playerid,C_RED,String);
    return 
1;

- Mencent
<3 thanks bro, It's working, but I already had the String defined in the top of the script
You got +Rep from me
Reply
#10

Quote:
Originally Posted by Overhaul
Посмотреть сообщение
256 bits = 32 bytes to be exact, which is 0.032 kilobytes. It's not a lot. Though, it's something you can easily avoid and should avoid.
It's not a lot but it's a good practice to avoid using a lot of it as I said unless you want to waste your VPS's memory
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)