14.06.2013, 04:28
hi i created new fs coin system but it got bugged after i transfer to volt-host(my host)
its not saving i already created
[CODE]
PlayerRank scriptfile
[CODE]
and it bugged its not load and save
i already test
and
but its not working,
code
the textdraw also not showed
+
its not saving i already created
[CODE]
PlayerRank scriptfile
[CODE]
and it bugged its not load and save
i already test
pawn Код:
#define PATH "/PlayerRank/%s.ini"
pawn Код:
#define PATH "PlayerRank/%s.ini"
code
pawn Код:
#include <a_samp>
#include <YSI\y_ini>
#include <zcmd>
#include <streamer>
#include <easydialog>
#pragma tabsize 0
#define COLOR_RED 0xFF0000FF
#define PATH "/PlayerRank/%s.ini"
enum pInfo
{
pCoins,
pCash,
pScore,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new SuicideAttempts[MAX_PLAYERS];
new PlayerText:Textdraw0[MAX_PLAYERS];
new PlayerText:Textdraw1[MAX_PLAYERS];
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Fa-Coin",PlayerInfo[playerid][pCoins]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Score",PlayerInfo[playerid][pScore]);
return 1;
}
stock UserPath(playerid)
{
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),PATH,playername);
return string;
}
public OnFilterScriptInit()
{
CreateDynamicCP(914.2001,2006.7981,10.8203, 1.0);
print("Fa-Coin System By Muhd Fitri Fahim Was Loaded\n");
return 1;
}
public OnPlayerConnect(playerid)
{
Textdraw0[playerid] = CreatePlayerTextDraw(playerid,436.000000, 10.000000, "Fa-Coins:");
PlayerTextDrawBackgroundColor(playerid,Textdraw0[playerid], 255);
PlayerTextDrawFont(playerid,Textdraw0[playerid], 1);
PlayerTextDrawLetterSize(playerid,Textdraw0[playerid], 0.390000, 1.800000);
PlayerTextDrawColor(playerid,Textdraw0[playerid], -65281);
PlayerTextDrawSetOutline(playerid,Textdraw0[playerid], 0);
PlayerTextDrawSetProportional(playerid,Textdraw0[playerid], 1);
PlayerTextDrawSetShadow(playerid,Textdraw0[playerid], 1);
Textdraw1[playerid] = CreatePlayerTextDraw(playerid,497.000000, 13.000000, "Loading....");
PlayerTextDrawBackgroundColor(playerid,Textdraw1[playerid], 255);
PlayerTextDrawFont(playerid,Textdraw1[playerid], 1);
PlayerTextDrawLetterSize(playerid,Textdraw1[playerid], 0.500000, 1.400000);
PlayerTextDrawColor(playerid,Textdraw1[playerid], -1);
PlayerTextDrawSetOutline(playerid,Textdraw1[playerid], 0);
PlayerTextDrawSetProportional(playerid,Textdraw1[playerid], 1);
PlayerTextDrawSetShadow(playerid,Textdraw1[playerid], 1);
SetTimerEx("UpdateText", 500, true, "i", playerid);
new IP[20];
GetPlayerIp(playerid,IP,sizeof(IP));
SetPVarString(playerid,"ip",IP);
PlayerTextDrawShow(playerid, Textdraw0[playerid]);
PlayerTextDrawShow(playerid, Textdraw1[playerid]);
if(fexist(UserPath(playerid)))
{
PlayerTextDrawShow(playerid, Textdraw0[playerid]);
PlayerTextDrawShow(playerid, Textdraw1[playerid]);
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
}
else
{
PlayerTextDrawShow(playerid, Textdraw0[playerid]);
PlayerTextDrawShow(playerid, Textdraw1[playerid]);
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Fa-Coin",0);
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Score",0);
INI_Close(File);
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(GetPVarInt(playerid,"bugban") == 1)
{
new string[24];
GetPVarString(playerid,"ip",string,sizeof(string));
format(string,sizeof(string),"unbanip %s",string);
SendRconCommand(string);
SendRconCommand("reloadbans");
}
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Fa-Coin",PlayerInfo[playerid][pCoins]);
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
INI_Close(File);
return 1;
}
CMD:myranks(playerid,params[])
{
new str[128];
format(str,sizeof(str),"You Has %d Coins",PlayerInfo[playerid][pCoins]);
SendClientMessage(playerid,-1,str);
return 1;
}
CMD:givechildcoinssssss(playerid,params[])
{
GivePlayerCoins(playerid,10);
SendClientMessage(playerid,-1,"Administrator [FA]Muhd_Fitri Was Given You 10 Fa-Coins!");
return 1;
}
CMD:reset(playerid,params[])
{
ResetPlayerCoins(playerid);
SendClientMessage(playerid,-1,"Your Fa-Coin Was Reseted ! :D");
return 1;
}
CMD:minigun(playerid,params[])
{
if(PlayerInfo[playerid][pCoins] >= 5) return SendClientMessage(playerid,-1,"You Must Have 5 Fa-Coins To Use Minigun");
new str[128];
GetPlayerName(playerid, str, sizeof(str));
format(str, sizeof(str), "{FF8000} %s{C0C0C0} has used {FF8000} /minigun", str);
SendClientMessageToAll(0xFFFF00AA, str);
GivePlayerWeapon(playerid,38,99999);
return 1;
}
CMD:needcoin(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
GivePlayerCoins(playerid,10);
}
else SendClientMessage(playerid,-1,"You're Not Admin !");
return 1;
}
CMD:admcoin(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
GivePlayerCoins(playerid,92102);
}
else SendClientMessage(playerid,-1,"You're Not Admin !");
return 1;
}
CMD:healme(playerid,params[])
{
if(PlayerInfo[playerid][pCoins] >= 1)
{
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,100);
GameTextForPlayer(playerid, "-1 Fa-Coin", 3000, 3);
GivePlayerCoins(playerid,-1);
}
else SendClientMessage(playerid,-1,"You Must Have 1 Coin To Heal Yourself !");
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid == playerid)
{
SuicideAttempts[playerid]++;
}
GivePlayerCoins(killerid,20);
GivePlayerCoins(playerid,-5);
GameTextForPlayer(playerid, "~r~-5 ~b~Fa-Coin", 3000, 3);
GameTextForPlayer(killerid, "~r~+20~b~ Fa-Coin", 3000, 3);
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 1.0, 914.2001,2006.7981,10.8203))
{
ShowDialog(playerid, Show:Dialog_Shop, DIALOG_STYLE_LIST, "List", "{FF0000}Nasi Ayam A1 {00FF33}50Fa-Coins\n{FF0000}Nasi Lemak {00FF33}50Fa-Coins\n{FF0000}Air Milo {00FF33}70Fa-Coins\n{FF0000}Hot Coffe {00FF33}70Fa-Coins\n{FF0000}Burger {00FF33}25Fa-Coins\n{FF0000}Pizza {00FF33}10Fa-Coins\n{FF0000}GodMod{00FF33}99999Fa-Coins\n{FF0000}Troll{00FF33}99Fa-Coins\n{FF0000}Wine {00FF33} $999Fa-Coins\n{FF0000}Tea O Beng{00FF33}$ 5Fa-Coins\n{FF0000}Rokok {00FF33}$70Fa-Coins", "Buy", "Cancle");
}
return 1;
}
//if(PlayerInfo[playerid][pCoins]
Dialog:Dialog_Shop(playerid, response, listitem, inputtext[])
{
if(response)
{
if(listitem == 0)
{
if(PlayerInfo[playerid][pCoins]< 5) return SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF}You don't have enough Fa-Coin To Buy This Item");
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,100);
GivePlayerCoins(playerid,-5);
ApplyAnimation(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0); // Eat Burger
SendClientMessage(playerid, COLOR_RED, "[Susses] {00FF33}You Have Bought {FF66FF}Nasi Ayam A1. {00FF33}Have Fun!");
}
if(listitem == 1)
{
if(PlayerInfo[playerid][pCoins]< 5) return SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF}You don't have enough Fa-Coin To Buy This Item");
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,100);
GivePlayerCoins(playerid,-5);
ApplyAnimation(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0); // Eat Burger
SendClientMessage(playerid, COLOR_RED, "[Susses {00FF33}You Have Bought {FF66FF}Nasi lemak {00FF33}Have Fun!");
}
if(listitem == 2)
{
if(PlayerInfo[playerid][pCoins]< 7) return SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF}You don't have enough Fa-Coin To Buy This Item");
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,100);
GivePlayerCoins(playerid,-5);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_SPRUNK);// Eat Burger
SendClientMessage(playerid, COLOR_RED, "[Susses] {00FF33}You Have Bought {FF66FF}Air Milo. {00FF33}Have Fun!");
}
if(listitem == 3)
{
if(PlayerInfo[playerid][pCoins]< 7) return SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF}You don't have enough Fa-Coin To Buy This Item");
GivePlayerWeapon(playerid, 31, 99999);
SetPlayerArmour(playerid,100);
GivePlayerCoins(playerid,-5);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_SPRUNK); // Eat Burger
SendClientMessage(playerid, COLOR_RED, "[Susses] {00FF33}You Have Bought {FF66FF}Hot Coffe. {00FF33}Have Fun!");
}
if(listitem == 4)
{
if(PlayerInfo[playerid][pCoins]< 2) return SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF}You don't have enough Fa-Coin To Buy This Item");
SetPlayerHealth(playerid,100);
SetPlayerArmour(playerid,100);
GivePlayerCoins(playerid,-5);
ApplyAnimation(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0); // Eat Burger
SendClientMessage(playerid, COLOR_RED, "[Susses] {00FF33}You Have Bought {FF66FF}Burger {00FF33}Have Fun!");
}
if(listitem == 5)
{
if(PlayerInfo[playerid][pCoins]< 1) return SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF}You don't have enough Fa-Coin To Buy This Item");
SetPlayerHealth(playerid,100);
GivePlayerCoins(playerid,-5);
SetPlayerArmour(playerid,100);
ApplyAnimation(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0); // Eat Burger
SendClientMessage(playerid, COLOR_RED, "[Susses] {00FF33}You Have Bought {FF66FF}Pizza. {00FF33}Have Fun!");
}
if(listitem == 6)
{
if(PlayerInfo[playerid][pCoins]< 99) return SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF}You don't have enough Fa-Coin To Buy This Item");
SetPlayerHealth(playerid,100000.00);
GivePlayerCoins(playerid,-5);
SetPlayerArmour(playerid,100);
ApplyAnimation(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0); // Eat Burger
SendClientMessage(playerid, COLOR_RED, "[Susses] {00FF33}You Have Bought {FF66FF}Godmode {00FF33}Have Fun!");
}
if(listitem == 7)
{
if(PlayerInfo[playerid][pCoins]< 99) return SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF}You don't have enough Fa-Coin To Buy This Item");
GivePlayerCoins(playerid,-5);
SetPlayerArmour(playerid,100);
SetPlayerHealth(playerid,100);
ApplyAnimation(playerid, "FOOD", "EAT_Burger", 3.0, 0, 0, 0, 0, 0); // Eat Burger
SetPlayerPos(playerid,897.2368,2022.4202,161.2891);
SendClientMessage(playerid, COLOR_RED, "[Susses] {00FF33}You Have Bought {FF66FF}Troll {00FF33}Have Fun!");
}
if(listitem == 8)
{
if(PlayerInfo[playerid][pCoins]< 9) return SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF}You don't have enough Fa-Coin To Buy This Item");
GivePlayerCoins(playerid,-5);
SetPlayerArmour(playerid,100);
SetPlayerHealth(playerid,100);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_WINE);// Eat Burger
SendClientMessage(playerid, 0xff8c00ff, "HINT: To drink, use the [FIRE KEY]."); // 0xff8c00ff - ORANGE
}
if(listitem == 9)
{
if(PlayerInfo[playerid][pCoins]< 9) return SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF}You don't have enough Fa-Coin To Buy This Item");
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_SPRUNK);
SetPlayerArmour(playerid,100);
GivePlayerCoins(playerid,-5);
SetPlayerHealth(playerid,100);
SendClientMessage(playerid, 0xff8c00ff, "HINT: To drink, use the [FIRE KEY]."); // 0xff8c00ff - ORANGE
}
if(listitem == 10)
{
if(PlayerInfo[playerid][pCoins]< 7) return SendClientMessage(playerid, COLOR_RED, "[ERROR]{FFFFFF}You don't have enough Fa-Coin To Buy This Item");
GivePlayerCoins(playerid,-5);
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_SMOKE_CIGGY);
SetPlayerArmour(playerid,100);
SetPlayerHealth(playerid,100);
SendClientMessage(playerid, 0xff8c00ff, "HINT: To smoke, use the FIRE KEY."); // 0xff8c00ff - ORANGE
return 1;
}
}
return 1;
}
//============================================================================//
// STOCK
//===========================================================================//
forward UpdateText(playerid);
public UpdateText(playerid)
{
new Str[20];
format(Str, sizeof Str, "%d",PlayerInfo[playerid][pCoins]);
PlayerTextDrawSetString(playerid,Textdraw1[playerid], Str);
PlayerTextDrawShow(playerid, Textdraw1[playerid]);
return 1;
}
stock GivePlayerCoins(playerid,amount)
{
PlayerInfo[playerid][pCoins] +=amount;
return 1;
}
stock SetPlayerCoins(playerid,amount)
{
PlayerInfo[playerid][pCoins] =amount;
return 1;
}
stock ResetPlayerCoins(playerid)
{
PlayerInfo[playerid][pCoins] =0;
return 1;
}
forward KickPlayer(playerid);
public KickPlayer(playerid)
{
Kick(playerid);
}
+