03.02.2014, 11:18
I have a command which makes a person VIP, but it doesn't add the values it should add to the MYSQL database.
Here's the code:
If you need any more codes or information, just say so.
Thank you.
Here's the code:
Код:
if(strcmp(cmd, "/makevip", true) == 0) { GetPlayerName(playerid, sendername, sizeof(sendername)); if(PlayerInfo[playerid][pAdmin] >= 1337) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SyntaxMessage(playerid, "/makevip [playerid/name] [rank]"); return 1; } giveplayerid = ReturnUser(tmp); if(giveplayerid == INVALID_PLAYER_ID) { SendClientMessage(playerid, GREY2, "Invalid player."); return 1; } new x_string[64]; x_string = strtok(cmdtext, idx); if(!strlen(x_string)) { SyntaxMessage(playerid, "/makevip [playerid/name] [rank]"); return 1; } new year, month, day; getdate(year, month, day); if(strcmp(x_string,"0",true) == 0) { PlayerInfo[giveplayerid][pDonateRank] = 0; format(string, sizeof(string), "WARNING: %s's VIP status has been revoked by %s.",PlayerName(giveplayerid),PlayerName(playerid)); ABroadCast(RED,string,1); format(string, sizeof(string), "Your VIP has been taken away by %s.", PlayerName(playerid)); SendClientMessage(giveplayerid, RED, string); ClearVIP(giveplayerid); return 1; } else if(strcmp(x_string,"1",true) == 0) { PlayerInfo[giveplayerid][pDonateRank] = 1; format(string, sizeof(string), "WARNING: %s has been made a bronze VIP by %s.",PlayerName(giveplayerid),PlayerName(playerid)); ABroadCast(RED,string,1); format(string, sizeof(string), "You have been made a Bronze VIP by %s.", PlayerName(playerid)); SendClientMessage(giveplayerid, LIGHTBLUE, string); PlayerInfo[giveplayerid][pJoinDate][1] = day; PlayerInfo[giveplayerid][pJoinDate][2] = month; PlayerInfo[giveplayerid][pJoinDate][3] = year; PlayerInfo[giveplayerid][pExpireDate][1] = day; if ((month + 1) <= 12) { PlayerInfo[giveplayerid][pExpireDate][2] = month + 1; PlayerInfo[giveplayerid][pExpireDate][3] = year; } if ((month + 1) == 13) { PlayerInfo[giveplayerid][pExpireDate][2] = 1; PlayerInfo[giveplayerid][pExpireDate][3] = year + 1; } } else if(strcmp(x_string,"2",true) == 0) { PlayerInfo[giveplayerid][pDonateRank] = 2; format(string, sizeof(string), "WARNING: %s has been made a silver VIP by %s.",PlayerName(giveplayerid),PlayerName(playerid)); ABroadCast(RED,string,1); format(string, sizeof(string), "You have been made a Silver VIP by %s.", PlayerName(playerid)); SendClientMessage(giveplayerid, LIGHTBLUE, string); PlayerInfo[giveplayerid][pJoinDate][1] = day; PlayerInfo[giveplayerid][pJoinDate][2] = month; PlayerInfo[giveplayerid][pJoinDate][3] = year; PlayerInfo[giveplayerid][pExpireDate][1] = day; if ((month + 1) <= 12) { PlayerInfo[giveplayerid][pExpireDate][2] = month + 1; PlayerInfo[giveplayerid][pExpireDate][3] = year; } if ((month + 1) == 13) { PlayerInfo[giveplayerid][pExpireDate][2] = 1; PlayerInfo[giveplayerid][pExpireDate][3] = year + 1; } } else if(strcmp(x_string,"3",true) == 0) { PlayerInfo[giveplayerid][pDonateRank] = 3; format(string, sizeof(string), "WARNING: %s has been made a gold VIP by %s.",PlayerName(giveplayerid),PlayerName(playerid)); ABroadCast(RED,string,1); format(string, sizeof(string), "You have been made a Gold VIP by %s.", PlayerName(playerid)); SendClientMessage(giveplayerid, LIGHTBLUE, string); PlayerInfo[giveplayerid][pJoinDate][1] = day; PlayerInfo[giveplayerid][pJoinDate][2] = month; PlayerInfo[giveplayerid][pJoinDate][3] = year; PlayerInfo[giveplayerid][pExpireDate][1] = day; if ((month + 1) <= 12) { PlayerInfo[giveplayerid][pExpireDate][2] = month + 1; PlayerInfo[giveplayerid][pExpireDate][3] = year; } if ((month + 1) == 13) { PlayerInfo[giveplayerid][pExpireDate][2] = 1; PlayerInfo[giveplayerid][pExpireDate][3] = year + 1; } } else if(strcmp(x_string,"4",true) == 0) { PlayerInfo[giveplayerid][pDonateRank] = 4; format(string, sizeof(string), "WARNING: %s has been made a platinum VIP by %s.",PlayerName(giveplayerid),PlayerName(playerid)); ABroadCast(RED,string,1); format(string, sizeof(string), "You have been made a Platinum VIP by %s.", PlayerName(playerid)); SendClientMessage(giveplayerid, LIGHTBLUE, string); PlayerInfo[giveplayerid][pJoinDate][1] = day; PlayerInfo[giveplayerid][pJoinDate][2] = month; PlayerInfo[giveplayerid][pJoinDate][3] = year; PlayerInfo[giveplayerid][pExpireDate][1] = day; if ((month + 1) <= 12) { PlayerInfo[giveplayerid][pExpireDate][2] = month + 1; PlayerInfo[giveplayerid][pExpireDate][3] = year; } if ((month + 1) == 13) { PlayerInfo[giveplayerid][pExpireDate][2] = 1; PlayerInfo[giveplayerid][pExpireDate][3] = year + 1; } } else if(strcmp(x_string,"5",true) == 0) { PlayerInfo[giveplayerid][pDonateRank] = 5; format(string, sizeof(string), "WARNING: %s has been made an extended platinum VIP by %s.",PlayerName(giveplayerid),PlayerName(playerid)); ABroadCast(RED,string,1); format(string, sizeof(string), "You have been made an Extended Platinum VIP by %s.", PlayerName(playerid)); SendClientMessage(giveplayerid, LIGHTBLUE, string); PlayerInfo[giveplayerid][pJoinDate][1] = day; PlayerInfo[giveplayerid][pJoinDate][2] = month; PlayerInfo[giveplayerid][pJoinDate][3] = year; PlayerInfo[giveplayerid][pExpireDate][1] = day; if ((month + 5) <= 12) { PlayerInfo[giveplayerid][pExpireDate][2] = month + 5; PlayerInfo[giveplayerid][pExpireDate][3] = year; } if ((month + 5) >= 13) { PlayerInfo[giveplayerid][pExpireDate][2] = (month + 5) - 12; PlayerInfo[giveplayerid][pExpireDate][3] = year + 1; } } if (PlayerInfo[giveplayerid][pDonateRank] == 1 || PlayerInfo[giveplayerid][pDonateRank] == 2 || PlayerInfo[giveplayerid][pDonateRank] == 3 || PlayerInfo[giveplayerid][pDonateRank] == 4 || PlayerInfo[giveplayerid][pDonateRank] == 5) { SendClientMessage(giveplayerid, WHITE, "HINT: Type /help to see your new VIP commands."); } } else { SendClientMessage(playerid, GREY, " You are not authorized to use this command."); } return 1; }
Thank you.