28.12.2010, 17:23
I use dini for saving / loading positions, money, score, skin, name, ip and some other things. The issue is on the class selection, that if you press shift instead the button spawn, this spawns without loading position / skin, goes to the certain class info. Example: I chose the firefighter. The class 1. There will load the position I put on AddStaticClass (wepaons + position), instead the player's position/skin on dini file. This is not a problem on my system, since it doesn't happens ever.
My code, always:
My code, always:
pawn Код:
public OnPlayerSpawn(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
TogglePlayerControllable(playerid, true);
format(file, sizeof(file), SERVER_USER_FILE, name);
if(gPlayerLogged[playerid] == 1 && PlayerInfo[playerid][Registrado] == 1 && PlayerInfo[playerid][Jail] == 1)
{
SetPlayerPos(playerid, 264.35, 77.95, 1001.04);
SetPlayerInterior(playerid, 6);
SendClientMessage(playerid, vermelho, "The administrator hasn't unjailed you yet");
jail[playerid]=1;
dini_IntSet(file,"Spawnou",1);
PlayerInfo[playerid][Spawnou] = 1;
}
else if(PlayerInfo[playerid][Registrado] == 1 && PlayerInfo[playerid][Jail] == 0 && PlayerInfo[playerid][Spawnou] == 0)
{
new string[128]; new nome[30];
GetPlayerName(playerid, nome, 30);
format(file,sizeof(file),SERVER_USER_FILE,nome);
format(string,sizeof(string),"SERVER: %s [ID: %d] spawnou!",nome,playerid);
printf(string);
SetPlayerInterior(playerid, 0);
GangZoneShowForPlayer(playerid, gangzone[0], 0xFF9933FF);
SetPlayerPos(playerid, dini_Int(file,"PosX"),dini_Int(file,"PosY"),dini_Int(file,"PosZ")+1);
SendClientMessageToAll(0xAE5EFFFF, string);
SetPlayerSkin(playerid, PlayerInfo[playerid][Skin]);
SetPlayerInterior(playerid,0);
SetPlayerVirtualWorld(playerid, 0);
CreateDynamicMapIcon(1338.39, 2153.30, 11.02, 58, 0, -1,-1,-1,distance);
CreateDynamicMapIcon(1933.83, 1345.05, 9.97, 30, 0, -1,-1,-1,distance);
CreateDynamicMapIcon(2019.78, 1004.03, 10.82, 44, 0, -1,-1,-1,distance);
CreateDynamicMapIcon(2201.43, 931.20, 10.82, 55, 0, -1,-1,-1,distance);
CreateDynamicMapIcon(2177.25, 962.21, 10.82, 18,0,-1,-1,-1,distance);
dini_IntSet(file,"Spawnou",1);
PlayerInfo[playerid][Spawnou] = 1;
}
return 1;
}
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
new n[MAX_PLAYERS];GetPlayerName(playerid,n,sizeof(n));format(file,sizeof(file),SERVER_USER_FILE,n);
if(!dini_Exists(file))
{
new nome[30]; GetPlayerName(playerid, nome, 30);
ForceClassSelection(playerid);
TogglePlayerControllable(playerid, false);
ShowPlayerDialog(playerid, 7, DIALOG_STYLE_MSGBOX, "{05E35A}Attention: READ", "{05E35A}Attention. Please, use /register <password> for you be able to spawn. You can't spawn without registering\nAtenзгo. Por favor, use /register <senha> para spawnar. Vocк nгo pode spawnar sem se registrar!","Ok","Ok");
GameTextForPlayer(playerid, "~r~Register before~y~spawn~b~ please",5000,5);
PlayerPlaySound(playerid, 1138, 0.0, 0.0, 0.0);
SendClientMessage(playerid, cinza, "Use: /skin <id> para trocar seu skin!");
return 0;
}
if(dini_Exists(file) && gPlayerLogged[playerid] == 0)
{
new nome[30]; GetPlayerName(playerid, nome, 30);
GameTextForPlayer(playerid, "~r~Login before~y~spawn~b~ please",5000,5);
PlayerPlaySound(playerid, 1138, 0.0, 0.0, 0.0);
ShowPlayerDialog(playerid, 8, DIALOG_STYLE_MSGBOX, "{05E35A}Attention: READ", "{05E35A}Attention. Please, use /login <password> for you be able to spawn. You can't spawn without login\nAtenзгo. Por favor, use /login <senha> para spawnar. Vocк nгo pode spawnar sem se logar!","Ok","Ok");
return 0;
}
return 1;
}