Errors in class create...
#1

Hey SA-MP! I am making a gamemode as some of you know.
I am trying to make is as unique as possible.
But... I got an error and now I am stuck...

my code:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
    SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
    return 1;
 }
switch(classid)
 {
case 0: test
}
my errors:
pawn Код:
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\SFP C R6\gamemodes\sfp.pwn(66) : warning 217: loose indentation
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\SFP C R6\gamemodes\sfp.pwn(795) : error 010: invalid function or declaration
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\SFP C R6\gamemodes\sfp.pwn(797) : error 010: invalid function or declaration
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\SFP C R6\gamemodes\sfp.pwn(799) : error 054: unmatched closing brace ("}")
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


3 Errors.
Thanks for your time and help
Reply
#2

pawn Код:
switch(classid)
 {
case 0: test
}
Remove it and put it in OnPlayerRequestClass, not outside it!
One thing you should read some tutorials and manuals this is a very obvious error, no offense.
Reply
#3

Quote:
Originally Posted by admantis
Посмотреть сообщение
pawn Код:
switch(classid)
 {
case 0: test
}
Remove it and put it in OnPlayerRequestClass, not outside it!
One thing you should read some tutorials and manuals this is a very obvious error, no offense.
Код:
public OnPlayerRequestClass(playerid, classid)
{
switch(classid)
 {
case 0: test
//and so on
}
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
 }
pawn Код:
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\SFP C R6\gamemodes\sfp.pwn(78) : warning 217: loose indentation
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\SFP C R6\gamemodes\sfp.pwn(804) : error 017: undefined symbol "test"
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\SFP C R6\gamemodes\sfp.pwn(804 -- 806) : warning 215: expression has no effect
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\SFP C R6\gamemodes\sfp.pwn(806) : error 001: expected token: ";", but found "}"
C:\Users\Alex - Webhost\Desktop\Divinity Gaming Comunity\SA-MP\SFP C R6\gamemodes\sfp.pwn(807) : warning 217: loose indentation
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Reply
#4

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    switch(classid)
    {
        case 0: {
            SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
            SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
            SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
        }
        case 1: {
            // your code
        }
    }
    return 1;
 }
Reply
#5

Quote:
Originally Posted by admantis
Посмотреть сообщение
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    switch(classid)
    {
        case 0: {
            SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
            SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
            SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
        }
        case 1: {
            // your code
        }
    }
    return 1;
 }
Thank you, now if I want to add text how do I do that?
and if I want to do case 2 and diff camera view I do this righT?
Код:
	switch(classid)
	{
		case 2: {
			SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
			SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
			SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
		}
		case 3: {
			// your code
		}
	}
or

Код:
{
	switch(classid)
	{
		case 0: {
			SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
			SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
			SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
		}
		case 1: {
			SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
			SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
			SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
		}
	}
	return 1;
Reply
#6

Quote:
Originally Posted by propilot
Посмотреть сообщение
That you, now if I want to add text how do I do that?
and if I want to do case 2 and diff camera view I do this righT?
Код:
	switch(classid)
	{
		case 2: {
			SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
			SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
			SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
		}
		case 3: {
			// your code
		}
	}
or

Код:
{
	switch(classid)
	{
		case 0: {
			SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
			SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
			SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
		}
		case 1: {
			SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
			SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
			SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
		}
	}
	return 1;
Use GameTextForPlayer (look in wiki). Case 1 is the new position and camera positions to be taken when you choose classid 1 (NOTE: NOT SKIN ID 1)
Reply
#7

Quote:
Originally Posted by Hoborific
Посмотреть сообщение
That second one is how you would do it.
alright will do. To be sure
How do I have to add the text in the middle of the screen?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)