Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
error C2440

 
Post new topic   Reply to topic Printable version
 View previous topic  hw to bot on animaro????????????? Post :: Post Bots on AS3?  View next topic  
Author Message
minor59er
Newbie


Age:36
Gender:Gender:Male
Joined: Dec 14 2002
Posts: 11
Offline

PostPosted: Thu Feb 15, 2007 9:14 am    Post subject: error C2440 Reply to topic Reply with quote

error C2440: '=' : cannot convert from 'char' to 'char [20]'

been working at this all night anyone got any solutions for me? much appreciated.

this is in command.cpp
Code: Show/Hide
         if (c->check("reg"))
         {
            p->name = playerName[regNum];
            regNum++;
            sendPrivate(p, "You have been registerd to play this session.");
         }
Back to top
View users profile Send private message Add User to Ignore List
myke
Seasoned Helper


Gender:Gender:Male
Joined: Sep 11 2003
Posts: 142
Offline

PostPosted: Thu Feb 15, 2007 9:47 am    Post subject: Reply to topic Reply with quote

what i don't understand is why are you trying to change p->name, from what i can see it looks like you're trying to make an array'd list of people who reg for a game.


if that is what you're trying to do, try changing

Code: Show/Hide
p->name = playerName[regNum];


to

Code: Show/Hide
playerName[regNum] = p->name;
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Witchie NL
Seasoned Helper


Age:35
Gender:Gender:Male
Joined: Jul 24 2005
Posts: 112
Location: Veere, Zeeland, Netherlands
Offline

PostPosted: Thu Feb 15, 2007 10:30 am    Post subject: Reply to topic Reply with quote

indeed, p->name is an char[20] array type which cant be initialized in such a way.
however you can change the value of playerName[#] (# is regNum in this case).

so what myke sais is an option.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website MSN Messenger
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Thu Feb 15, 2007 10:36 am    Post subject: Reply to topic Reply with quote

Which is why you should actually learn C++ before trying to make bots.
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
minor59er
Newbie


Age:36
Gender:Gender:Male
Joined: Dec 14 2002
Posts: 11
Offline

PostPosted: Thu Feb 15, 2007 9:16 pm    Post subject: Reply to topic Reply with quote

Ah crap... i didn't even notice it... was so tired last night... ahahahaha, im so stupid for that. Thanks for pointing that out for me icon_smile.gif

And btw i haven't done a course but i spent a few weeks reading "C++ - How To Program, 5th Edition (2005)" so i do have some knowledge.. just didn't realize that i was trying to put an array into a pointer..
Back to top
View users profile Send private message Add User to Ignore List
Animate Dreams
Gotta buy them all!
(Consumer whore)


Age:37
Gender:Gender:Male
Joined: May 01 2004
Posts: 821
Location: Middle Tennessee
Offline

PostPosted: Thu Feb 15, 2007 9:27 pm    Post subject: Reply to topic Reply with quote

Cyan~Fire wrote:
Which is why you should actually learn C++ before trying to make bots.


I spent my time reading books and tutorials instead of actually trying to program something, and I regret that, because I still don't know how to program. But I learned 90% of what I know through attempts, not the books I read.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address MSN Messenger
Witchie NL
Seasoned Helper


Age:35
Gender:Gender:Male
Joined: Jul 24 2005
Posts: 112
Location: Veere, Zeeland, Netherlands
Offline

PostPosted: Fri Feb 16, 2007 7:57 am    Post subject: Reply to topic Reply with quote

i learned everything i know now by looking at other sources.
I did read a book from the liberary when i started coding but i stoped at chapter 4 of 17, which just where some basics (!, ==, ++, --, -=, +=, %, /, {} etc... not even array and pointers which where chapter 5).
so i had to learn practicly everything from scratch (was a bitch tho).
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website MSN Messenger
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Fri Feb 16, 2007 10:27 am    Post subject: Reply to topic Reply with quote

Well, I'm sorry reading didn't work out too well for you guys, but I definitely got my basic C++ knowledge from the tutorial I link all over the place here. Obviously coding is what makes you really understand the stuff, but if you don't get the basics (pointers, etc.) and then come running to a forum when you get a compile error, you're going about it the wrong way.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
minor59er
Newbie


Age:36
Gender:Gender:Male
Joined: Dec 14 2002
Posts: 11
Offline

PostPosted: Fri Feb 16, 2007 8:22 pm    Post subject: Reply to topic Reply with quote

Ok, since my code that ive tried hasn't worked, and i looked up usign a reinterpret_cast, and my attempt is this..

Code: Show/Hide
         if (c->check("reg"))
         {
            playerName[regNum] = reinterpret_cast <char> (p->name);
            sendPrivate(p, &playerName[regNum]);
            sendPrivate(p, "You have been registerd to play this session.");
            regNum++;
         }


But when i try to call a name from the array it comes out in
"ÅÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ"

Any ideas on this?
Back to top
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Fri Feb 16, 2007 8:52 pm    Post subject: Reply to topic Reply with quote

Read a stupid tutorial. You're copying a char, not a char array (string).

Character sequences
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
minor59er
Newbie


Age:36
Gender:Gender:Male
Joined: Dec 14 2002
Posts: 11
Offline

PostPosted: Fri Feb 16, 2007 10:14 pm    Post subject: Reply to topic Reply with quote

you don't have to be so rude.
Back to top
View users profile Send private message Add User to Ignore List
Bak
?ls -s
0 in


Age:26
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Fri Feb 16, 2007 10:39 pm    Post subject: Reply to topic Reply with quote

try this:
Code: Show/Hide
strcpy(playerName, p->name);

_________________
SubSpace Discretion: A Third Generation SubSpace Client
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Sun Feb 18, 2007 1:05 am    Post subject: Reply to topic Reply with quote

I already suggested it two times, but I'm sorry for being rude.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can 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 can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 36 page(s) served in previous 5 minutes.

phpBB Created this page in 0.510510 seconds : 38 queries executed (86.9%): GZIP compression disabled