pawnoOo Posted 1 hour ago Posted 1 hour ago (edited) Dupa ce voteaza primarul nu aduna variabila VoteMayor[id][jVote] din meniul /votelist Cand Voteaza: Quote case DIALOG_VOTE_MAYOR: { if(!response) return 1; new name[32]; GetPVarString(playerid, "playerName", name, sizeof(name)); new userID = VoteMayorGetPlayerID(name); if(userID != INVALID_PLAYER_ID) { VoteMayor[userID][jVotes] += 1; format(string, sizeof(string), "%s te-a votat ca primar.", GetName(playerid)); SCM(userID, -1, string); } format(string, sizeof(string), "UPDATE `votemayor` SET `Votes`=`Votes`+1 WHERE `Name`='%s'", name); mysql_tquery(SQL,string, "", ""); format(string, sizeof(string), "L-ai votat pe %s ca primar al comunitatii.", name); SCM(playerid, COLOR_LGREEN, string); } Meniul /votelist (aici nu incarca voturile (VoteMayor[j][jVotes]) dar in baza de date incarca): Quote CMD:votelist(playerid, params[]) { new szDialog[1024], szDialog2[1024], szTitle[50], xx; strcat(szDialog2, "Candidates\tVotes\n"); for(new j = 0; j < MAX_PLAYERS; j++) { if(strlen(VoteMayor[j][jName]) >= 1) { format(szDialog, sizeof(szDialog), "%s\t%d\n", VoteMayor[j][jName], VoteMayor[j][jVotes]); strcat(szDialog2, szDialog); xx++; } } format(szTitle, sizeof(szTitle), "Candidates: %d", xx); ShowPlayerDialog(playerid, 0, DIALOG_STYLE_TABLIST_HEADERS, szTitle, szDialog2, "Cancel", ""); return 1; } Edited 1 hour ago by pawnoOo
0 pawnoOo Posted 42 minutes ago Author Posted 42 minutes ago functia VoteMayorGetPlayerID Quote stock VoteMayorGetPlayerID(playerName[]) { foreach(Player, i) { if(IsPlayerConnected(i) && IsPlayerLogged[i] == 1) { if(strcmp(VoteMayor[i][jName], playerName, true) == 0) return i; } } return INVALID_PLAYER_ID; }
Question
pawnoOo
Dupa ce voteaza primarul nu aduna variabila VoteMayor[id][jVote] din meniul /votelist
Cand Voteaza:
Meniul /votelist (aici nu incarca voturile (VoteMayor[j][jVotes]) dar in baza de date incarca):
Edited by pawnoOo1 answer to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now