Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Includes
- #include <a_samp>
- #include <YSI\y_ini>
- #include <sscanf>
- #include <zcmd>
- //Other Defines
- #define FILTERSCRIPT
- //Colors
- #define COLOR_YELLOW 0xFFEE00AA
- #define COLOR_ORANGE 0xFFBB00AA
- #define COLOR_RED 0xFF0000FF
- //Enum
- enum PositionInfo
- {
- Float: PosX,
- Float: PosY,
- Float: PosZ,
- Float: Angle,
- Interior,
- VirtualWorld
- }
- new YPosInfo[MAX_PLAYERS][PositionInfo];
- #define YPos_Path "YPOS/%s.ini"
- stock user_ini_file(playerid)
- {
- new str[128],user_name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,user_name,sizeof(user_name));
- for(new d,len = strlen(user_name); d != len; d++)
- user_name[d] = tolower(user_name[d]);
- format(str,sizeof(str),YPos_Path,user_name);
- return str;
- }
- forward @load_user_position(playerid, name[], value[]);
- @load_user_position(playerid, name[], value[])
- {
- INI_Float("PositionX", YPosInfo[playerid][PosX]);
- INI_Float("PositionY", YPosInfo[playerid][PosY]);
- INI_Float("PositionZ", YPosInfo[playerid][PosZ]);
- INI_Float("Angle", YPosInfo[playerid][Angle]);
- INI_Int("Interior", YPosInfo[playerid][Interior]);
- INI_Int("VirtualWorld", YPosInfo[playerid][VirtualWorld]);
- return 1;
- }
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Youssef's Saving/Loading Position Filterscript Loaded");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("\n--------------------------------------");
- print(" Youssef's Saving/Loading Position Filterscript Unloaded");
- print("--------------------------------------\n");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- YPosInfo[playerid][PosX] = 0;
- YPosInfo[playerid][PosY] = 0;
- YPosInfo[playerid][PosZ] = 0;
- YPosInfo[playerid][Angle] = 0;
- YPosInfo[playerid][Interior] = 0;
- YPosInfo[playerid][VirtualWorld] = 0;
- SendClientMessage(playerid,COLOR_YELLOW,"This Server Uses YPOS (Youssef's Saving/Loading Position) Filterscript.");
- INI_ParseFile(user_ini_file(playerid), "load_user_%s", .bExtra = true, .extra = playerid);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- COMMAND:saveplace1(playerid, params[])
- {
- new string[64];
- GetPlayerPos(playerid, YPosInfo[playerid][PosX], YPosInfo[playerid][PosY], YPosInfo[playerid][PosZ]);
- GetPlayerFacingAngle(playerid, YPosInfo[playerid][Angle]);
- new INI:File = INI_Open(user_ini_file(playerid));
- INI_SetTag(File, "YPositions");
- INI_WriteFloat(File, "PositionX", YPosInfo[playerid][PosX]);
- INI_WriteFloat(File, "PositionY", YPosInfo[playerid][PosY]);
- INI_WriteFloat(File, "PositionZ", YPosInfo[playerid][PosZ]);
- INI_WriteFloat(File, "Angle", YPosInfo[playerid][Angle]);
- INI_WriteInt(File, "Interior", GetPlayerInterior(playerid));
- INI_WriteInt(File, "VirtualWorld", GetPlayerVirtualWorld(playerid));
- INI_Close(File);
- format(string,sizeof string, "Successfully Saved The PositionX: %f", YPosInfo[playerid][PosX]);
- SendClientMessage(playerid, COLOR_ORANGE, string);
- format(string,sizeof string, "Successfully Saved The PositionY: %f", YPosInfo[playerid][PosY]);
- SendClientMessage(playerid, COLOR_ORANGE, string);
- format(string,sizeof string, "Successfully Saved The PositionZ: %f", YPosInfo[playerid][PosZ]);
- SendClientMessage(playerid, COLOR_ORANGE, string);
- format(string,sizeof string, "Angle: %f , Interior: %d , Virtual World: %d ", YPosInfo[playerid][Angle],GetPlayerInterior(playerid),GetPlayerVirtualWorld(playerid));
- SendClientMessage(playerid, COLOR_ORANGE, string);
- return 1;
- }
- COMMAND:gotoplace1(playerid, params[])
- {
- if(!fexist(user_ini_file(playerid)))
- {
- SendClientMessage(playerid, COLOR_RED, "You Have Not Saved Your Place Number 1, Yet! Use /saveplace1 To Save Your Current Place To Number 1");
- }
- else if(fexist(user_ini_file(playerid)))
- {
- SetPlayerPos(playerid, YPosInfo[playerid][PosX], YPosInfo[playerid][PosY], YPosInfo[playerid][PosZ]);
- SetPlayerFacingAngle(playerid, YPosInfo[playerid][Angle]);
- SetPlayerInterior(playerid, YPosInfo[playerid][Interior]);
- SetPlayerVirtualWorld(playerid, YPosInfo[playerid][VirtualWorld]);
- SendClientMessage(playerid, COLOR_ORANGE, "Successfully Teleported To Your Place Number 1.");
- }
- 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[])
- {
- return 1;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnRconCommand(cmd[])
- {
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- return 1;
- }
- public OnVehicleMod(playerid, vehicleid, componentid)
- {
- return 1;
- }
- public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
- {
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- return 1;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- return 1;
- }
- public OnPlayerStreamIn(playerid, forplayerid)
- {
- return 1;
- }
- public OnPlayerStreamOut(playerid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamIn(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamOut(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement