Getting playerdata - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Getting playerdata (
/showthread.php?tid=636627)
Getting playerdata -
MattTucker - 01.07.2017
I wanted to try out the OOP idea and create a scratch gamemode for samp.
Basically I got
Код:
/* GAMEMODE FILES */
#include "minigames/playerdata.pwn"
#include "minigames/dialogs.pwn"
Playerdata has pInfo and such, however, I got this function to be able to access the variables from anywhere in the script
Код:
function GetPlayerInfo(playerid, pInfo:var)
{
return PlayerInfo[playerid][var];
}
So the problem is, this function successfully returns the password of a player "inside" playerdata itself, however, when trying to use it in dialogs.pwn it turns into "1sers/
-player name-.ini"
Dialogs.pwn code
Код:
new tmpPass[60];
format(tmpPass,sizeof(tmpPass), "%s", GetPlayerInfo(playerid,pPass));
printf("%s general tmppass", tmpPass);
printf("%s geenral getplayerinfo", GetPlayerInfo(playerid,pPass));
First printf shows the above
Second printf shows the same as tmpPass
Also, any ideas if I can better optimize it?
EDIT: tried using
Код:
if(strcmp(GetPlayerInfo(playerid,pPass), inputtext) == 0)
but shows an error
Код:
dialogs.pwn(41) : error 035: argument type mismatch (argument 1)
Re: Getting playerdata -
iLearner - 01.07.2017
No idea why you need the function while you can access them directly (PlayerInfo[playerid][pPass]).
anyway, in first and second print the passwords are same cause in first one you are formatting it and then showing it, while in second one you're showing it directly.
Re: Getting playerdata -
MattTucker - 01.07.2017
Quote:
Originally Posted by iLearner
No idea why you need the function while you can access them directly (PlayerInfo[playerid][pPass]).
anyway, in first and second print the passwords are same cause in first one you are formatting it and then showing it, while in second one you're showing it directly.
|
Is it possible to just use PlayerInfo[playerid][pPass] and such in other .pwns (not the main one I compile) without giving out errors?
EDIT: just tried it out. Thanks a lot mate!