[Bug] Spawn under map
#1

(sorry for bad english, i use ****** translation)

Good evening.

I'm trying to train myself to do a little GM (just to train me so neither DM, PR etc ...) and for that I'll get some stuff on the net (that I know has been doing this for 3 days , so I do not know the Pawn (I know just make orders m'kay?).

So I searched all day a system that keeps your skin to disconnect and you gave it to reconnect. I found, I installed (it also holds money, life, and weapons).
I was very happy finally I will not develop in short everything.

Tonight I found that I really needed a system that saves your coordinated disconnection, and give you where you were in again.
The trouble is:

When I create a new account, I click spawn (this button also annoys me how to remove it?) And then my character falls into the void (in the map) and then lands on a sidewalk without taking any damage to the coordinates 132.0013, -67.2916,1.5781 (I / save where I'm falling). But I have put a AddPlayerClass in OnGameModeInit ... With the coordinates of the station.

So my character should not appear before the station? I will expose my script, it'll probably make you laugh but I am doing copy paste of what I found on the internet (if I changed the credits, it's just nice to do but I don ' not that GM would use it just to train me and find out):

Quote:

#include <a_samp>
#include <core>
#include <float>
#include <Dutils>
#include <Dudb>
#include <Dini>

#define savefolder "/save/%s.ini"

#pragma unused ret_memcpy

new Killz[MAX_PLAYERS];
new Deathz[MAX_PLAYERS];

main()
{
print("\n ----------------------------------");
print(" | |");
print(" | |");
print(" | .: [FR] CannaWeed Serveur :. |");
print(" | 0.1 Server Version |");
print(" | |");
print(" ----------------------------------\n");
}

#define COLOR_YELLOW 0xFFFF00FF
#define ACTION_COLOR 0x400080FF
#define COLOR_RED 0xFF0000FF

public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("CannaWeed");
AddPlayerClass(26,1769.8235,-1862.7141,13.5760,359.7843,0,0,0,0,0,0); // SPAWN
return 1;
}

public OnGameModeExit()
{
return 1;
}


public OnPlayerRequestClass(playerid, classid)
{
new pname[128];
new file[128];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), savefolder,pname);
if(!dini_Exists(file)) {
dini_Create(file);
dini_IntSet(file, "Score", 0);
dini_IntSet(file, "Money", 0);
dini_IntSet(file, "Kills", Killz[playerid]);
dini_IntSet(file, "Deaths", Deathz[playerid]);
dini_IntSet(file, "Skin", 0);
SetPlayerScore(playerid, dini_Int(file, "Score"));
SetPlayerMoney(playerid, dini_Int(file, "Money"));
SetPlayerSkin(playerid, dini_Int(file, "Skin"));

}
else {
SetPlayerScore(playerid, dini_Int(file, "Score"));
SetPlayerMoney(playerid, dini_Int(file, "Money"));
SetPlayerSkin(playerid, dini_Int(file, "Skin"));
SetPlayerPos(playerid,1769.8235,-1862.7141,13.5760);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
return 0;

}

public OnPlayerConnect(playerid)
{
new pname[128];
new file[128];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), savefolder,pname);
if(!dini_Exists(file)) {
dini_Create(file);
dini_IntSet(file, "Score", 0);
dini_IntSet(file, "Money", 0);
dini_IntSet(file, "Kills", Killz[playerid]);
dini_IntSet(file, "Deaths", Deathz[playerid]);
dini_IntSet(file, "Skin", 0);
SetPlayerScore(playerid, dini_Int(file, "Score"));
SetPlayerMoney(playerid, dini_Int(file, "Money"));
SetPlayerSkin(playerid, dini_Int(file, "Skin"));
SendClientMessage(playerid,0x008000FF,"Bienvenue sur .: [FR] CannaWeed Serveur :.");
SendClientMessage(playerid,0xFF0000FF,"Veuillez vous dйconnectez aprиs la crйation de votre compte pour enregistrer les donnйs");
SendClientMessage(playerid,0xFFFF00FF," Astuce: Pour avoir accиs а la liste des commandes, tapez /commandes");
SendClientMessage(playerid,COLOR_RED,"Cliquez sur SPAWN en bas a droite pour apparaitre une fois loggй!");

}
else {
SendClientMessage(playerid,0x008000FF,"Bienvenue sur .: [FR] CannaWeed Serveur :.");
SendClientMessage(playerid,0xFF0000FF,"Veuillez vous dйconnectez aprиs la crйation de votre compte pour enregistrer les donnйs");
SendClientMessage(playerid,0xFFFF00FF," Astuce: Pour avoir accиs а la liste des commandes, tapez /commandes");
SendClientMessage(playerid,COLOR_RED,"Cliquez sur SPAWN en bas a droite pour apparaitre une fois loggй!");
SetPlayerScore(playerid, dini_Int(file, "Score"));
SetPlayerMoney(playerid, dini_Int(file, "Money"));
SetPlayerSkin(playerid, dini_Int(file, "Skin"));
return 1;
}
return 0;
}

