spawnpoints help + rep
#1

Can anyone help me with this?! i wanna make 3different spawnpoints, this is just the first spawnpoint but it crashes the pawno
Quote:

new Float:EventSpawn[][] =
{
{GetPVarFloat(playerid,"xpos1"), GetPVarFloat(playerid,"ypos1"), GetPVarFloat(playerid,"zpos1")},
};

Quote:

CMDos(playerid, params[])
{
if(sscanf(params, "i", amount) return SendClientMessage(playerid, RED, "ERROR: /pos [1-3]");
if(amount == 1)
{
GetPlayerPos(playerid,x,y,z);
SetPVarFloat(playerid,"xpos1",x);
SetPVarFloat(playerid,"ypos1",y);
SetPVarFloat(playerid,"zpos1",z);
SendClientMessage(playerid, GREEN, "Position 1 Has Been Set!");
Info[Pos] = 1;
}

Reply
#2

Yeah well, that's impossible. You can't initialize a variable with another variable. All values must be known at compile time, which means they must be constants.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
Yeah well, that's impossible. You can't initialize a variable with another variable. All values must be known at compile time, which means they must be constants.
it is possible ;-; i saw a server doing this
Reply
#4

Yes, different spawnpoints are possible. But the method in which you are trying to create that, is impossible...

As mentioned above...

Quote:
Originally Posted by Vince
You can't initialize a variable with another variable. All values must be known at compile time, which means they must be constants.
First of all, you are trying to create a global variable with a function, "GetPVarFloat", which:
A - Requires a 'playerid', meaning it cannot be created upon compilation.
B - Must be used within a function or callback, not when defining a global variable.
C - Has a return variable, subject to change.

You could only apply the results of "GetPVarFloat" in a callback or function with a 'playerid' parameter... you cannot do it at compile time... you need definite numbers when declaring float values, not more variables...

Again, as Vince said, this:
Код:
new Float:EventSpawn[][] =
{
{GetPVarFloat(playerid,"xpos1"), GetPVarFloat(playerid,"ypos1"), GetPVarFloat(playerid,"zpos1")},
};
is impossible.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)