error 029: invalid expression, assumed zero & warning 215: expression has no effect
#1

Код:
CMD:changegatepass(playerid, params[])
{
	new string[128];
	if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /changegatepass [pass]");

	if(strlen(params) > 24)
	{
		SendClientMessageEx(playerid, COLOR_GRAD2, " Must be 24 characters or less! ");
		return 1;
	}
	new ownsgate;
	for(new i = 0; i < sizeof(GateInfo); i++)
	{
	/* error here*/      if((PlayerInfo[playerid][pPhousekey] == GateInfo[i][gHID])) && (PlayerInfo[playerid][pPhousekey2] == GateInfo[i][gHID]);
		{
			ownsgate = 1;
			format(string, sizeof(string), "Gate Password for gate %d changed to %s", i, params);
			format(GateInfo[i][gPassword], 24, "%s", params);
			SendClientMessageEx(playerid, COLOR_GRAD2, string);
			SaveGates();
		}
	}
	if(!ownsgate) SendClientMessageEx(playerid, COLOR_WHITE, "* You don't own a gate");
	return 1;

}
Reply
#2

Try this:
PHP код:
CMD:changegatepass(playeridparams[])
{
    new 
string[128];
    if(
isnull(params)) return SendClientMessageEx(playeridCOLOR_WHITE"USAGE: /changegatepass [pass]");

    if(
strlen(params) > 24)
    {
        
SendClientMessageEx(playeridCOLOR_GRAD2" Must be 24 characters or less! ");
        return 
1;
    }
    new 
ownsgate;
    for(new 
0sizeof(GateInfo); i++)
    {
    if(
PlayerInfo[playerid][pPhousekey] == GateInfo[i][gHID] && PlayerInfo[playerid][pPhousekey2] == GateInfo[i][gHID])
        {
            
ownsgate 1;
            
format(stringsizeof(string), "Gate Password for gate %d changed to %s"iparams);
            
format(GateInfo[i][gPassword], 24"%s"params);
            
SendClientMessageEx(playeridCOLOR_GRAD2string);
            
SaveGates();
        }
    }
    if(!
ownsgateSendClientMessageEx(playeridCOLOR_WHITE"* You don't own a gate");
    return 
1;


Reply
#3

thank you very much for helping me I appreciate it
Reply
#4

First of all, don't use a semicolon in an "if".
Second, you end the if, and then try continuing it with &&, you've opened 2 parenthesises as marked here with red and darkred:
Quote:

if((PlayerInfo[playerid][pPhousekey] == GateInfo[i][gHID])) && (PlayerInfo[playerid][pPhousekey2] == GateInfo[i][gHID]);

And then you close them again, so essentially the if is done, but then you try using && PlayerInfo, although you already ended the if.
It's like braces, you're trying to do something like this:
pawn Код:
public OnGameModeInit()
{
    print("Gamemode started.");
}

print("Welcome to your new gamemode.");
You cannot do this, as you already ended the OnGameModeInit function, you gotta do it like this:
Quote:

if((PlayerInfo[playerid][pPhousekey] == GateInfo[i][gHID]) && (PlayerInfo[playerid][pPhousekey2] == GateInfo[i][gHID]))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)