PDA

View Full Version : BuyClothes Bug Save


chuck100
19/05/2013, 12:25 PM
How can I do the /buyclothes the skin will be saved everytime you enter / exit from the game :

#include <a_samp>
#include <streamer>
#include <a_zones>
#include <foreach>
#include <yom_buttons>
#include <djson>
#include <progress>
#include <YSI\y_timers>
#include <ZCMD>
#include <sscanf2>
#include <removebuilding_fix>
#include <fire2>
#include <mSelection>

#define COLOR_GRAD2 0xBFC0C2FF


new skinlist = mS_INVALID_LISTID;
public OnFilterScriptInit()
{
skinlist = LoadModelSelectionMenu("skins.txt");
return 1;
}

public OnPlayerModelSelection(playerid, response, listid, modelid)
{
if(listid == skinlist)
{
if(response)
{
if(GetPlayerMoney(playerid) < 2500) return SendClientMessage(playerid, COLOR_GRAD2, "You can't afford these clothes!");
GameTextForPlayer(playerid, "~g~Skin purchased! ~n~ ~r~- $2500", 2000, 1);
GivePlayerMoney(playerid, -2500);
SetPlayerSkin(playerid, modelid);
}
else SendClientMessage(playerid, 0xFF0000FF, "Canceled skin selection");
return 1;
}
return 1;
}

IsAtClothShop(playerid)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerInRangeOfPoint(playerid,25.0,207.5627,-103.7291,1005.2578) || IsPlayerInRangeOfPoint(playerid,25.0,203.9068,-41.0728,1001.8047) || IsPlayerInRangeOfPoint(playerid,25.0,203.9068,-41.0728,1001.8047))
{//Binco & Suburban
return 1;
}
else if(IsPlayerInRangeOfPoint(playerid,30.0,214.4470,-7.6471,1001.2109) || IsPlayerInRangeOfPoint(playerid,50.0,161.3765,-83.8416,1001.8047))
{//Zip & Victim
return 1;
}
else if(IsPlayerInRangeOfPoint(playerid,5.0,-2664.3318,1538.4259,907.1797))
{// DoC HQ
return 1;
}
else if(IsPlayerInRangeOfPoint(playerid,5.0,1514.66,-1501.12,17.10) || IsPlayerInRangeOfPoint(playerid,5.0,1523.42,-1502.75,17.10))
{// The New Custom Clothes Shop
return 1;
}
else if(IsPlayerInRangeOfPoint(playerid,5.0,202.6777,-163.0623,1000.5306))
{//Diedier DoChs
return 1;
}
}
return 0;
}

CMD:buyclothes(playerid, params[])
{
if(IsAtClothShop(playerid))
{
ShowModelSelectionMenu(playerid, skinlist, "Select Skin");
}
return 1;
}

chuck100
19/05/2013, 03:53 PM
Anybody ?

Ceez
19/05/2013, 04:55 PM
I don't know what Saving-System are you using but,
Go to the callback of the New Player Data, example

public NewPlayerData(playerid)
{
if(INI_Open(Accounts(playerid)))
{
INI_WriteInt("LastSkin");
Bascially what you do is add 'LastSkin' to the Saving, Loading, New player data callbacks,
Then OnPlayerSpawn add
SetSkin(playerid, PlayerStat[playerid][LastSkin]
If you don't have PlayerStat, use PlayerInfo or just pInfo, whatever you got.