help with dcmd - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: help with dcmd (
/showthread.php?tid=464764)
help with dcmd -
Strapz - 18.09.2013
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 only = 1 it will give a error unintended something .
Re: help with dcmd -
x96664 - 18.09.2013
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;
}