AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [help] copy (https://forums.alliedmods.net/showthread.php?t=136151)

katna 08-23-2010 12:23

[help] copy
 
whats wrong with this code? instead of returning me the date: Aug 23, 2010 12:55:54
its return 'A' which is the first letter only of the month ''Aug''?
PHP Code:

enum playerinfo
{
    
name[33] = 0,
    
joindate[42]
}
 
new 
PlayerData[33][playerinfo

PHP Code:

new DateTime[42]
get_time("%b %d, %Y %X"DateTime41)
copy(PlayerData[id][joindate], 41DateTime

but DateTime is still 'Aug 23, 2010 12:55:54' and PlayerData[id][joindate] is 'A'

Bugsy 08-23-2010 13:47

Re: [help] copy
 
How are you accessing the date in your enum/struct?

Try
client_print( id , print_chat , "date %s" , PlayerData[ id ][ joindate ] );

katna 08-23-2010 13:48

Re: [help] copy
 
that exactly what im doing. I'm trying to configure whats wrong

nikhilgupta345 08-23-2010 13:56

Re: [help] copy
 
could you post the full code?

katna 08-23-2010 14:17

Re: [help] copy
 
PHP Code:

enum playerinfo {
 
Name[33] = 0,
 
DateStart[33],
 
Achievement[64],
 
PlayedTime
}
 
new 
gPlayerInfo[33][playerinfo

PHP Code:

new dateTime[42], name[33]
get_time("%b %d, %Y %X"dateTime,41)
get_user_name(idname32)
 
copy(gPlayerInfo[id][Name], 32name)
copy(gPlayerInfo[id][DateStart], 41dateTime)
copy(gPlayerInfo[id][Achievement], 32"")
gPlayerInfo[id][PlayedTime] = 

gPlayerInfo[id][Name] return 'ka' when my name was ''katna''
gPlayerDate[id][DateStart] return 'A' when the date is ''Aug 23, 2010 17:55:54"

Bugsy 08-23-2010 15:51

Re: [help] copy
 
Show how you are displaying the values.

katna 08-23-2010 17:16

Re: [help] copy
 
PHP Code:

log_amx("%s"gPlayerInfo[id][DateStart]) 


Bugsy 08-24-2010 19:09

Re: [help] copy
 
Just tested and your code works as-is.
PHP Code:

enum playerinfo 
{
    
Name[33] = 0,
    
DateStart[33],
    
Achievement[64],
    
PlayedTime
}

new 
gPlayerInfo[33][playerinfo];

public 
TestFunc()
{
    new 
dateTime[42], name[33] , id=0;
    
get_time("%b %d, %Y %X"dateTime,41)
    
    
copy(gPlayerInfo[id][Name], 32"bugsy" )
    
copy(gPlayerInfo[id][DateStart], 41dateTime)
    
copy(gPlayerInfo[id][Achievement], 32"")
    
gPlayerInfo[id][PlayedTime] = 0
 
    server_print
"Name=%s" gPlayerInfo[id][Name] );
    
server_print"DateStart=%s" gPlayerInfo[id][DateStart] );
    
server_print"Achievement=%s" gPlayerInfo[id][Achievement] );
    
server_print"PlayedTime=%d" gPlayerInfo[id][PlayedTime] );


Output
Code:

Name=bugsy
DateStart=Aug 24, 2010 19:07:53
Achievement=
PlayedTime=0


katna 08-25-2010 02:07

Re: [help] copy
 
yea i got it to work some how. but is there a difference between
PHP Code:

gPlayerInfo[id][playerinfo:1// DateStart 

to this
PHP Code:

gPlayerInfo[id][DateStart


Arkshine 08-25-2010 05:48

Re: [help] copy
 
The same, first you use the index and the second the defined name for this index. But I don't see why you would want to use the first.


All times are GMT -4. The time now is 22:01.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.