That`s funny )
Have you tried to do something with this? Try to do it and if you have problems post here. Save the x,y,z when player disconects and then spawn the player at that x,y,z. |
pLastx
plLasty
pLastz
then on loading player
Ini_float lastx
Ini_float lasty
Ini_float lastz
then to save it do getplayerposition(playerid, lastx, lasty, lastz)
and write it to enum
ini_writefloat lastx
etc
etc
enum
PHP код:
|
enum pInfo
{
pPass,
pCash,
pAdmin,
pKills,
pDeaths,
Float:pX,
Float:pY,
Float:pZ,
Float:pZr
}
new PlayerInfo[MAX_PLAYERS][pInfo];
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Float("XPos",PlayerInfo[playerid][pX]);
INI_Float("YPos",PlayerInfo[playerid][pY]);
INI_Float("ZPos",PlayerInfo[playerid][pZ]);
INI_Float("Angle",PlayerInfo[playerid][pZr]);
return 1;
}
public OnPlayerSpawn(playerid)
{
SetPlayerPos(playerid,PlayerInfo[playerid][pX],PlayerInfo[playerid][pY],PlayerInfo[playerid][pZ]);
SetPlayerFacingAngle(playerid,PlayerInfo[playerid][pZr]);
SetCameraBehindPlayer(playerid);
return 1;
}
public OnPlayerDeath(playerid,killerid,reason)
{
PlayerInfo[playerid][pX] = 0;//Regular Spawnpoint (X)
PlayerInfo[playerid][pY] = 0;//Regular Spawnpoint (Y)
PlayerInfo[playerid][pZ] = 0;//Regular Spawnpoint (Z)
PlayerInfo[playerid][pZr] = 0;//Regular Spawnpoint (Angle)
PlayerInfo[killerid][pKills]++;
PlayerInfo[playerid][pDeaths]++;
return 1;
}
public OnPlayerDisconnect(playerid,reason)
{
switch(GetPlayerState(playerid)){ case 1..6:
{
GetPlayerPos(playerid,PlayerInfo[playerid][pX],PlayerInfo[playerid][pY],PlayerInfo[playerid][pZ]);
GetPlayerFacingAngle(playerid,PlayerInfo[playerid][pZr]);
}}
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteFloat(File,"XPos",PlayerInfo[playerid][pX]);
INI_WriteFloat(File,"YPos",PlayerInfo[playerid][pY]);
INI_WriteFloat(File,"ZPos,PlayerInfo[playerid][pZ]);
INI_WriteFloat(File,"Angle",PlayerInfo[playerid][pZr]);
INI_Close(File);
return 1;
}
pawn Код:
|
{ pPass, pCash, pAdmin, pKills, pDeaths } new PlayerInfo[MAX_PLAYERS][pInfo]; forward LoadUser_data(playerid,name[],value[]); public LoadUser_data(playerid,name[],value[]) { INI_Int("Password",PlayerInfo[playerid][pPass]); INI_Int("Cash",PlayerInfo[playerid][pCash]); INI_Int("Admin",PlayerInfo[playerid][pAdmin]); INI_Int("Kills",PlayerInfo[playerid][pKills]); INI_Int("Deaths",PlayerInfo[playerid][pDeaths]); return 1; }
enum pInfo { pPass, pCash, pAdmin, pKills, pDeaths, pX, pY, pZ, pZr } public LoadUser_data(playerid,name[],value[]) { INI_Int("Password",PlayerInfo[playerid][pPass]); INI_Int("Cash",PlayerInfo[playerid][pCash]); INI_Int("Admin",PlayerInfo[playerid][pAdmin]); INI_Int("Kills",PlayerInfo[playerid][pKills]); INI_Int("Deaths",PlayerInfo[playerid][pDeaths]); return 1; } stock UserPath(playerid)
C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(38) : warning 235: public function lacks forward declaration (symbol "LoadUser_data") C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(40) : error 017: undefined symbol "PlayerInfo" C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(40) : warning 215: expression has no effect C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(40) : error 001: expected token: ";", but found "]" C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(40) : error 029: invalid expression, assumed zero C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(40) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 4 Errors.
/*Credits to Dracoblue*/ stock udb_hash(buf[]) { new length=strlen(buf); new s1 = 1; new s2 = 0; new n; for (n=0; n<length; n++) { s1 = (s1 + buf[n]) % 65521; s2 = (s2 + s1) % 65521; } return (s2 << 16) + s1; } public OnPlayerConnect(playerid) { if(fexist(UserPath(playerid))) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit"); } else { ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit"); } return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch( dialogid ) { case DIALOG_REGISTER: { if (!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit"); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Password",udb_hash(inputtext)); INI_WriteInt(File,"Cash",0); INI_WriteInt(File,"Admin",0); INI_WriteInt(File,"Kills",0); INI_WriteInt(File,"Deaths",0); INI_Close(File); SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Welcome to OrbzGaming! Please RELOG to join the rest of the world!","Ok",""); } }
{ pPass, pCash, pAdmin, pKills, pDeaths, Float:pX, Float:pY, Float:pZ, Float:pZr } new PlayerInfo[MAX_PLAYERS][pInfo]; forward LoadUser_data(playerid,name[],value[]); public LoadUser_data(playerid,name[],value[]) { INI_Int("Password",PlayerInfo[playerid][pPass]); INI_Int("Cash",PlayerInfo[playerid][pCash]); INI_Int("Admin",PlayerInfo[playerid][pAdmin]); INI_Int("Kills",PlayerInfo[playerid][pKills]); INI_Int("Deaths",PlayerInfo[playerid][pDeaths]); INI_Float("XPos",PlayerInfo[playerid][pX]); INI_Float("YPos",PlayerInfo[playerid][pY]); INI_Float("ZPos",PlayerInfo[playerid][pZ]); INI_Float("Angle",PlayerInfo[playerid][pZr]); return 1; } public OnPlayerSpawn(playerid) { SetPlayerPos(playerid,PlayerInfo[playerid][pX],PlayerInfo[playerid][pY],PlayerInfo[playerid][pZ]); SetPlayerFacingAngle(playerid,PlayerInfo[playerid][pZr]); SetCameraBehindPlayer(playerid); return 1; } public OnPlayerDeath(playerid) { PlayerInfo[playerid][pX] = 0;//Regular Spawnpoint (X) PlayerInfo[playerid][pY] = 0;//Regular Spawnpoint (Y) PlayerInfo[playerid][pZ] = 0;//Regular Spawnpoint (Z) PlayerInfo[playerid][pZr] = 0;//Regular Spawnpoint (Angle) PlayerInfo[killerid][pKills]++; PlayerInfo[playerid][pDeaths]++; return 1; } public OnPlayerDisconnect(playerid,reason) { switch(GetPlayerState(playerid)){ case 1..6: { GetPlayerPos(playerid,PlayerInfo[playerid][pX],PlayerInfo[playerid][pY],PlayerInfo[playerid][pZ]); GetPlayerFacingAngle(playerid,PlayerInfo[playerid][pZr]); }} new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Cash",GetPlayerMoney(playerid)); INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]); INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]); INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]); INI_WriteFloat(File,"XPos",PlayerInfo[playerid][pX]); INI_WriteFloat(File,"YPos",PlayerInfo[playerid][pY]); INI_WriteFloat(File,"ZPos,PlayerInfo[playerid][pZ]); INI_WriteFloat(File,"Angle",PlayerInfo[playerid][pZr]); INI_Close(File); return 1; } case DIALOG_LOGIN: { if ( !response ) return Kick ( playerid ); if( response ) { if(udb_hash(inputtext) == PlayerInfo[playerid][pPass]) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]); ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok",""); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit"); } return 1; } } } return 1; }
C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(66) : error 017: undefined symbol "killerid" C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(78) : error 017: undefined symbol "UserPath" C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(86) : error 037: invalid string (possibly non-terminated string) C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(86) : error 017: undefined symbol "ZPos" C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(86) : error 029: invalid expression, assumed zero C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(86) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 6 Errors.
Nope
Replaced Код:
/*Credits to Dracoblue*/ stock udb_hash(buf[]) { new length=strlen(buf); new s1 = 1; new s2 = 0; new n; for (n=0; n<length; n++) { s1 = (s1 + buf[n]) % 65521; s2 = (s2 + s1) % 65521; } return (s2 << 16) + s1; } public OnPlayerConnect(playerid) { if(fexist(UserPath(playerid))) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit"); } else { ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit"); } return 1; } public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch( dialogid ) { case DIALOG_REGISTER: { if (!response) return Kick(playerid); if(response) { if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit"); new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Password",udb_hash(inputtext)); INI_WriteInt(File,"Cash",0); INI_WriteInt(File,"Admin",0); INI_WriteInt(File,"Kills",0); INI_WriteInt(File,"Deaths",0); INI_Close(File); SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Welcome to OrbzGaming! Please RELOG to join the rest of the world!","Ok",""); } } Код:
{ pPass, pCash, pAdmin, pKills, pDeaths, Float:pX, Float:pY, Float:pZ, Float:pZr } new PlayerInfo[MAX_PLAYERS][pInfo]; forward LoadUser_data(playerid,name[],value[]); public LoadUser_data(playerid,name[],value[]) { INI_Int("Password",PlayerInfo[playerid][pPass]); INI_Int("Cash",PlayerInfo[playerid][pCash]); INI_Int("Admin",PlayerInfo[playerid][pAdmin]); INI_Int("Kills",PlayerInfo[playerid][pKills]); INI_Int("Deaths",PlayerInfo[playerid][pDeaths]); INI_Float("XPos",PlayerInfo[playerid][pX]); INI_Float("YPos",PlayerInfo[playerid][pY]); INI_Float("ZPos",PlayerInfo[playerid][pZ]); INI_Float("Angle",PlayerInfo[playerid][pZr]); return 1; } public OnPlayerSpawn(playerid) { SetPlayerPos(playerid,PlayerInfo[playerid][pX],PlayerInfo[playerid][pY],PlayerInfo[playerid][pZ]); SetPlayerFacingAngle(playerid,PlayerInfo[playerid][pZr]); SetCameraBehindPlayer(playerid); return 1; } public OnPlayerDeath(playerid) { PlayerInfo[playerid][pX] = 0;//Regular Spawnpoint (X) PlayerInfo[playerid][pY] = 0;//Regular Spawnpoint (Y) PlayerInfo[playerid][pZ] = 0;//Regular Spawnpoint (Z) PlayerInfo[playerid][pZr] = 0;//Regular Spawnpoint (Angle) PlayerInfo[killerid][pKills]++; PlayerInfo[playerid][pDeaths]++; return 1; } public OnPlayerDisconnect(playerid,reason) { switch(GetPlayerState(playerid)){ case 1..6: { GetPlayerPos(playerid,PlayerInfo[playerid][pX],PlayerInfo[playerid][pY],PlayerInfo[playerid][pZ]); GetPlayerFacingAngle(playerid,PlayerInfo[playerid][pZr]); }} new INI:File = INI_Open(UserPath(playerid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Cash",GetPlayerMoney(playerid)); INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]); INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]); INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]); INI_WriteFloat(File,"XPos",PlayerInfo[playerid][pX]); INI_WriteFloat(File,"YPos",PlayerInfo[playerid][pY]); INI_WriteFloat(File,"ZPos,PlayerInfo[playerid][pZ]); INI_WriteFloat(File,"Angle",PlayerInfo[playerid][pZr]); INI_Close(File); return 1; } case DIALOG_LOGIN: { if ( !response ) return Kick ( playerid ); if( response ) { if(udb_hash(inputtext) == PlayerInfo[playerid][pPass]) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]); ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok",""); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit"); } return 1; } } } return 1; } Код:
C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(66) : error 017: undefined symbol "killerid" C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(78) : error 017: undefined symbol "UserPath" C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(86) : error 037: invalid string (possibly non-terminated string) C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(86) : error 017: undefined symbol "ZPos" C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(86) : error 029: invalid expression, assumed zero C:\Users\Cody\Desktop\OrbzGaming\SAMP\Server\gamemodes\grandlarc.pwn(86) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 6 Errors. |