18.04.2011, 14:41
pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#pragma tabsize 0
#define COLOR_RED 0xAA3333AA
#define COLOR_GREEN 0x33AA33AA
#define DIALOG_STYLE 0
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
new SkinPickup[6];
forward IsAtClothesShop(playerid);
forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Skin System By Accardo");
print("--------------------------------------\n");
SkinPickup[1] = CreateDynamicPickup(1275, 1, 161.5236,-83.3203,1001.8047);
SkinPickup[2] = CreateDynamicPickup(1275, 1, 207.7182,-100.9436,1005.2578);
SkinPickup[3] = CreateDynamicPickup(1275, 1, 203.9261,-43.2656,1001.8047);
SkinPickup[4] = CreateDynamicPickup(1275, 1, 206.3746,-8.1824,1001.2109);
SkinPickup[5] = CreateDynamicPickup(1275, 1, 207.0685,-129.1833,1003.5078);
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
#endif
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == SkinPickup[1])
{
ShowPlayerDialog(playerid,55,DIALOG_STYLE_INPUT,"Clothes Shop","Enter Skin ID | $500","Ok","Cancel");
return 1;
}
else if(pickupid == SkinPickup[2])
{
ShowPlayerDialog(playerid,55,DIALOG_STYLE_INPUT,"Clothes Shop","Enter Skin ID | $500","Ok","Cancel");
return 1;
}
else if(pickupid == SkinPickup[3])
{
ShowPlayerDialog(playerid,55,DIALOG_STYLE_INPUT,"Clothes Shop","Enter Skin ID | $500","Ok","Cancel");
return 1;
}
else if(pickupid == SkinPickup[4])
{
ShowPlayerDialog(playerid,55,DIALOG_STYLE_INPUT,"Clothes Shop","Enter Skin ID | $500","Ok","Cancel");
return 1;
}
else if(pickupid == SkinPickup[5])
{
ShowPlayerDialog(playerid,55,DIALOG_STYLE_INPUT,"Clothes Shop","Enter Skin ID | $500","Ok","Cancel");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 55 && response == 1)
{
if(GetPlayerMoney(playerid)>500)
{
if(IsValidSkin(strval(inputtext)))
{
SetPlayerSkin(playerid, strval(inputtext));
GivePlayerMoney(playerid,-500);
SendClientMessage(playerid,0x33AA33AA,"You Used $500 To Buy A Clothes");
}
else
{
SendClientMessage(playerid,0xAA3333AA,"Invalid Skin ID");
}
}
else
{
SendClientMessage(playerid,0xAA3333AA,"You Dont Have Money To Buy Any Clothes");
}
}
return 1;
}
stock IsNumeric(string[])
{
for (new i = 0, j = strlen(string); i < j; i++)
{
if (string[i] > '9' || string[i] < '0') return 0;
}
return 1;
}
stock IsValidSkin(SkinID)
{
if((SkinID >= 0) && (SkinID <= 3)||(SkinID == 7)||(SkinID >= 9 && SkinID <= 41)||(SkinID >= 43 && SkinID <= 64)||(SkinID >= 66 && SkinID <= 73)||(SkinID >= 75 && SkinID <= 85)||(SkinID >= 87 && SkinID <= 118)||(SkinID >= 120 && SkinID <= 148)||(SkinID >= 150 && SkinID <= 207)||(SkinID >= 209 && SkinID <= 264)||(SkinID >= 274 && SkinID <= 288)||(SkinID >= 290 && SkinID <= 299)) return true;
else return false;
}
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x); tempposy = (oldposy -y); tempposz = (oldposz -z);
if(((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{ return true; }
return false;
}
public IsAtClothesShop(playerid)
{
if(PlayerToPoint(20,playerid,161.5236, -83.3203, 1001.8047) ||
PlayerToPoint(20,playerid,207.7182,-100.9436,1005.2578) ||
PlayerToPoint(20,playerid,203.9261,-43.2656,1001.8047) ||
PlayerToPoint(20,playerid,206.3746,-8.1824,1001.2109) ||
PlayerToPoint(20,playerid,207.0685,-129.1833,1003.5078))
{ return true; }
return false;
}