public OnPlayerDisconnect(playerid, reason)
{
{
new pname[128];
new file[128];
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), savefolder,pname);
if(!dini_Exists(file)) {
}
else {
dini_IntSet(file, "Score", GetPlayerScore(playerid));
dini_IntSet(file, "Money", GetPlayerMoney(playerid));
dini_IntSet(file, "Kills", Killz[playerid]);
dini_IntSet(file, "Deaths", Deathz[playerid]);
dini_IntSet(file, "Skin", GetPlayerSkin(playerid));
new Float, Float:y, Float:z;
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "\\SavePos\\%s.ini", pname);
if(!dini_Exists(file))
dini_Create(file);
GetPlayerPos(playerid, x, y, z);
dini_FloatSet(file, "posX", x);
dini_FloatSet(file, "posY", y);
dini_FloatSet(file, "posZ", z);
return 1;
}
return 0;
}
}

public OnPlayerSpawn(playerid)
{
new file[128], pname[MAX_PLAYER_NAME];
new Float, Float:y, Float:z;
GetPlayerName(playerid, pname, sizeof(pname));
format(file, sizeof(file), "\\SavePos\\%s.ini", pname);
x = dini_Float(file, "posX");
y = dini_Float(file, "posY");
z = dini_Float(file, "posZ");
SetPlayerPos(playerid, x,y,z);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}

public OnVehicleSpawn(vehicleid)
{
return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}

public OnPlayerText(playerid, text[])
{
return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/commandes", cmdtext, true, 10) == 0)
{
SendClientMessage(playerid,COLOR_YELLOW,"Commandes Gйnйrales : /aide general");
SendClientMessage(playerid,COLOR_YELLOW,"Commandes Factions : /aide faction");
SendClientMessage(playerid,COLOR_YELLOW,"Liste des animations : /animlist");
return 1;
}
return 0;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}

This is after the rest is soon so I'll not take up more space on the topic.
What is wrong please? I had a FS account registration, I thought at first it was from there, so I disabled it but apparently it changes anything, I always fall in the same place at the character creation.

Namely it good backup positions and if I reconnect I appear right where I disconnected.

I thank from my heart the people who can help me.

(The system backup position I added it in and OnplayerSpawn OnPlayerDisconnect. I found here http://forum.ragezone.com/f500/tutor...-spawn-699593/).

Thank you!
Reply


Messages In This Thread
[Bug] Spawn under map - by Paradis - 01.06.2013, 01:44
Re: [Bug] Spawn under map - by Paradis - 01.06.2013, 18:26
Re: [Bug] Spawn under map - by DeMoX - 01.06.2013, 18:39
Re: [Bug] Spawn under map - by DobbysGamertag - 01.06.2013, 18:45
Re: [Bug] Spawn under map - by Paradis - 01.06.2013, 19:30
Re: [Bug] Spawn under map - by DobbysGamertag - 01.06.2013, 19:56
Re: [Bug] Spawn under map - by Paradis - 01.06.2013, 20:03
Re: [Bug] Spawn under map - by Paradis - 01.06.2013, 22:17
Re: [Bug] Spawn under map - by DobbysGamertag - 02.06.2013, 02:26
Re: [Bug] Spawn under map - by Paradis - 02.06.2013, 03:07

Forum Jump:


Users browsing this thread: 2 Guest(s)