SA-MP Forums Archive
spawnpoints help + rep - 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: spawnpoints help + rep (/showthread.php?tid=595883)



spawnpoints help + rep - ahmedraed - 09.12.2015

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




Re: spawnpoints help + rep - Vince - 09.12.2015

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.


Re: spawnpoints help + rep - ahmedraed - 09.12.2015

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


Re: spawnpoints help + rep - Threshold - 09.12.2015

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.