Spawn under BlueBerry...
#1

(Sorry for my english, i'm not english).

Hi guys.

I've a serious problem since 3 days... I begin in Pawn and GTA SAMP Server, and i would like create a save position system. So a script who save your position to deconnexion and load position at connexion.

For this, i used a script that i found on the forum, and i've put this in my GM, correctly. But, now when a create a new character (so a new account) i spawn under blueberry for spawn in the corner of blueberry. I search for 3 days, i asked here but my topic was not enought explicit.

I think i've understand the problem. Look my script:

Quote:

#include <a_samp>
#include <Dini>
#include <dudb>


new Floatositionx;
new Floatositiony;
new Floatositionz;




public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("CannaWeed");
AddPlayerClass(26,1770.0427,-1861.8036,13.5771,0.8459,0,0,0,0,0,0); // OnGameInit Spawn Gare
return 1;
}

-> So i've create a AddPlayerClass in OnGameModeInit, after:




public OnPlayerConnect(playerid)
{
SendClientMessage(playerid,COLOR_GREEN,"Bienvenue sur .: [FR] :. .: CannaWeed Serveur :. .: [0.3x] :.");
SendClientMessage(playerid,HELP_COLOR,"Astuce: Pour voir la liste des commandes tapez /aide");
SendClientMessage(playerid,AV_COLOR,"Appuyez sur le bouton SPAWN en bas а droite pour apparaоtre");
LoadStats(playerid);
return 1;
}



public OnPlayerDisconnect(playerid, reason)
{
new Float;
new Float:y;
new Float:z;

GetPlayerPos(playerid,x,y,z);
positionx = x;
positiony = y;
positionz = z;
if (!dini_Exists(FileStats(playerid)))
{
dini_Create(FileStats(playerid));
}
SaveStats(playerid);
}


public OnPlayerSpawn(playerid)
{
SetPlayerPos(playerid,positionx,positiony,position z);
return 1;
}

Player(playerid)
{
new player[MAX_PLAYER_NAME];
GetPlayerName(playerid, player, sizeof(player));
return player;
}
FileStats(playerid)
{
new a[256]; format(a, sizeof(a), "%s.ini",udb_encode(Player(playerid)));
return a;
}

SaveStats(playerid)
{
dini_IntSet(FileStats(playerid), "PositionX", floatround(positionx));
dini_IntSet(FileStats(playerid), "PositionY", floatround(positiony));
dini_IntSet(FileStats(playerid), "PositionZ", floatround(positionz));
}
LoadStats(playerid)
{
positionx = dini_Int(FileStats(playerid), "PositionX");
positiony = dini_Int(FileStats(playerid), "PositionY");
positionz = dini_Int(FileStats(playerid), "PositionZ");
}

So i think my problem is in OnPlayerSpawn. The spawn are in 0;0;0, and OnGameModeInit is ignorate. But if i do a SetPlayerPos to the position i want, i will only spawn here and newer at the save position.

I've try all... Every all i can do...

So i think i must create someone like :

If the first connexion
Spawn next to station train (for exemple)
Else if the second and more connexions
Spawn at the save position

But i don't know if it the solution. I've try to put me script in FS, don't work. I've do addplayerclass in all callback, don't work also. What can i do...? Please help me, i want learn ...

Thank!
Reply


Messages In This Thread
Spawn under BlueBerry... - by Paradis - 02.06.2013, 01:05
Re: Spawn under BlueBerry... - by Paradis - 02.06.2013, 12:00
Re : Spawn under BlueBerry... - by Paradis - 02.06.2013, 17:13
Re: Spawn under BlueBerry... - by RyanPetersons - 02.06.2013, 17:18
Re : Spawn under BlueBerry... - by Paradis - 02.06.2013, 18:15

Forum Jump:


Users browsing this thread: 1 Guest(s)