PlayerInfo Problem
#1

I'm finishing a business system and now so close to finalizing, a problem has arisen in a command. You are the owner of the company when you fire the player, everything seems perfect . The company is clean but the player who is fired, the column on Mysql "Emp" (Is what detect that the player is in a company) don't is set to 0. I've tried to do everything but nothing works.

Thank you for all help, it's important.

The command is currently like that, i ran out of alternatives.


Код:
CMD:removeslot1(playerid,params[])
{
    new string[1100], Query[130];
    for(new i = 0; i < MAX_PLAYERS; i++)
    for(new c = 0; c < MAX_PROPIEDADES; c++)
    {
		if(IsPlayerInRangeOfPoint(playerid,2.5,PropInfo[c][pPosX],PropInfo[c][pPosY],PropInfo[c][pPosZ]))
		{
 			if(!strcmp(PropInfo[c][pPropietario], NombreJugador(playerid), true))
			{
				if(strcmp(PropInfo[c][pFunc], NombreJugador(playerid), true) || strcmp(PropInfo[c][pFunc1], NombreJugador(playerid), true) || strcmp(PropInfo[c][pFunc2], NombreJugador(playerid), true) || strcmp(PropInfo[c][pFunc3], NombreJugador(playerid), true))
				{
   					if(!strcmp(PropInfo[c][pFunc], NombreJugador(i)))
					{
						PlayeriInfo[i][pEmp] = 0;
					}
					format(string, 128,"You {ff0000} fired {FFFFFF} from company {0066ff}% s {FFFFFF} who worked in production {0066ff} 1 {FFFFFF}.", PropInfo[c][pFunc]);
					SendClientMessage(playerid, -1, string);
					format(Query,sizeof(Query),"UPDATE `usuarios` SET `Emp`='0' WHERE `ID`=%d",PropInfo[c][pFunc]);
					mysql_function_query(Conecction,Query,true,"","");
     				CargarPropiedad©;
					format(Query,sizeof(Query),"UPDATE `propiedades` SET `Func`='Nobody' WHERE `ID`=%d",PropInfo[c][pID]);
					mysql_function_query(Conecction,Query,true,"","");
					format(PropInfo[c][pFunc], 24, "Nobody");
					break;
				}
	 			else return SendClientMessage(playerid, COLOR_ROJO, "The slot is busy!");
     		}
			else return SendClientMessage(playerid, COLOR_ROJO, "You aren't the owner of this company.");
		}
	}
	return 1;
}
Reply
#2

Not sure if this is right or not.. Maybe you should put " PropInfo[c][pID] " instead of " PropInfo[c][pFunc] " ?

PHP код:
                    format(Query,sizeof(Query),"UPDATE `usuarios` SET `Emp`='0' WHERE `ID`=%d",PropInfo[c][pID]);
                    
mysql_function_query(Conecction,Query,true,"",""); 
Reply
#3

Quote:
Originally Posted by AzaMx
Посмотреть сообщение
Not sure if this is right or not.. Maybe you should put " PropInfo[c][pID] " instead of " PropInfo[c][pFunc] " ?

PHP код:
                    format(Query,sizeof(Query),"UPDATE `usuarios` SET `Emp`='0' WHERE `ID`=%d",PropInfo[c][pID]);
                    
mysql_function_query(Conecction,Query,true,"",""); 
Why should he include pID tho when there's nothing to do with the player id?
Reply
#4

Quote:
Originally Posted by willbedie
Посмотреть сообщение
Why should he include pID tho when there's nothing to do with the player id?
My bad copy, i did this.

Код:
format(Query,sizeof(Query),"UPDATE `usuarios` SET `Emp`='0' WHERE `Username`=%s",PropInfo[c][pFunc]); 
mysql_function_query(Conecction,Query,true,"","");
Func = Slot of company that have the name of employee.

But doesn't work. Unfortunately
Reply
#5

Код:
format(Query,sizeof(Query),"UPDATE `usuarios` SET `Emp`='0' WHERE `Username`=%s",PropInfo[c][pFunc]); 
mysql_function_query(Conecction,Query,true,"","");
What is 'pFunc'? Also, you should escape your strings.
Reply
#6

Anything in the SQL log?
Код:
format(Query,sizeof(Query),"UPDATE `usuarios` SET `Emp`='0' WHERE `Username`=%s",PropInfo[c][pFunc]); 
// should have single quote enclosing %s -> '%s'
Reply
#7

Quote:
Originally Posted by Grim_
Посмотреть сообщение
Anything in the SQL log?
Код:
format(Query,sizeof(Query),"UPDATE `usuarios` SET `Emp`='0' WHERE `Username`=%s",PropInfo[c][pFunc]); 
// should have single quote enclosing %s -> '%s'
Unfortunately, nothing


Код:
CMD:demitirvaga1(playerid,params[])
{
    new string[1100], Query[130];
    for(new i = 0; i < MAX_PLAYERS; i++)
    for(new c = 0; c < MAX_PROPIEDADES; c++)
    {
		if(IsPlayerInRangeOfPoint(playerid,2.5,PropInfo[c][pPosX],PropInfo[c][pPosY],PropInfo[c][pPosZ]))
		{
 			if(!strcmp(PropInfo[c][pPropietario], NombreJugador(playerid), true))
			{
				if(strcmp(PropInfo[c][pFunc], NombreJugador(playerid), true) || strcmp(PropInfo[c][pFunc1], NombreJugador(playerid), true) || strcmp(PropInfo[c][pFunc2], NombreJugador(playerid), true) || strcmp(PropInfo[c][pFunc3], NombreJugador(playerid), true))
				{
					format(string, 128,"Vocк {ff0000}demitiu{FFFFFF} da empresa {0066ff}%s{FFFFFF} que trabalhava na produзгo {0066ff}1{FFFFFF}.", PropInfo[c][pFunc]);
					SendClientMessage(playerid, -1, string);
     				CargarPropiedad©;
					format(Query,sizeof(Query),"UPDATE `usuarios` SET `Emp`='0' WHERE `Username`='%s'",PropInfo[c][pFunc]);
					mysql_function_query(Conecction,Query,true,"","");
					format(Query,sizeof(Query),"UPDATE `propiedades` SET `Func`='Ninguem' WHERE `ID`=%d",PropInfo[c][pID]);
					mysql_function_query(Conecction,Query,true,"","");
					format(PropInfo[c][pFunc], 24, "Ninguem");
					break;
				}
	 			else return SendClientMessage(playerid, COLOR_ROJO, "Nгo а ninguem ocupando a vaga 1!");
     		}
			else return SendClientMessage(playerid, COLOR_ROJO, "Vocк nгo й o dono dessa empresa.");
		}
	}
	return 1;
}
Reply
#8

So,

Код:
format(string, 128,"Vocк {ff0000}demitiu{FFFFFF} da empresa {0066ff}%s{FFFFFF} que trabalhava na produзгo {0066ff}1{FFFFFF}.", PropInfo[c][pFunc]);
SendClientMessage(playerid, -1, string);
Does this message shows the correct username?
Reply
#9

Check logs/plugin/mysql.txt or logs/errors.txt if you're using mysql version 39+
Reply
#10

Quote:
Originally Posted by UFF
Посмотреть сообщение
So,

Код:
format(string, 128,"Vocк {ff0000}demitiu{FFFFFF} da empresa {0066ff}%s{FFFFFF} que trabalhava na produзгo {0066ff}1{FFFFFF}.", PropInfo[c][pFunc]);
SendClientMessage(playerid, -1, string);
Does this message shows the correct username?
Yes, the message shows corretcly
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)