11.09.2014, 20:49
Hey , all i want is a simple clothes cmd for my server because all that i have are bugged. A classic command /clothes that can be accesed inside binco.
I give rep,
Thanks.
I give rep,
Thanks.
stock IsValidSkin( skinid )
{
if( skinid == 74 || skinid > 299 || skinid < 0 )
return 0;
return 1;
}
CMD:buyclothes(playerid,params[])
{
new skinid;
if(sscanf(params,"i",skinid)) return SendClientMessage(playerid,-1,"SYNTAX: /buyclothes [skinid]");// gives a message if the player hasn't entered a skinid
if(!IsPlayerInRangeOfPoint(playerid, 7.0, 207.7145,-103.5601,1005.2578)) return SendClientMessage(playerid,-1,"You are not at binco");// checks if the player is at binco, if not it returns in an error
if(!IsValidSkin(skinid)) return SendClientMessage(playerid,-1,"Please enter a valid skin id");
GivePlayerMoney(playerid,-500);//Set this according to your choice
SetPlayerSkin(playerid,skinid)//Set's the player's skin id to the id he entered
new string[28];// a string variable
format(string,sizeof(string),"You've bought skin id %d",skinid);//formats the string
SendClientMessage(playerid,-1,string);// Sends a confirmation message
return 1;
}
stock IsValidSkin( skinid )
{
if( skinid == 74 || skinid > 299 || skinid < 0 )
return 0;
return 1;
}
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;
}
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;
}
public OnPlayerSpawn(playerid)
{
//Variables to the skins location in the database
SetPlayerSkin(playerid, SKINVARIABLEGOESHERE);
return 1;
}
format(str,128,"UPDATE `playeraccounts' SET `playerSkin`='%d' WHERE `playerName`='%s'",skin,wakaname); // you've put ' not `