SA-MP Forums Archive
Doing it correct? - 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: Doing it correct? (/showthread.php?tid=334859)



Doing it correct? - RollTi - 16.04.2012

Just one question, i'm doing it correct?

pawn Код:
enum PlayerInfo
{
    Gun[13]
};
new pInfo[MAX_PLAYERS][PlayerInfo];

forward UserDataLoad_data(playerid,name[],value[]);
public UserDataLoad_data(playerid,name[],value[])
{
    INI_Int("Weapon1", pInfo[playerid][Gun][1]);
    INI_Int("Weapon2", pInfo[playerid][Gun][2]);
    INI_Int("Weapon3", pInfo[playerid][Gun][3]);
    INI_Int("Weapon4", pInfo[playerid][Gun][4]);
    INI_Int("Weapon5", pInfo[playerid][Gun][5]);
    INI_Int("Weapon6", pInfo[playerid][Gun][6]);
    INI_Int("Weapon7", pInfo[playerid][Gun][7]);
    INI_Int("Weapon8", pInfo[playerid][Gun][8]);
    INI_Int("Weapon9", pInfo[playerid][Gun][9]);
    INI_Int("Weapon10", pInfo[playerid][Gun][10]);
    INI_Int("Weapon11", pInfo[playerid][Gun][11]);
    INI_Int("Weapon11", pInfo[playerid][Gun][11]);
    return 1;
}


public OnPlayerSpawn(playerid)
{
    if(pInfo[playerid][Gun])
    {
        switch(pInfo[playerid][Gun])
        {
            case 0: GivePlayerWeapon(playerid, pInfo[playerid][Gun][1], 5000);
            case 1: GivePlayerWeapon(playerid, pInfo[playerid][Gun][2], 5000);
            case 2: GivePlayerWeapon(playerid, pInfo[playerid][Gun][3], 5000);
            case 3: GivePlayerWeapon(playerid, pInfo[playerid][Gun][4], 5000);
            case 4: GivePlayerWeapon(playerid, pInfo[playerid][Gun][5], 5000);
            case 5: GivePlayerWeapon(playerid, pInfo[playerid][Gun][6], 5000);
            case 6: GivePlayerWeapon(playerid, pInfo[playerid][Gun][7], 5000);
            case 7: GivePlayerWeapon(playerid, pInfo[playerid][Gun][8], 5000);
            case 8: GivePlayerWeapon(playerid, pInfo[playerid][Gun][9], 5000);
            case 9: GivePlayerWeapon(playerid, pInfo[playerid][Gun][10], 5000);
            case 10: GivePlayerWeapon(playerid, pInfo[playerid][Gun][11], 5000);
            case 11: GivePlayerWeapon(playerid, pInfo[playerid][Gun][12], 5000);
        }
    }
    return 1;
}



Re: Doing it correct? - Cjgogo - 16.04.2012

Well,you're doing it kinda correct,just that you must start with 0(Gun[0]) not 1(Gun[1]),and why have you declared 13 slots,12 are enough.Plus you haven't assigned values to the variables.Example:
pawn Код:
new Float:Pos[3];
new Float:x,Float:y,FLoat:z;
GetPlayerPos(playeird,x,y,z);
Pos[0]=x;//assigning value
Pos[1]=y;//same
Pos[2]=z;//same
I hope you understand now.


Re: Doing it correct? - RollTi - 16.04.2012

Quote:
Originally Posted by Cjgogo
Посмотреть сообщение
Well,you're doing it kinda correct,just that you must start with 0(Gun[0]) not 1(Gun[1]),and why have you declared 13 slots,12 are enough.Plus you haven't assigned values to the variables.Example:
pawn Код:
new Float:Pos[3];
new Float:x,Float:y,FLoat:z;
GetPlayerPos(playeird,x,y,z);
Pos[0]=x;//assigning value
Pos[1]=y;//same
Pos[2]=z;//same
I hope you understand now.
Thanks going to try it now


Re: Doing it correct? - RollTi - 16.04.2012

Why the weapons aren't giving OnPlayerSpawn?

i have this on my userfile

Код:
Weapon1 = 9
Weapon2 = 22
Weapon3 = 27
Weapon4 = 28
Weapon5 = 0
Weapon6 = 0
Weapon7 = 0
Weapon8 = 0
Weapon9 = 0
Weapon10 = 0
Weapon11 = 0
Weapon12 = 0
it doesn't give so the result in OnPlayerDisconnect, Weapon1/Weapon2 etc... 12 is 0


Re: Doing it correct? - Cjgogo - 16.04.2012

No,lol,not Weapon1=9,BUT Gun[0]=9,Gun[1]=22,etc.


Re: Doing it correct? - RollTi - 16.04.2012

What you mean Gun[0]/Gun[1]

so you mean i will change "Weapon1", to "Gun[0]" ??


Re: Doing it correct? - Cjgogo - 16.04.2012

Yes.I think it might work that way.Good luck!


Re: Doing it correct? - xxxDunecatxxx - 16.04.2012

lol wtf, don't listen to Cjgogo.

if it shows that on your userfile, then it saved properly but it just isn't giving the guns to you in the script. Did you put GivePlayerWeapon(playerid, weapon1, 200); GivePlayerWeapon(playerid, weapon2, 200); etc in your script?


Re: Doing it correct? - Cjgogo - 16.04.2012

Forget it!!!


Re: Doing it correct? - Cjgogo - 16.04.2012

Forget it!!!