SA-MP Forums Archive
4 Errors - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: 4 Errors (/showthread.php?tid=439376)



4 Errors - nerovani - 25.05.2013

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;
}



Re: 4 Errors - DobbysGamertag - 25.05.2013

what errors?


Re: 4 Errors - mahdi499 - 25.05.2013

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



Re: 4 Errors - Gamer_007 - 25.05.2013

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;
}



Re: 4 Errors - nerovani - 25.05.2013

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