SA-MP Forums Archive
Whats Wrong Here? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Whats Wrong Here? (/showthread.php?tid=103913)



Whats Wrong Here? - Danikov - 21.10.2009

What is wrong?

Код:
public OnPlayerRequestClass(playerid, classid)
{
	{
	SetPlayerPos(playerid, 222.1653,1823.0802,6.4141);
	SetPlayerFacingAngle(playerid, 269.1334);
	SetPlayerCameraPos(playerid, 224.1104,1823.0507,6.4141);
	SetPlayerCameraLookAt(playerid, 222.1653,1823.0802,6.4141);
	return 1;
	}
	
	{
  gClass[playerid] = classid;
  return 1;
	}
	
	
}
I Do this and i get an error that there is something wrong with the }

Error:

Код:
D:\Documents and Settings\victor\Desktop\SAMP Server\pawno\A51.pwn(112) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.



Re: Whats Wrong Here? - Correlli - 21.10.2009

You can't just open a bracket and put some code in it and then close it just like that.

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
  SetPlayerPos(playerid, 222.1653, 1823.0802, 6.4141);
  SetPlayerFacingAngle(playerid, 269.1334);
  SetPlayerCameraPos(playerid, 224.1104, 1823.0507, 6.4141);
  SetPlayerCameraLookAt(playerid, 222.1653, 1823.0802, 6.4141);
  gClass[playerid] = classid;
  return 1;
}
This is correct.


Re: Whats Wrong Here? - Luka P. - 21.10.2009

You have two brackets ( { ) before you start the code.Delete one. And you have two brackets ( } ) after return.
So final code looks
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 222.1653,1823.0802,6.4141);
    SetPlayerFacingAngle(playerid, 269.1334);
    SetPlayerCameraPos(playerid, 224.1104,1823.0507,6.4141);
    SetPlayerCameraLookAt(playerid, 222.1653,1823.0802,6.4141);

    gClass[playerid] = classid;
    return 1;
}
EDIT: Don, we was writing in same time.