4 Errors
#1

Someone please help me! I get 4 errors in this:
Код:
	Gate=CreateObject(971, -301.64, 1507.90, 77.91,   0.00, 0.00, 0.00);
 	return 1;
}
	public OnPlayerCommandText(playerid, cmdtext[])
	{
	if (strcmp("/open", cmdtext, true, 10) ==0) 
    if(!IsPlayerAdmin(playerid))
	{
	SendClientMessage(playerid,0xFF0000AA,"You can't use this command.");
	return 1;
	}
  	MoveObject(Gate, -310.7321, 1507.9795, 77.9132 , 3);
   	SendClientMessage(playerid, 0xAA3333AA," You opened the gate"); 
	return 1;
}

	if (strcmp("/close", cmdtext, true, 10) ==0)
    if(!IsPlayerAdmin(playerid))
	{
	SendClientMessage(playerid,0xFF0000AA,"You can't use this command.");
	return 1;
	}
  	MoveObject(Gate, -301.6442, 1507.8981, 77.9132 , 3);
   	SendClientMessage(playerid, 0xAA3333AA,"You closed the Gate");
	return 1;
}
Reply
#2

what errors?
Reply
#3

I beleive it's
pawn Код:
if(strcmp(cmdtext, "/open", true, 10) ==0)
not
pawn Код:
if (strcmp("/open", cmdtext, true, 10) ==0)
Reply
#4

Well use the below code.It must work

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/open", cmdtext, true, 10) ==0)
        {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFF0000AA,"You can't use this command.");
    MoveObject(Gate, -310.7321, 1507.9795, 77.9132 , 3);
    SendClientMessage(playerid, 0xAA3333AA," You opened the gate");
    return 1;
        }

    if (strcmp("/close", cmdtext, true, 10) ==0)
        {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFF0000AA,"You can't use this command.");
    MoveObject(Gate, -301.6442, 1507.8981, 77.9132 , 3);
    SendClientMessage(playerid, 0xAA3333AA,"You closed the Gate");
        return 1;
        }
    return 1;
}
Reply
#5

Quote:
Originally Posted by Gamer_007
Посмотреть сообщение
Well use the below code.It must work

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/open", cmdtext, true, 10) ==0)
        {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFF0000AA,"You can't use this command.");
    MoveObject(Gate, -310.7321, 1507.9795, 77.9132 , 3);
    SendClientMessage(playerid, 0xAA3333AA," You opened the gate");
    return 1;
        }

    if (strcmp("/close", cmdtext, true, 10) ==0)
        {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xFF0000AA,"You can't use this command.");
    MoveObject(Gate, -301.6442, 1507.8981, 77.9132 , 3);
    SendClientMessage(playerid, 0xAA3333AA,"You closed the Gate");
        return 1;
        }
    return 1;
}
That works, but with 3 warnings

Код:
Los Santos [Modified] [WIP].pwn(476) : warning 217: loose indentation
Los Santos [Modified] [WIP].pwn(474) : warning 217: loose indentation
Los Santos [Modified] [WIP].pwn(466) : warning 217: loose indentation
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)