29.01.2018, 03:30
Hi so I've made this function for banning players
but it doesn't save the information of the banned user it just kicks them I didn't want to do it the long way so on my ban command I would just do pBan(bUser, playerid, bReason, 0);.I thought someone here might know how to help me.
I don't see anything wrong with the code though as it compiles with no errors.
After I've banned myself I've checked the table in phpmyadmin and it came up empty also did testing with friends and same result.
Any support is appreciated.
Note: I am using easy-mysql to do this.
Код:
stock pBan(bUser, bUserBanner, bReason[], system = 0) { if(system == 0) { if(IsBanned[bUser] == 0) { IsBanned[bUser] = 1; new handle = SQL::Open(SQL::INSERT, SQL_BAN_TABLE); SQL::ToggleAutoIncrement(handle, true); SQL::WriteString(handle, "bUser", bNames[bUser]); SQL::WriteString(handle, "bUserBanner", GetAdminName(bUserBanner)); SQL::WriteString(handle, "bReason", bReason); SQL::WriteString(handle, "bUserIP", bIP[bUser]); SQL::Close(handle); IsBanned[bUser] = 1; new strkick[180]; format(strkick, sizeof(strkick), ""COLOR_RED" System has banned %s for: %s", pName(bUser), bReason); SendClientMessageToAll(-1, strkick); SendClientMessage(bUser, -1, ""COLOR_WHITE" If you feel this is a mistake please, visit "Website" ban appeal section!"); KickEx(bUser); } } else { if(IsBanned[bUser] == 0) { IsBanned[bUser] = 1; new handle = SQL::Open(SQL::INSERT, SQL_BAN_TABLE); SQL::ToggleAutoIncrement(handle, true); SQL::WriteString(handle, "bUser", bNames[bUser]); SQL::WriteString(handle, "bUserBanner", GetAdminName(bUserBanner)); SQL::WriteString(handle, "bReason", bReason); SQL::WriteString(handle, "bUserIp", bIP[bUser]); SQL::Close(handle); new strkick[180]; format(strkick, sizeof(strkick), ""COLOR_WHITE" %s %s has banned you for: %s", GetAdminName(bUserBanner), pName(bUserBanner), bReason); SendClientMessage(bUser, -1, strkick); SendClientMessage(bUser, -1, ""COLOR_ORANGE" If you feel this is a mistake please, visit "Website" ban appeal section!"); KickEx(bUser); } } return 1; }
I don't see anything wrong with the code though as it compiles with no errors.
After I've banned myself I've checked the table in phpmyadmin and it came up empty also did testing with friends and same result.
Any support is appreciated.
Note: I am using easy-mysql to do this.