help with dcmd
#1

me and a friend of mine are making a gamemode but he started with dcmd instead of zcmd... the problem is i tried to use it to modify some stuff I get no errors although IG it says Unknown:Command


The command was defined here

Код:
dcmd(dskin,5,cmdtext);
in this list with alot of other cmds then over here


Код:
dcmd_dskin(playerid, params[])
{
	new skin;
	if(PlayerInfo[playerid][VIP] == 1) return 0;
  	if(sscanf(params,"i",skin)) return SendClientMessage(playerid,COLOR_CMDUSAGE,"USAGE: /dskin [SkinID]");
  	if(!IsValidSkin(skin)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]Invalid skinID");
  	SendClientMessage(playerid, -1, "You have successfully changed your skin.");
  	dini_IntSet(Pos(playerid),"Skin",skin);
  	SetPlayerSkin(playerid,skin);
	SetPlayerColor(playerid, COLOR_VIPPURPLE);
	return 1;
}
I get no errors in any of this code but the command isnt recognzied IG the only thing I changed was removing the 3 VIP levels and adding just 1 i removed any traces of the other vip levels and made it only fit to 1 the saving and the setvip cmd writes into the files as VIP=1 so its working is it because of the "=="? Before i had >= because of the other levels but if I put on‌ly = 1 it will give a error unintended something .
Reply
#2

Quote:
Originally Posted by Strapz
Посмотреть сообщение
Код:
if(PlayerInfo[playerid][VIP] == 1) return 0;//if VIP level is equal to 1 return 0;
This code will return Server: Unknown command message because you call return 0; if the player VIP level is equal to 1.So try this:
pawn Код:
dcmd_dskin(playerid, params[])
{
if(PlayerInfo[playerid][VIP] >= 1)//if VIP level is equal to 1 or greater continue with the command
{
       new skin;
    if(sscanf(params,"i",skin)) return SendClientMessage(playerid,COLOR_CMDUSAGE,"USAGE: /dskin [SkinID]");
    if(!IsValidSkin(skin)) return SendClientMessage(playerid,COLOR_RED,"[ERROR]Invalid skinID");
    SendClientMessage(playerid, -1, "You have successfully changed your skin.");
    dini_IntSet(Pos(playerid),"Skin",skin);
    SetPlayerColor(playerid, COLOR_VIPPURPLE);
    return SetPlayerSkin(playerid,skin);
}
else return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)