Stock help
#1

Hey everyone. I want to combine my two stocks. I don't know how to do this.

pawn Код:
stock GetPlayerFaction(playerid)
{
 return PlayerInfo[playerid][FactionMember];
}

stock GetFactionType(playerid)
{
    format(file,sizeof(file),FACTIONS);
    if(!fexist(file))
    {
        dini_Get(file,"Type",type);
    }
}
Now I want that I can get the Faction Type of the player his faction. How would I do this with these stocks?
I made them myself with someones help btw.
Reply
#2

I don't quite understand, do you want a "stock" checking if the FactionType is the same as PlayerFaction or do you want your two stocks to become the same and return the value of both?
Reply
#3

Quote:
Originally Posted by Lorrden
Посмотреть сообщение
I don't quite understand, do you want a "stock" checking if the FactionType is the same as PlayerFaction or do you want your two stocks to become the same and return the value of both?
I want to check the faction type of the faction where the player is part of.
Reply
#4

I still don't get it..
[FactionMember] should be the same as FactionType.. That's how I've allways done it.

pawn Код:
stock CheckPlayerFactionType(playerid)
{
             new factype[playerid];
    if(PlayerInfo[playerid][FactionMember] == 1) factype[playerid] = 1;
    if(PlayerInfo[playerid][FactionMember] == 2) factype[playerid] = 2;
    // etc
    return factype;
}
Reply
#5

Quote:
Originally Posted by Lorrden
Посмотреть сообщение
I still don't get it..
[FactionMember] should be the same as FactionType.. That's how I've allways done it.

pawn Код:
stock CheckPlayerFactionType(playerid)
{
             new factype[playerid];
    if(PlayerInfo[playerid][FactionMember] == 1) factype[playerid] = 1;
    if(PlayerInfo[playerid][FactionMember] == 2) factype[playerid] = 2;
    // etc
    return factype;
}
Still not where I',m seraching for. Let me examine it myself again.
Reply
#6

Now I have this:

pawn Код:
stock GetFactionType(playerid)
{
    new type;
    format(file,sizeof(file),FACTIONS);
    if(!fexist(file))
    {
        new i;
        format(String,sizeof String,"Factions/%i.ini",i);
        dini_Get(file,"Type",playerid);
    }
}
It's totally wrong. ANyone know what I want to do and what I have to fix?
Reply
#7

pawn Код:
stock GetFactionType(playerid)
{
    new type, i, str[64] = "INVALID_FACTION_ID";
    i = PlayerInfo[playerid][FactionMember];//change this obviously
    format(file, sizeof(file), "Factions/%i.ini", i);
    if(fexist(file)) format(str, sizeof(str), "%s", dini_Get(file, "Type", playerid));
    return str;
}
Reply
#8

Here try this:
pawn Код:
stock GetFactionType()
{
    for(new i = 0; i < MAX_PLAYERS; i++
    {
        PlayerInfo[playerid][FactionMember] = GetPlayerSkin(i);
    }
    return PlayerInfo[playerid][FactionMember];
}
Reply
#9

Quote:
Originally Posted by futuretrucker
Посмотреть сообщение
Here try this:
pawn Код:
stock GetFactionType()
{
    for(new i = 0; i < MAX_PLAYERS; i++
    {
        PlayerInfo[playerid][FactionMember] = GetPlayerSkin(i);
    }
    return PlayerInfo[playerid][FactionMember];
}
he asked for faction type, not faction skin lol
Reply
#10

Quote:
Originally Posted by Donya
Посмотреть сообщение
pawn Код:
stock GetFactionType(playerid)
{
    new type, i, str[64] = "INVALID_FACTION_ID";
    i = PlayerInfo[playerid][FactionMember];//change this obviously
    format(file, sizeof(file), "Factions/%i.ini", i);
    if(fexist(file)) format(str, sizeof(str), "%s", dini_Get(file, "Type", playerid));
    return str;
}
C:\Users\Bart\Desktop\SampScripting\gamemodes\Sunl ight.pwn(884) : warning 202: number of arguments does not match definition


if(fexist(file)) format(str, sizeof(str), "%s", dini_Get(file, "Type", playerid));
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)