Jump to content
  • 0

Probleme update mysql


Xcite

Question

Am facut la comanda /ban sa introduca intr-un tabel mysql , dar nu se introduce , care poate fi problema:

  	if(strcmp(cmd, "/ban", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	    	tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ban [playerid/PartOfName] [reason]");
				return 1;
			}
			giveplayerid = ReturnUser(tmp);
			if (PlayerInfo[playerid][pAdmin] >= 1)
			{
			    if(IsPlayerConnected(giveplayerid))
			    {
			        if(giveplayerid != INVALID_PLAYER_ID)
			        {
					    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
						GetPlayerName(playerid, sendername, sizeof(sendername));
						new length = strlen(cmdtext);
						while ((idx < length) && (cmdtext[idx] <= ' '))
						{
							idx++;
						}
						new offset = idx;
						new result[64];
						while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
						{
							result[idx - offset] = cmdtext[idx];
							idx++;
						}
						result[idx - offset] = EOS;
						if(!strlen(result))
						{
							SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ban [playerid/PartOfName] [reason]");
							return 1;
						}
						if(bantime[playerid] == 1) return SendClientMessage(playerid, COLOR_GRAD2, "Are you trying to ban this server?");
						new string23[128];
						new Query[128];
						new playersip[256];
						GetPlayerIp(giveplayerid,playersip, sizeof(playersip));
						new year, month, day, hour, minute , second;
						getdate(year, month, day);
						gettime(hour, minute, second);
						format(string23, sizeof(string23), "%02d/%02d/%d %02d:%02d", day, month, year, hour, minute);
    					format(Query, sizeof(Query), "INSERT INTO `banlog` (`user`, `admin`, `reason`, `data`, `ip`) VALUES ('%s', '%s', '%s', '%s', '%s')", giveplayer, sendername, (result), string23, playersip);
						mysql_query(Query);
						mysql_free_result();
						format(string23, sizeof(string23), "AdmCmd: %s was banned by %s, reason: %s", giveplayer, sendername, (result));
						SendClientMessageToAll(COLOR_LIGHTRED, string23);
					    SendClientMessage(giveplayerid,COLOR_GREEN,"|___________[BAN INFO]___________|");
			            format(string23, sizeof(string23), "Numele tau este: %s.",giveplayer);
                        SendClientMessage(giveplayerid, COLOR_RED, string23);
                        format(string23, sizeof(string23), "IP-ul tau este: %s.",playersip);
                        SendClientMessage(giveplayerid, COLOR_RED, string23);
                        format(string23, sizeof(string23), "Ai fost banat de: %s.",sendername);
                        SendClientMessage(giveplayerid, COLOR_RED, string23);
                        format(string23, sizeof(string23), "Motiv: %s.",(result));
                        SendClientMessage(giveplayerid, COLOR_RED, string23);
                        format(string23, sizeof(string23), "Data: %d/%d/%d",day,month,year);
                        SendClientMessage(giveplayerid, COLOR_RED, string23);
                        SendClientMessage(giveplayerid,COLOR_GREEN,"|___________[BAN INFO]___________|");
                        SendClientMessage(giveplayerid,COLOR_RED,"Puteti face o cerere de unban pe forum www.EvGaming.Ro/forum");
                        SendClientMessage(giveplayerid,COLOR_RED,"Este necesara o poza cu aceste detalii despre ban !");
                        bantime[playerid] = 1;
          	   			SetTimerEx("bant", 10000, 0, "%d", playerid);
                        PlayerInfo[giveplayerid][pLocked] = 1;
                        Kick(giveplayerid);
						return 1;
					}
				}//not connected
			}
			else
			{
				format(string, sizeof(string), "   %d is not an active player.", giveplayerid);
				SendClientMessage(playerid, COLOR_GRAD1, string);
			}
		}
		return 1;
	}

Care poate fi problema ? nu insereaza in baza de date .

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

Apare asa :

CMySQLHandler::Query(INSERT INTO `banlog` (`user`, `admin`, `reason`, `data`, `ip`) VALUES ('Chris', 'Chris', 'test', '09/08/2011 09:20', '127.0.0.1) - An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''127.0.0.1' at line 1) [09:20:42] >> mysql_query( Connection handle: 1 )

Vad ca nu introduce bine ip-ul , da eroare cand sa introduca ip-ul . ( ip e de la localhost , pentru ca lam pornit pe localhost )

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.