Help with GetPvar
#1

Hi is it possible to make a getpvar of this below.

Код:
dini_Get(pFile(playerid),"GangName")
Because I want to add a Gang name in the following /stats dialog . It would be something like this when you do /stats

Код:
Stats //dialog title

Gang Name: "Mygangnamehere"
Gang Score: 0
Gang Kills: 1
Edit: Or even not a getpvar, I just want to put the gang name inside the /stats

Anyway i'am doing cross script, so the filterscript for /stats is different from dini_Get(pFile(playerid),"GangName") they are not in the same filtercript
Reply
#2

Hi anyone can please help me?
Reply
#3

https://sampwiki.blast.hk/wiki/SetPVarString
https://sampwiki.blast.hk/wiki/GetPVarString

Or a 2D array for the player and the lenght.
Reply
#4

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Thanks for this konstas I will try to learn from this, but if its okay if you can make a simple demo for what I have posted? So I can keep this idea and to use it in future.

Thanks and best regards,
gwz
Reply
#5

If it's from another filterscript, then use PVar for that.

pawn Код:
SetPVarString(playerid, "Player_GangName", dini_Get(pFile(playerid),"GangName"));
On loading to set the gangname. Then when it's about to read it.
pawn Код:
new sz_GName[32]; // if the size is too small, change it to something greater.
GetPVarString(playerid, "Player_GangName", sz_GName, 32); // Same for the lenght here.
And use sz_GName as argument to format it into some message.
Reply
#6

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
If it's from another filterscript, then use PVar for that.

pawn Код:
SetPVarString(playerid, "Player_GangName", dini_Get(pFile(playerid),"GangName"));
On loading to set the gangname. Then when it's about to read it.
pawn Код:
new sz_GName[32]; // if the size is too small, change it to something greater.
GetPVarString(playerid, "Player_GangName", sz_GName, 32); // Same for the lenght here.
And use sz_GName as argument to format it into some message.
This is what you made before when I was having a problem with /stats I know you fixed this.

Код HTML:
CMD:stats(playerid,params[])
{
    if(isnull(params))
    {
        new sz_str[512], sz_name[MAX_PLAYER_NAME], seconds = gettime() - pInfo[playerid][ConnectedTime] + pInfo[playerid][TotalSecs];
        GetPlayerName(playerid, sz_name, MAX_PLAYER_NAME);
        format(sz_str, sizeof(sz_str), "{09F7DF}%s (ID:%d) {09F7DF}", sz_name, playerid);
        format(sz_str, sizeof(sz_str), "%s\n\nGeneral: \nLogged In: %d", sz_str, pInfo[playerid][Logged]);
        format(sz_str, sizeof(sz_str), "%s\nAdmin Level: %d", sz_str, pInfo[playerid][pLevel]);
        format(sz_str, sizeof(sz_str), "%s\nVIP Level: %d", sz_str, pInfo[playerid][Donator]);
So its okay to change new sz_GName[32] to new sz_str[512] because it was already defined?

and this Player_GangName is my Gang Name?
Reply
#7

They differ. sz_str will be for the whole text (of statistics) and sz_GName will store the gang name.
Reply
#8

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
They differ. sz_str will be for the whole text (of statistics) and sz_GName will store the gang name.
Bravo! I was also thinking that it was different. Because str_str is the string size/length of the text in the dialog msgbox. Well I will try it later after I came back home.

Is this correct?

Код:
format(sz_str, sizeof(sz_str), "%s\nGang Name: %d", sz_str, GetPVarString(playerid, "Player_GangName", sz_GName, 32);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)