I'm making Vote system (+rep help)
#1

I just need to know how to add new Yes[counts]; and new No[counts];
Example:
Код HTML:
new string[256];
format(string, sizeof(string), -1, "[VOTE] Votes: Yes: %d No: %d", Yes[counts], No[counts]);
SCMA(-1, string)
Ik its simple but idk how to do it..
I know how to make YCMD:/vote with sscanf that will add +1.. but idk how to define [counts] or whatever
Reply
#2

You shouldn't use arrays in this manner...

Also, your string size being 256 is silly, as the client can only display 144 on a single line, and even then your string will never be of a size that will exceed 40.

PHP код:
new Votes[2];
new 
string[40];
format(stringsizeof(string), -1"[VOTE] Votes: Yes: %d No: %d"Votes[1], Votes[0]);
SCMA(-1string); 
I've simply done [1] to be yes, and [0] to be no, as it's because 1 is usually a positive, and 0 is usually a false.

This is also not tested, but it should be something. You could do VoteYes, VoteNo as normal variables, and use them that way, but seeing as you were trying to use a an array, I thought it could be something to highlight to teach you regarding the array misuse.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)