SA-MP Forums Archive
can not spawn in place that has been specified - 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: can not spawn in place that has been specified (/showthread.php?tid=624596)



can not spawn in place that has been specified - kloning1 - 19.12.2016

I am confused, maybe the people here can help me
I've done debugging, code I've loaded correctly
but when I enter the code, my character did not spawn correctly

make my server takes a lot of ram
Код:
enum mapinfos
{
	mapid = 1,
	NamaMap[64],
	HumanX[24],
	HumanY[24],
	HumanZ[24],
	ZombieX[24],
	ZombieY[24],
	ZombieZ[24]
};
new MapInfo[mapinfos];

public OnPlayerSpawn(playerid)
{
	if(GetPlayerTeam(playerid) == ZOMBIE)
    {
    	SetPlayerInterior(playerid, MapInfo[Interior]);
		SetPlayerPos(playerid, MapInfo[HumanX], MapInfo[HumanY], MapInfo[HumanZ]); // tag mismatch 194
    }
    else
    {
	    SetPlayerInterior(playerid, MapInfo[Interior]);
		SetPlayerPos(playerid, MapInfo[ZombieX], MapInfo[ZombieY], MapInfo[ZombieZ]); // tag mismatch 194
    }
	return 1;
}



Re: can not spawn in place that has been specified - Hansrutger - 19.12.2016

Try to make the HumanX, Y, Z and ZombieX, Y, Z floats instead since you seem to want them to be used as floats in SetPlayerPos. Not sure why you made them arrays

To make a variable a float in pawn, put "Float:" in front of the variable name, example:
Код:
new Float:myvar;



Re: can not spawn in place that has been specified - Luicy. - 19.12.2016

A position or so called coordinate is in the form of floats, what you have defined them as is as strings. Difference by these two is that floats are decimal such as:
1.00005
and a string is text.. such as:
"Hello world!"
If you look at ****** maps and enter a coord, you'll notice it'll show as a float. Here's a fixed code:
PHP код:
enum mapinfos
{
    
mapid = 1,
    
NamaMap[64],
    
Float:HumanX,
    
Float:HumanY,
    
Float:HumanZ,
    
Float:ZombieX,
    
Float:ZombieY,
    
Float:ZombieZ
}; 



Re: can not spawn in place that has been specified - kloning1 - 22.12.2016

thanks man its working,