Raised This Month: $ Target: $400
 0% 

[help] copy


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
katna
Senior Member
Join Date: May 2010
Old 08-23-2010 , 12:23   [help] copy
Reply With Quote #1

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'
katna is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-23-2010 , 13:47   Re: [help] copy
Reply With Quote #2

How are you accessing the date in your enum/struct?

Try
client_print( id , print_chat , "date %s" , PlayerData[ id ][ joindate ] );
__________________
Bugsy is offline
katna
Senior Member
Join Date: May 2010
Old 08-23-2010 , 13:48   Re: [help] copy
Reply With Quote #3

that exactly what im doing. I'm trying to configure whats wrong
katna is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-23-2010 , 13:56   Re: [help] copy
Reply With Quote #4

could you post the full code?
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
katna
Senior Member
Join Date: May 2010
Old 08-23-2010 , 14:17   Re: [help] copy
Reply With Quote #5

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"
katna is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-23-2010 , 15:51   Re: [help] copy
Reply With Quote #6

Show how you are displaying the values.
__________________
Bugsy is offline
katna
Senior Member
Join Date: May 2010
Old 08-23-2010 , 17:16   Re: [help] copy
Reply With Quote #7

PHP Code:
log_amx("%s"gPlayerInfo[id][DateStart]) 
katna is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-24-2010 , 19:09   Re: [help] copy
Reply With Quote #8

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
__________________
Bugsy is offline
katna
Senior Member
Join Date: May 2010
Old 08-25-2010 , 02:07   Re: [help] copy
Reply With Quote #9

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
katna is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-25-2010 , 05:48   Re: [help] copy
Reply With Quote #10

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.
__________________
Arkshine is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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