I said I was gone, but uhh. nope.
So I've never used PData in my life, and I have no idea how to incorporate PData into my code,
Basically I need the tags I set on someone to save (duh) But the video I watched on PData used PData in an init.lua script that has these 2 commands in it, nothing more:
init.lua
AddCSLuaFile( "playerdata.lua" )
include("playerdata.lua")
function GM:PlayerInitialSpawn( ply )
ply:StatsLoad()
end
function GM:PlayerDisconnected( ply )
ply:StatsSave()
end
I have to have PlayerInitialSpawn and PlayerDisconnected in the init.lua, but I need to save the actual Stats in my Clientside script.
cl_tags.lua == IMPORTANT STUFF ONLY
if IsValid(ply) and ply:IsPlayer() then
local TagReceiver = TagsFrame.TagsComboBox:GetValue()
if ( TagReceiver == ply:Nick() ) then
local nteam = team.GetColor(ply:Team())
if !bTeamOnly then
chat.AddText(TagsFrame.Mixer:GetColor(),SBC1,TagsFrame.TagsTextBox:GetValue(), SBC2, nteam, ply:Nick(), color_white, ": ", color_white, strText)
return true
else
chat.AddText(TagsFrame.Mixer:GetColor(), TagsFrame.TagsTextBox:GetValue(), " ", nteam, "(TEAM) ", ply:Nick(), color_white, ": ", color_white, strText)
return true
end
end
end
if !IsValid(ply) and !ply:IsPlayer() then
local ConsoleColor = Color(155,0,0)
chat.AddText(ConsoleColor, "Console", color_white, ": ", strText)
return true
end
end)
I need to save the stats in here, but also need to save it when the player disconnects, but I can't do that because PlayerDisconnected is init-only.. My brain hurts.
You guys are all giving me baby ratings because I'm new to a subject and need help? what other fucking sources do I have to go off of!? How the fuck do you guys expect me to know this shit!? If I knew how to do it, I wouldn't be here in the first fucking place.
You are new to every subject. If you are new, don't get hired as developer. There's a good documentation on the wiki, enough tutorials made and lots of working scripts, which you can view and learn from. Btw, you didn't even read the sticky Section Rules and Guidelines
Couple things to say:
First of all, I'm not a hired developer. I do it for fun under TG's name, and I DON'T get paid.
Second of all, Yes, I did read the guidelines. Stop assuming shit.
Third of all, The wiki doesn't fucking help me. what am I supposed to get about this
Player:GetPData( string key, any default=nil )
What am I supposed to get out of that!? and how the hell does it help me with my current situation. The wiki does have more on it, but nowhere does it tell me "Hey! If you are trying to save a string value from a tag addon that reads from chat, do this!" If I don't have the knowledge to do something, How the hell am I supposed to do it. I respect this page, but it seems like everyone's a dick now.
What is there to get? If by "init only" you mean server only and you need to save data about a player on the server and that data is only available on the client then you need to send that data from the client to the server for saving. Read this wiki page about how to do that.
On a different note: If you complain about a rating you will get more of that rating. I'm not sure about the new forum but on the old complain about ratings is a bannable offence. Also, getting angry because nobody is helping does nothing except show how immature you are.
Thank you for helping me. I don't know if you could tell, but I don't like Lowe very much. At least you're sensible. Thank you.
The wiki assumes you know basic lua. Reading wiki pages for functions isn't an advanced thing, especially for a straightforward function like GetPData. Your problem isn't that you aren't familiar with PData, it's that you aren't familiar with programming in general. This isn't a bad thing, it just means you need to familiarize yourself with the basics - mainly what functions, arguments, and return values are. You are already using all of those things in your code, but you don't understand what is going on that makes it work.
Honestly I wouldn't recommend Player/GetPData and Player/SetPData
It is not that optimised and slowed than using tables which are pretty basic.
Except they are the only way of maintaining player data over sessions unless you make your own SQL database functions, but considering InVaLiD is having with even basic functions i doubt he is going to be learning SQL any time soon.
If I'm going to be honest, you're 89% right. But I don't feel like going back to Hello world scripts. I like making things way past my level of knowledge because it makes me feel validated, unlike some tutorial of
print("Hello World")
What's practical about that?
I also don't want to abandon this project for a couple months to learn the basics, by then I'll even forget about it, I know I shouldn't of started it in the first place, but I thought it would be simple and take me a day or two.
Sorry, you need to Log In to post a reply to this thread.