14.09.2014, 09:12
So i have the command :
and the skin is changing when i buy it, but at respawn it doesen't.
My setskin command is:
pawn Код:
CMD:buyclothes(playerid,params[])
{
if(GetPlayerVirtualWorld(playerid)-BUSINESS_VIRTUAL_WORLD >= 1)
{
new businessID;
businessID = GetPlayerVirtualWorld(playerid) - BUSINESS_VIRTUAL_WORLD;
if(businessVariables[businessID][bType] == 2)
{
new skinid;
new wakaname[25];
if(sscanf(params,"i",skinid)) return SendClientMessage(playerid, COLOR_GREY,"SYNTAX: /buyclothes [skinid]");
if(!IsPlayerInRangeOfPoint(playerid, 7.0, 207.7145,-103.5601,1005.2578)) return SendClientMessage(playerid,-1,"You are not at binco");
if(!IsValidSkin(skinid)) return SendClientMessage(playerid,-1,"Please enter a valid skin id");
SetPlayerSkin(playerid, skinid);
playerVariables[playerid][pMoney] -= 1500;
businessVariables[businessID][bVault] += 1500;
new string[28];
format(string,sizeof(string),"You've bought skin id %d",skinid);
SendClientMessage(playerid,-1,string);
new str[128];
format(str,128,"UPDATE `playeraccounts` SET `playerSkin`='%d' WHERE `playerName`='%s'",skinid,wakaname);
mysql_query(str);
}
}
return 1;
}
My setskin command is:
pawn Код:
CMD:setskin(playerid,params[])
{
if(playerVariables[playerid][pAdminLevel] >= 1)
{
new id, string[256], giveplayer[25],skin;
if(sscanf(params, "ui", id,skin)) return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/setskin [playerid] [skin id]");
{
if(id != INVALID_PLAYER_ID)
{
if(skin < 300 && skin >= 0)
{
GetPlayerName(id, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "You set %s's skin to %d.", giveplayer, skin);
SendClientMessage(playerid, COLOR_WHITE, string);
playerVariables[id][pSkin] = skin;
SetPlayerSkin(id, skin);
new wakaname[25];
GetPlayerName(id,wakaname,25);
new str[128];
format(str,128,"UPDATE `playeraccounts` SET `playerSkin`='%d' WHERE `playerName`='%s'",skin,wakaname);
mysql_query(str);
}
}
}
}
else return SendClientMessage(playerid, COLOR_WHITE, AdminOnly);
return 1;
}