Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[C++] Easy coding help

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
kopelito
Master Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 483

PostPosted: Tue May 13, 2008 7:23 am    Post subject: [C++] Easy coding help Reply with quote

In the following script:

Code:
sprintf_s(text, 999, "%s need Help from GM",player->getName() );



What does the 'text,999' means?
Back to top
View user's profile Send private message
Ferocious
Advanced Cheater
Reputation: 0

Joined: 06 Feb 2008
Posts: 54

PostPosted: Tue May 13, 2008 7:41 am    Post subject: Reply with quote

sprintf_s prints the following strings into a buffer,

"text" is the variable of the buffer and 999 is the size of the buffer,

http://msdn.microsoft.com/en-us/library/ce3zzk1k(VS.80).aspx
Back to top
View user's profile Send private message
Estx
Expert Cheater
Reputation: 0

Joined: 04 Mar 2008
Posts: 172

PostPosted: Tue May 13, 2008 7:47 am    Post subject: Reply with quote

Edit: Beat me to it lol

http://msdn.microsoft.com/en-us/library/ce3zzk1k%28VS.80%29.aspx

'text' is the buffer where the string will be placed.
'999' is the maximum length of the buffer.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Tue May 13, 2008 8:36 am    Post subject: Reply with quote

x0r wrote:
The 'safe' APIs are painfully stupid, especially since you could simply do '%16s' instead.


Your max size would be static then, while the new safe versions allow the sizes to be dynamic. They are far from stupid. Wink

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
kopelito
Master Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 483

PostPosted: Tue May 13, 2008 8:55 am    Post subject: Reply with quote

Thanks for helping my guys.

But I have nother problem:

Whats wrong with this code?

Code:
sprintf_s(text, 999,next_token "Is now moved to henesys",player->getName() );


I made a command in maplestory that moves people to henesys when I write
!move Player

then I want a notice message saying 'Player is now moved to henesys'.

Player is a name of course.
Back to top
View user's profile Send private message
Symbol
I'm a spammer
Reputation: 0

Joined: 18 Apr 2007
Posts: 5094
Location: Israel.

PostPosted: Tue May 13, 2008 8:58 am    Post subject: Reply with quote

You can't do that, the third parameter is a string.

Try:
Code:
sprintf_s(text, 999, "%s is now at %s",player->getName(), next_token, map_name);


I don't know how to get map's name... check '/find' function.
Back to top
View user's profile Send private message
kopelito
Master Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 483

PostPosted: Tue May 13, 2008 9:30 am    Post subject: Reply with quote

So, if ill do like "!move Damn"
Is it impossible to print "Damn is now moved..."?
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Tue May 13, 2008 3:52 pm    Post subject: Reply with quote

kopelito wrote:
So, if ill do like "!move Damn"
Is it impossible to print "Damn is now moved..."?


Just edit the printout to say what you need, then remove the extra vars at the end:

Code:
sprintf_s( text, 999, "%s is now moved...", player->GetName() );

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
kopelito
Master Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 483

PostPosted: Wed May 14, 2008 11:31 am    Post subject: Reply with quote

Ok, got it solved.
The problem is now solved :]
Thanks ppl!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites