ORM System
#1

Hello everyone!
So, I read twice AndreT's Orm tutorial and still didn't get one thing. How does the plugin know that for instance that PosA stands for players facing angle and will get it without using GetPlayerFacingAngle and afterwards when player logs into his account I will load the facing angle he had when he left the server the last time ? Can someone give me a little example with saving/loading positions or money or w/e so I can finally comprehend the whole conception of the orm system.

Thanks in advance! Everyone who helps me will be rewarded with a point to their reputation.
Reply
#2

hi,

Lets Say You Got Enum
Enum pInfo
{
Float:X,
Float:Y,
Float:Z,
Float:FacingAngle
};
new PlayerInfo[MAX_PLAYERS][pInfo];

This Is Your Player Information Enum , Basically Like A File System For saving peoples data.

stock SavePlayerInfo(playerid)
{
new Float:Pos[4];
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]); ///This Grabs The Player X Y Z Axis
GetPlayerFacingAngle(playerid, Pos[3]); ///This Grabs The Player Facing Angle
PlayerInfo[playerid][X] = Pos[0]; /// This stores Float:X Of The Player Pos and stores it to enum Same As Below
PlayerInfo[playerid][Y] = Pos[1];
PlayerInfo[playerid][Z] = Pos[2];
PlayerInfo[playerid][FacingAngle] = Pos[3];
return 1;
}
public OnPlayerDisconnect(playerid)
{
SavePlayerInfo(playerid); /// This Will Call The SavePlayerInfo(playerid) stock CallBack
return 1;
}
That's How The Save Works But Im a Bit Tired To Even Write A Full Page Of This Request Please Use ****** Search For Y_INI OR DINI on How to Parse Files This Will Tell You How To Make The Load stock/public
But basically public onPlayerConnect(playerid) It Will Parse The File Load The Data from your scriptfiles folder in your server and read your name find the file name see if its correct check your data then Example OnPlayerSpawn(playerid)
is basically SetPlayersFacingAngle(playerid, PlayerInfo[playerid][FacingAngle]); would set your facing angle from your file in script files sorry cant be much help right now .. but at least I pointed you in the right direction


Just Read It Again You want it for Orm or Something sounds complicated I use YINI best faster too And MySQL Overrated in my opion and can be exploited
Reply
#3

I find it cool that you tried to help me, but I need help exactly for the ORM system. Also the code you gave won't save anything (you are not updating anything).
Reply
#4

it updates on player disconnect I know I read the post wrong that's cause im that tired hahha
Reply
#5

Okay, but I still need help about the ORM system.
Reply
#6

Someone ?
Reply
#7

Last try if someone can help me.
Reply
#8

I'm pretty sure the plugin doesn't actually read "PosA" as "GetPlayerFacingAngle", you'll have to define the variables yourself by using the appropiate methods: https://sampwiki.blast.hk/wiki/Function:GetPlayerPos & https://sampwiki.blast.hk/wiki/GetPlayerFacingAngle.

I might be wrong on this though, as I have not used ORM before.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)