22.04.2016, 10:46
hi everyone i want to ask how to save last position who someone play!
I have Y_SI and other stuff but maybe i miss something
??
![Huh?](images/smilies/confused.gif)
![Huh?](images/smilies/confused.gif)
#define UserPath "Users/%s.ini" /
public OnPlayerDisconnect(playerid, reason)
{
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
new INI:file = INI_Open(paths(playerid));
INI_WriteFloat(pathfile, "PosX", x);
INI_WriteFloat(pathfile, "PosY", y);
INI_WriteFloat(pathfile, "PosZ", z);
INI_Close(pathfile);
}
stock paths(playerid)
{
new string[128],pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
format(string,sizeof(string),UserPath,pname);
return string;
}
public OnPlayerDisconnect(playerid, reason)
{
new PName[MAX_PLAYER_NAME];
new String[128];
GetPlayerName(playerid, PName, sizeof(PName));
switch(reason)
{
case 0: format(String, sizeof(String), "%s lost connection to the server.", PName);
case 1: format(String, sizeof(String), "%s has left the server.", PName);
case 2: format(String, sizeof(String), "%s has left the server. (kicked)", PName);
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new PName[MAX_PLAYER_NAME];
new String[128];
GetPlayerName(playerid, PName, sizeof(PName));
switch(reason)
{
case 0: format(String, sizeof(String), "%s lost connection to the server.", PName);
case 1: format(String, sizeof(String), "%s has left the server.", PName);
case 2: format(String, sizeof(String), "%s has left the server. (kicked)", PName);
}
return 1;
}
// Top of your script
new
Float: PosX[ MAX_PLAYERS ],
Float: PosY[ MAX_PLAYERS ],
Float: PosZ[ MAX_PLAYERS ],
Float: Angle[ MAX_PLAYERS ],
Interior[ MAX_PLAYERS ],
VirtualWorld[ MAX_PLAYERS ]
;
// Any where
stock user_ini_file(playerid)
{
new
string[ 128 ],
user_name[ MAX_PLAYER_NAME ]
;
GetPlayerName( playerid, user_name, MAX_PLAYER_NAME );
format( string, sizeof ( string ), "%s.ini", user_name ); // < This is the Scriptfiles directory
return string;
}
forward @load_user_position( playerid, name[], value[] );
@load_user_position( playerid, name[], value[] )
{
INI_Float( "PositionX", PosX[ playerid ] );
INI_Float( "PositionY", PosY[ playerid ] );
INI_Float( "PositionZ", PosZ[ playerid ] );
INI_Float( "Angle", Angle[ playerid ] );
INI_Int( "Interior", Interior[ playerid ] );
INI_Int( "VirtualWorld", VirtualWorld[ playerid ] );
return ( 1 );
}
// OnPlayerDisconnect
public OnPlayerDisconnect(playerid, reason)
{
new PName[MAX_PLAYER_NAME];
new String[128];
GetPlayerName(playerid, PName, sizeof(PName));
switch(reason)
{
case 0: format(String, sizeof(String), "%s lost connection to the server.", PName);
case 1: format(String, sizeof(String), "%s has left the server.", PName);
case 2: format(String, sizeof(String), "%s has left the server. (kicked)", PName);
}
GetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
GetPlayerFacingAngle( playerid, Angle[ playerid ] );
new INI:File = INI_Open( user_ini_file( playerid ) );
INI_SetTag( File, "position" );
INI_WriteFloat( File, "PositionX", PosX[ playerid ] );
INI_WriteFloat( File, "PositionY", PosY[ playerid ] );
INI_WriteFloat( File, "PositionZ", PosZ[ playerid ] );
INI_WriteFloat( File, "Angle", Angle[ playerid ] );
INI_WriteInt( File, "Interior", GetPlayerInterior( playerid ) );
INI_WriteInt( File, "VirtualWorld", GetPlayerVirtualWorld( playerid ) );
INI_Close( File );
return 1;
}
// OnPlayerConnect
public OnPlayerConnect( playerid )
{
PosX[ playerid ] = 0;
PosY[ playerid ] = 0;
PosZ[ playerid ] = 0;
Angle[ playerid ] = 0;
Interior[ playerid ] = 0;
VirtualWorld[ playerid ] = 0;
INI_ParseFile( user_ini_file( playerid ), "load_user_%s", .bExtra = true, .extra = playerid );
return ( 1 );
}
// OnPlayerSpawn
public OnPlayerSpawn( playerid )
{
if ( PosX[ playerid ] != 0 && PosY[ playerid ] != 0 && PosZ[ playerid ] != 0 && Angle[ playerid ] != 0 )
{
SetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
SetPlayerFacingAngle( playerid, Angle[ playerid ] );
SetPlayerInterior( playerid, Interior[ playerid ] );
SetPlayerVirtualWorld( playerid, VirtualWorld[ playerid ] );
}
return ( 1 );
}
//Save Stats
new
Float: PosX[ MAX_PLAYERS ],
Float: PosY[ MAX_PLAYERS ],
Float: PosZ[ MAX_PLAYERS ],
Float: Angle[ MAX_PLAYERS ],
Interior[ MAX_PLAYERS ],
VirtualWorld[ MAX_PLAYERS ]
;
//STATS
{
new
string[ 128 ],
user_name[ MAX_PLAYER_NAME ]
;
GetPlayerName( playerid, user_name, MAX_PLAYER_NAME );
format( string, sizeof ( string ), "%s.ini", user_name ); // < This is the Scriptfiles directory
return string;
}
forward @load_user_position( playerid, name[], value[] );
@load_user_position( playerid, name[], value[] )
{
INI_Float( "PositionX", PosX[ playerid ] );
INI_Float( "PositionY", PosY[ playerid ] );
INI_Float( "PositionZ", PosZ[ playerid ] );
INI_Float( "Angle", Angle[ playerid ] );
INI_Int( "Interior", Interior[ playerid ] );
INI_Int( "VirtualWorld", VirtualWorld[ playerid ] );
return ( 1 );
}
//END
public OnPlayerConnect(playerid)
{
new pName[30], string[256];
GetPlayerName(playerid, pName, 30);
format(string, 256, "~w~Welcome ~n~~y~%s!", pName);
GameTextForPlayer(playerid,string,4000,1);
SendClientMessage(playerid, COLOR_WHITE, "|Y|--//Добре дошъл/Welcome\\--|Y|");
SendClientMessage(playerid, COLOR_GREEN, "|Y|--//В BULGARIA ROLE-PLAY\\--|Y|");
SendClientMessage(playerid, COLOR_RED, "|Y|--//SERVER 0.3.7 предоставен от: Borisov313\\--|Y|");
SendClientMessage(playerid, COLOR_LEMON, "|Y|--//За повече информация напиши /help\\--|Y|");
SendClientMessage(playerid, COLOR_TAN, "|Y|--//Приятна игра/Enjoy the game!\\--|Y|");
return 1;
}
{
PosX[ playerid ] = 0;
PosY[ playerid ] = 0;
PosZ[ playerid ] = 0;
Angle[ playerid ] = 0;
Interior[ playerid ] = 0;
VirtualWorld[ playerid ] = 0;
INI_ParseFile( user_ini_file( playerid ), "load_user_%s", .bExtra = true, .extra = playerid );
return ( 1 );
}
public OnPlayerDisconnect(playerid, reason)
{
new PName[MAX_PLAYER_NAME];
new String[128];
GetPlayerName(playerid, PName, sizeof(PName));
switch(reason)
{
case 0: format(String, sizeof(String), "%s lost connection to the server.", PName);
case 1: format(String, sizeof(String), "%s has left the server.", PName);
case 2: format(String, sizeof(String), "%s has left the server. (kicked)", PName);
}
GetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
GetPlayerFacingAngle( playerid, Angle[ playerid ] );
new INI:File = INI_Open( user_ini_file( playerid ) );
INI_SetTag( File, "position" );
INI_WriteFloat( File, "PositionX", PosX[ playerid ] );
INI_WriteFloat( File, "PositionY", PosY[ playerid ] );
INI_WriteFloat( File, "PositionZ", PosZ[ playerid ] );
INI_WriteFloat( File, "Angle", Angle[ playerid ] );
INI_WriteInt( File, "Interior", GetPlayerInterior( playerid ) );
INI_WriteInt( File, "VirtualWorld", GetPlayerVirtualWorld( playerid ) );
INI_Close( File );
return 1;
}
public OnPlayerSpawn(playerid)
{
//Gang Zones
GangZoneShowForAll (astecs, 0x12B0FC8B);
GangZoneShowForAll (grove1, 0x008C0085);
GangZoneShowForAll (grove2, 0x00950096);
GangZoneShowForAll (ballas, 0xF053FD81);
GangZoneShowForAll (vagos, 0xECEC0089);
GangZoneShowForAll (polis, 0xE800007C);
GangZoneShowForAll (triada, 0xAFAFAFAA);
GangZoneShowForAll (rifa, 0x33CCFFAA);
GangZoneShowForAll (sfarmy, 0x660000AA);
GangZoneShowForAll (lvarmy, 0x660000AA);
if ( PosX[ playerid ] != 0 && PosY[ playerid ] != 0 && PosZ[ playerid ] != 0 && Angle[ playerid ] != 0 )
{
SetPlayerPos( playerid, PosX[ playerid ], PosY[ playerid ], PosZ[ playerid ] );
SetPlayerFacingAngle( playerid, Angle[ playerid ] );
SetPlayerInterior( playerid, Interior[ playerid ] );
SetPlayerVirtualWorld( playerid, VirtualWorld[ playerid ] );
}
return 1;
}
C:\Users\Борисов\Desktop\Crime Life Gang Wars\gamemodes\Creation.pwn(82) : error 055: start of function body without function header
C:\Users\Борисов\Desktop\Crime Life Gang Wars\gamemodes\Creation.pwn(88) : error 021: symbol already defined: "GetPlayerName"
C:\Users\Борисов\Desktop\Crime Life Gang Wars\gamemodes\Creation.pwn(90) : error 010: invalid function or declaration
C:\Users\Борисов\Desktop\Crime Life Gang Wars\gamemodes\Creation.pwn(97) : error 017: undefined symbol "INI_Float"
C:\Users\Борисов\Desktop\Crime Life Gang Wars\gamemodes\Creation.pwn(98) : error 017: undefined symbol "INI_Float"
C:\Users\Борисов\Desktop\Crime Life Gang Wars\gamemodes\Creation.pwn(99) : error 017: undefined symbol "INI_Float"
C:\Users\Борисов\Desktop\Crime Life Gang Wars\gamemodes\Creation.pwn(100) : error 017: undefined symbol "INI_Float"
C:\Users\Борисов\Desktop\Crime Life Gang Wars\gamemodes\Creation.pwn(101) : error 017: undefined symbol "INI_Int"
C:\Users\Борисов\Desktop\Crime Life Gang Wars\gamemodes\Creation.pwn(102) : error 017: undefined symbol "INI_Int"
C:\Users\Борисов\Desktop\Crime Life Gang Wars\gamemodes\Creation.pwn(209) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Борисов\Desktop\Crime Life Gang Wars\gamemodes\Creation.pwn(220) : error 055: start of function body without function header
C:\Users\Борисов\Desktop\Crime Life Gang Wars\gamemodes\Creation.pwn(228) : error 001: expected token: ")", but found "("
C:\Users\Борисов\Desktop\Crime Life Gang Wars\gamemodes\Creation.pwn(228) : error 010: invalid function or declaration
C:\Users\Борисов\Desktop\Crime Life Gang Wars\gamemodes\Creation.pwn(228 -- 229) : error 010: invalid function or declaration
C:\Users\Борисов\Desktop\Crime Life Gang Wars\gamemodes\Creation.pwn(228 -- 229) : fatal error 107: too many error messages on one line
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
14 Errors.
public OnPlayerConnect(playerid)
{
new pName[30], string[256];
GetPlayerName(playerid, pName, 30);
format(string, 256, "~w~Welcome ~n~~y~%s!", pName);
GameTextForPlayer(playerid,string,4000,1);
SendClientMessage(playerid, COLOR_WHITE, "|Y|--//Добре дошъл/Welcome\\--|Y|");
SendClientMessage(playerid, COLOR_GREEN, "|Y|--//В BULGARIA ROLE-PLAY\\--|Y|");
SendClientMessage(playerid, COLOR_RED, "|Y|--//SERVER 0.3.7 предоставен от: Borisov313\\--|Y|");
SendClientMessage(playerid, COLOR_LEMON, "|Y|--//За повече информация напиши /help\\--|Y|");
SendClientMessage(playerid, COLOR_TAN, "|Y|--//Приятна игра/Enjoy the game!\\--|Y|");
PosX[ playerid ] = 0;
PosY[ playerid ] = 0;
PosZ[ playerid ] = 0;
Angle[ playerid ] = 0;
Interior[ playerid ] = 0;
VirtualWorld[ playerid ] = 0;
INI_ParseFile( user_ini_file( playerid ), "load_user_%s", .bExtra = true, .extra = playerid );
return 1;
}