SA-MP Forums Archive
Help me!! - 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: Help me!! (/showthread.php?tid=281869)



Help me!! - umarmalik - 08.09.2011

Some one help me,
I am trying to add some filterscript on volt host, when I add the name of filterscript on server.cfg file then I try to restart the server, server gone stopped.
That filterscript is completely working on my home server.

the code of the filterscript is:


Код:
#include <a_samp>
#include <dudb>

public OnGameModeInit() SendRconCommand("exit");
public OnPlayerSpawn(playerid) LoadWeapons(playerid);
public OnFilterScriptInit() printf("Weaponsave FS loaded!");
public OnPlayerDisconnect(playerid, reason) SaveWeapons(playerid);

stock LoadWeapons(playerid)
{
    new pname[MAX_PLAYER_NAME];
    if(!GetPlayerName(playerid, pname, MAX_PLAYER_NAME)) return false;
    if(!udb_Exists(pname)) udb_Create(pname, "");
    for(new wep[8], amm[6], i; i < 13; i++)
    {
        format(amm, sizeof amm, "Ammo%d", i);
        format(wep, sizeof wep, "Weapon%d", i);
        GivePlayerWeapon(playerid, dUserINT(pname).(wep), dUserINT(pname).(amm));
    }
    return true;
}

stock SaveWeapons(playerid)
{
    new pname[MAX_PLAYER_NAME];
    if(!GetPlayerName(playerid, pname, MAX_PLAYER_NAME)) return false;
    if(!udb_Exists(pname)) udb_Create(pname, "");
    for(new wep[8], amm[6], i, cwep, camm; i < 13; i++)
    {
        format(amm, sizeof amm, "Ammo%d", i);
        format(wep, sizeof wep, "Weapon%d", i); 
        GetPlayerWeaponData(playerid, i, cwep, camm);
        dUserSetINT(pname).(amm, camm);
        dUserSetINT(pname).(wep, cwep);
    }
    return true;
}
I would appreciate the help.


Re: Help me!! - THE_KNOWN - 08.09.2011

public OnGameModeInit() SendRconCommand("exit");



remove that line


Re: Help me!! - Kaperstone - 08.09.2011

pawn Код:
#include <a_samp>
#include <dudb>

public OnPlayerSpawn(playerid)
{
LoadWeapons(playerid);
return 1;
}

public OnFilterScriptInit()
{
printf("Weaponsave FS loaded!");
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
SaveWeapons(playerid);
}

stock LoadWeapons(playerid)
{
    new pname[MAX_PLAYER_NAME];
    if(!GetPlayerName(playerid, pname, MAX_PLAYER_NAME)) return false;
    if(!udb_Exists(pname)) udb_Create(pname, "");
    for(new wep[8], amm[6], i; i < 13; i++)
    {
        format(amm, sizeof amm, "Ammo%d", i);
        format(wep, sizeof wep, "Weapon%d", i);
        GivePlayerWeapon(playerid, dUserINT(pname).(wep), dUserINT(pname).(amm));
    }
    return 1;
}

stock SaveWeapons(playerid)
{
    new pname[MAX_PLAYER_NAME];
    if(!GetPlayerName(playerid, pname, MAX_PLAYER_NAME)) return false;
    if(!udb_Exists(pname)) udb_Create(pname, "");
    for(new wep[8], amm[6], i, cwep, camm; i < 13; i++)
    {
        format(amm, sizeof amm, "Ammo%d", i);
        format(wep, sizeof wep, "Weapon%d", i);
        GetPlayerWeaponData(playerid, i, cwep, camm);
        dUserSetINT(pname).(amm, camm);
        dUserSetINT(pname).(wep, cwep);
    }
    return 1;
}



AW: Re: Help me!! - umarmalik - 08.09.2011

Quote:
Originally Posted by xkirill
Посмотреть сообщение
pawn Код:
#include <a_samp>
#include <dudb>

public OnPlayerSpawn(playerid)
{
LoadWeapons(playerid);
return 1;
}

public OnFilterScriptInit()
{
printf("Weaponsave FS loaded!");
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
SaveWeapons(playerid);
}

stock LoadWeapons(playerid)
{
    new pname[MAX_PLAYER_NAME];
    if(!GetPlayerName(playerid, pname, MAX_PLAYER_NAME)) return false;
    if(!udb_Exists(pname)) udb_Create(pname, "");
    for(new wep[8], amm[6], i; i < 13; i++)
    {
        format(amm, sizeof amm, "Ammo%d", i);
        format(wep, sizeof wep, "Weapon%d", i);
        GivePlayerWeapon(playerid, dUserINT(pname).(wep), dUserINT(pname).(amm));
    }
    return 1;
}

stock SaveWeapons(playerid)
{
    new pname[MAX_PLAYER_NAME];
    if(!GetPlayerName(playerid, pname, MAX_PLAYER_NAME)) return false;
    if(!udb_Exists(pname)) udb_Create(pname, "");
    for(new wep[8], amm[6], i, cwep, camm; i < 13; i++)
    {
        format(amm, sizeof amm, "Ammo%d", i);
        format(wep, sizeof wep, "Weapon%d", i);
        GetPlayerWeaponData(playerid, i, cwep, camm);
        dUserSetINT(pname).(amm, camm);
        dUserSetINT(pname).(wep, cwep);
    }
    return 1;
}
I am using that filterscript but weapons not svae when we log from the server.
Help me.


Re: Help me!! - Kaperstone - 08.09.2011

use y_ini
its alot easier


AW: Help me!! - umarmalik - 08.09.2011

Can you make weapon save filterscript with y_ini?

I appreciate your help.

Please.


Re: Help me!! - Kingunit - 08.09.2011

Take the one in my signature for example. Try to make that one bigger.


AW: Help me!! - umarmalik - 08.09.2011

Can any one of you make a weapon save filterscript, Please!!


Re: Help me!! - Kingunit - 08.09.2011

Can you please stop talking like "plz, make this, pleasz, man plezz". How about starting from scratch and reading tutorials and the wiki?


Re: AW: Help me!! - Jafet_Macario - 08.09.2011

Quote:
Originally Posted by umarmalik
Посмотреть сообщение
Can any one of you make a weapon save filterscript, Please!!
https://sampforum.blast.hk/showthread.php?tid=187229