PDA

View Full Version : Command help


Ananisiki
21/03/2014, 07:30 PM
how can i do this so if a player do like /skin 2 his skin will be set to 2

if he type /skin only, the menu will show up


{
new pID;
new skinid;
if(sscanf(params, "d", skinid)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /skin (Skin ID) - Enter A Valid Skin ID");
if(Dead[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Dead.");
if(GetPVarInt(playerid, "IsSpecing") == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Spectating.");
if(GetPVarInt(playerid, "IsFrozen") == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Frozen.");
if(GetPVarInt(playerid, "IsCaged") == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Caged.");
if(GetPVarInt(playerid, "IsJailed") == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Jailed.");
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command From A Vehicle.");
if(sscanf(params, "u", pID))
{
if(skinid > 299 || skinid < 0) return SendClientMessage(playerid, COLOR_RED, "Invalid Skin ID.");
if(skinid == GetPlayerSkin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You Already Have This Skin.");
if(skinid == 294 || skinid == 0) return SendClientMessage(playerid, COLOR_RED, "You Must Be An Admin To Choose This Skin.");
SetPlayerSkin(playerid, skinid);
}
else
{
ShowModelSelectionMenu(playerid, skinlist, "Select A Skin", 0, 1 , 0);
}
return 1;
}

CroM256
21/03/2014, 08:03 PM
if(sscanf(params, "d", skinid)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /skin (Skin ID) - Enter A Valid Skin ID");
Use this line, if u want in dialog then do this:
if(sscanf(params, "d", skinid)) return ShowPlayerDialog...

Equuuuin0X
22/03/2014, 12:04 AM
Remove the SendClientMessage(playerid, blabla skin [id] Into return ShowPlayerDialog.

Like above guy said.

Ananisiki
22/03/2014, 06:56 AM
Hmmmm, doesnt work, what i want is like if he type /skin id it will be set, but if he dont know the skin id and just type /skin the model section will show up

Ananisiki
22/03/2014, 08:43 AM
Really need help with this.....

Stinged
22/03/2014, 08:54 AM
Change to what CroM256 said, and add if(!sscanf(..))
Using ! with sscanf is if the play entered the correct form, which is a skin ID here.

Ananisiki
22/03/2014, 08:55 AM
I did but it didnt work

Ananisiki
23/03/2014, 03:34 AM
Bump

Hanuman
23/03/2014, 03:51 AM
Define this at top:
#if !defined isnull
#define isnull(%1) \
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif

And here is ur cmd

{
new pID;
new skinid;
if(Dead[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Dead.");
if(GetPVarInt(playerid, "IsSpecing") == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Spectating.");
if(GetPVarInt(playerid, "IsFrozen") == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Frozen.");
if(GetPVarInt(playerid, "IsCaged") == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Caged.");
if(GetPVarInt(playerid, "IsJailed") == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Jailed.");
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command From A Vehicle.");
if(isnull(params))
{
ShowModelSelectionMenu(playerid, skinlist, "Select A Skin", 0, 1 , 0);
}
new skinid ;
skinid = strval(params);

if(skinid > 299 || skinid < 0) return SendClientMessage(playerid, COLOR_RED, "Invalid Skin ID.");
if(skinid == GetPlayerSkin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You Already Have This Skin.");
if(skinid == 294 || skinid == 0) return SendClientMessage(playerid, COLOR_RED, "You Must Be An Admin To Choose This Skin.");
SetPlayerSkin(playerid, skinid);
return 1;
}


I have removed the sscanf

Ananisiki
23/03/2014, 05:22 AM
If i write /skin and the model shows up, it says you must be an admin to select this skin even if i havnt chosen one

Hanuman
23/03/2014, 05:24 AM
{
new pID;
if(Dead[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Dead.");
if(GetPVarInt(playerid, "IsSpecing") == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Spectating.");
if(GetPVarInt(playerid, "IsFrozen") == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Frozen.");
if(GetPVarInt(playerid, "IsCaged") == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Caged.");
if(GetPVarInt(playerid, "IsJailed") == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Jailed.");
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command From A Vehicle.");
if(isnull(params))
{
ShowModelSelectionMenu(playerid, skinlist, "Select A Skin", 0, 1 , 0);
}
new skinid ;
skinid = strval(params);

if(skinid > 299 || skinid < 0) return SendClientMessage(playerid, COLOR_RED, "Invalid Skin ID.");
if(skinid == GetPlayerSkin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You Already Have This Skin.");
if(skinid == 294) return SendClientMessage(playerid, COLOR_RED, "You Must Be An Admin To Choose This Skin.");
SetPlayerSkin(playerid, skinid);
return 1;
}

Ananisiki
23/03/2014, 05:33 AM
Same, and it says that i cant choose skin id 294, 298 and 0 i am admin but i cant still choose

Hanuman
23/03/2014, 05:40 AM
{
new pID;
if(Dead[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Dead.");
if(GetPVarInt(playerid, "IsSpecing") == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Spectating.");
if(GetPVarInt(playerid, "IsFrozen") == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Frozen.");
if(GetPVarInt(playerid, "IsCaged") == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Caged.");
if(GetPVarInt(playerid, "IsJailed") == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Jailed.");
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command From A Vehicle.");
if(isnull(params))
{
ShowModelSelectionMenu(playerid, skinlist, "Select A Skin", 0, 1 , 0);
}
new skinid ;
skinid = strval(params);

if(skinid > 299 || skinid < 0) return SendClientMessage(playerid, COLOR_RED, "Invalid Skin ID.");
if(skinid == GetPlayerSkin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You Already Have This Skin.");
if(PlayerInfo[playerid][Level] == 0 && skinid == 294) return SendClientMessage(playerid, COLOR_RED, "You Must Be An Admin To Choose This Skin.");
SetPlayerSkin(playerid, skinid);
return 1;
}

Try this!

Ananisiki
27/03/2014, 11:11 PM
Still the same,, bump

MattTucker
27/03/2014, 11:34 PM
Can you explain it a bit more? Like it shows the skin selection dialog for players and only admins can use /skin [id] ?

Ananisiki
27/03/2014, 11:41 PM
When the player types /skin without the id, the model selection shows up but it sends that message that i neeed to be an admin....

MattTucker
28/03/2014, 12:01 AM
{
new skinid;
if(Dead[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Dead.");
if(GetPVarInt(playerid, "IsSpecing") == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Spectating.");
if(GetPVarInt(playerid, "IsFrozen") == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Frozen.");
if(GetPVarInt(playerid, "IsCaged") == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Caged.");
if(GetPVarInt(playerid, "IsJailed") == 1) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command When Jailed.");
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You Cannot Use This Command From A Vehicle.");
if(sscanf(params, "d", skinid))
{
if(skinid > 299 || skinid < 0) return SendClientMessage(playerid, COLOR_RED, "Invalid Skin ID.");
if(skinid == GetPlayerSkin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You Already Have This Skin.");
if(skinid == 294 || skinid == 0) return SendClientMessage(playerid, COLOR_RED, "You Must Be An Admin To Choose This Skin.");
SetPlayerSkin(playerid, skinid);
return 1;
}
else
{
ShowModelSelectionMenu(playerid, skinlist, "Select A Skin", 0, 1 , 0);
}
return 1;
}

It might work