ShowPlayerDialog(playerid,DIALOG_SENDCASH,DIALOG_STYLE_INPUT,Title,"","Transfer","Cancel");
public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[]) { //... if(dialogid == DIALOG_SENDCASH) { new Amount=strval(inputtext); SendCash(playerid,TargetID,Amount); } //... other stuff maybe... }
#define D_CHANGE_SKIN 5
ShowPlayerDialog(playerid,D_CHANGE_SKIN ,DIALOG_STYLE_INPUT,"Skin","Type in your wanted skin id into the input box.","Change","Cancel");
public OnDialogResponse(playerid,dialogid,response,listitem,inputtext[]) {
if(dialogid == D_CHANGE_SKIN) {
new skinid = strval(inputtext);
SetPlayerSkin(playerid, skinid);
}
return 1;
}
Originally Posted by Carlton
pawn Код:
|
stock IsValidSkin(skinid)
{
#define MAX_BAD_SKINS 35
new badSkins[MAX_BAD_SKINS] =
{
0, 3, 4, 5, 6, 8, 10, 42, 65, 74,
86, 92, 99, 119, 143, 144, 145, 146,
149, 178, 208, 251, 252, 254, 264,
265, 267, 273, 279, 277, 276, 274, 275,
278, 289
};
if (skinid < 0 || skinid > 299) return false;
for (new i = 0; i < MAX_BAD_SKINS; i++)
{
if (skinid == badSkins[i]) return false;
}
#undef MAX_BAD_SKINS
return 1;
}
Originally Posted by Johndaone
...
|
stock IsValidSkin(skinid)
{
if (skinid < 0 || skinid > 299)
return 0;
switch (skinid)
{
case
3, 4, 5, 6, 8, 42, 65, 74,
86, 119, 149, 208, 273, 289: return 0;
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)
{
if(dialogid == D_CHANGE_SKIN)
{
if(!inputtext[0])
{
SendClientMessage(playerid, COLOR, "Type the skin ID you want!");
ShowPlayerDialog(playerid, D_CHANGE_SKIN, DIALOG_STYLE_INPUT, "Skin", "Type in your wanted skin id into the input box.", "Change", "Cancel");
}
else if(IsValidSkin(strval(inputtext)) == 0)
{
SendClientMessage(playerid, COLOR, "Invalid skin ID!");
ShowPlayerDialog(playerid, D_CHANGE_SKIN, DIALOG_STYLE_INPUT, "Skin", "Type in your wanted skin id into the input box.", "Change", "Cancel");
return 1;
}
SetPlayerSkin(playerid, strval(inputtext));
SetSpawnInfo(playerid, 0, strval(inputtext), 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0); // recommended
SendClientMessage(playerid, "You have changed your skin!");
}
}
return 1;
}
stock IsValidSkin(SkinID) { if((SkinID == 0)||(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; } stock IsNumeric(string[]) { for (new i = 0, j = strlen(string); i < j; i++) { if (string[i] > '9' || string[i] < '0') return 0; } return 1; }
if(dialogid == urdialog) { if(!reponse) return SendClientMessage(playerid,COLOR_RED,"You Canceled"); if(response) { if(IsNumeric(inputtext)) { if(IsValidSkin(strval(inputtext))) { SetPlayerSkin(playerid, strval(inputtext)); } else { SendClientMessage(playerid,Color_Red,"All The Skins Availabe Exept From 1 -> 299 Exept Those Numbers :"); SendClientMessage(playerid,Color_Red,"8,65,74,86,119,149,208,265,266,267,268,269,270,271,272,273,289"); } } else { SendClientMessage(playerid,0xFF0000,"Please Use Numbers"); } } }