20.09.2011, 14:18
I am looking for the tutorial of adding FIlter-Script in Game-mode.
Any one Help me with that?
Any one Help me with that?
#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;
}
#include <a_samp>
#include <dudb>
//put the includes on the top of the gm
public OnGameModeInit()
{
printf("Weaponsave FS loaded!");//this is not needed...its just a message
}
public OnPlayerSpawn(playerid)
{
LoadWeapons(playerid);//put this on the gamemode function called onplayerspawn...the same
}
public OnPlayerDisconnect(playerid, reason)
{
SaveWeapons(playerid);//put this on the gamemode function called onplayerdisconnect...the same
}
///////////////////////////this in the end of the gamemode////////////////////77
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;
}