Having a problem with player spawns
#1

Hi guy's I'm having a problem setting up my player spawn, I'm extremely new to scripting so and help would be thankful.
What I'm trying to do seems very simple but somehow I'm still messing it up.

The code I'm using is.
Код:
public OnPlayerRequestClass(playerid, classid)
{
	GetPlayerPos(playerid,1481.2017,-1756.9124,17.5313);
	SetPlayerCameraPos(playerid,1481.4348,-1754.4647,16.5232,359.8627);
	SetPlayerFacingAngle(playerid,359.8627);
	SetPlayerCameraLookAt((playerid,1481.2017,-1756.9124,17.5313);
	return 1;
}
If I have done this right or not I don't know, I look okay to me anyway.

So when I compile the script I get this.
Код:
(46) : error 035: argument type mismatch (argument 2)
(47) : warning 202: number of arguments does not match definition
(49) : warning 213: tag mismatch
(49) : error 001: expected token: ",", but found ";"

Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

2 Errors.
These errors could be very simple to fix but like I said I'm new to scripting so I lost here.

Before I input this snippet of code my server run fine, but after my server_log give me this message.
Код:
[17:49:42] I couldn't load any gamemode scripts. Please verify your server.cfg
[17:49:42] It needs a gamemode0 line at the very least.
Can someone help me please.
Reply
#2

u better check ur script again or get help on wiki better
Reply
#3

pawn Код:
SetPlayerCameraLookAt((playerid,1481.2017,-1756.9124,17.5313);
You got an extra '('
pawn Код:
SetPlayerCameraLookAt(playerid,1481.2017,-1756.9124,17.5313);
@ above, If you dont know what the problem "COULD" be, dont post with anything useless.
Reply
#4

pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetPlayerPos(playerid,1481.2017,-1756.9124,17.5313);
    SetPlayerCameraPos(playerid,1481.4348,-1754.4647,16.5232,359.8627);
    SetPlayerFacingAngle(playerid,359.8627);
    SetPlayerCameraLookAt(playerid,1481.2017,-1756.9124,17.5313);
    return 1;
}
This should work fine.
Reply
#5

Thanks you ||123|| and Wesley221,

I'm still getting a warning from the compiler.
Код:
(47) : warning 202: number of arguments does not match definition
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

1 Warning.
Reply
#6

Quote:
Originally Posted by emon
Посмотреть сообщение
u better check ur script again or get help on wiki better
If your not posting to help, mind not posting at all?

I believe ||123|| has answered your question. To further understand what the problem was, you've placed to brackets after the SetPlayerCameraLookAt function. Your simply opening and closing what's within the 'parameter', which is the: (playerid,1481.2017,-1756.9124,17.5313). 2 Brackets were uncalled for.

Once you receive errors, and compilation has failed, your .amx file hasn't been created (this is the file which allows successfull execution your server or gamemode). Since your .amx file hasn't been created the server would fail to execute which would then give you the message that the gamemode could not be loaded.

I'd recommend you to read: https://sampwiki.blast.hk/wiki/Scripting_Basics
Reply
#7

Remove the last parameter in SetPlayerCameraPos. The 359.8627. You don't have to put angle here, only X, Y, and Z.
Reply
#8

Check your parameters
SetPlayerCameraPos(playerid,1481.4348,-1754.4647,16.5232,359.8627);
https://sampwiki.blast.hk/wiki/SetPlayerCameraLookAt
Reply
#9

Thank you for you help, guy's Ill read through the Wiki pages now.

Thanks again.
Reply
#10

Quote:
Originally Posted by grand.Theft.Otto
Посмотреть сообщение
As ||123|| said, you don't need the facing angle 359.8627, only X, Y, Z for SetPlayerCameraPos.

But under that, you could put SetPlayerFacingAngle(playerid,359.8627);
Quote:
Originally Posted by ADAPT
Посмотреть сообщение
Thank you for you help, guy's Ill read through the Wiki pages now.

Thanks again.
He already said it was solved and knows what was wrong, so no need to post the solution again
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)