Converting to 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: Converting to dcmd (
/showthread.php?tid=437420)
Converting to dcmd -
Stanford - 15.05.2013
So I've tried several times to convert this command to dcmd, and I failed somehow, read a lot of tutorials even so.. I need some help, can someone convert this to me?
pawn Код:
if(strcmp(cmd, "/setgatepass", true) == 0)
{
if(PlayerInfo[playerid][pAdmin] <= 0)
{
return SendClientMessage(playerid, COLOR_GREY," You're not authorized to use that command !");
}
new gateid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
return SendClientMessage(playerid, COLOR_GREY," USAGE: /setgatepass [gateid] [password]");
}
gateid = strvalEx(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
return SendClientMessage(playerid, COLOR_GREY," USAGE: /setgatepass [gateid] [password]");
}
if(strlen(tmp) > 20)
{
return SendClientMessage(playerid, COLOR_GREY," Gate password can't be longer than 20 characters !");
}
strmid(GateInfo[gateid][gPass], tmp, 0, strlen(tmp), 23);
new reveal[256];
format(reveal, sizeof(reveal)," Gate ID %d's password has been set to '%s' !", gateid, tmp);
SendClientMessage(playerid, COLOR_GREY, reveal);
GateInfo[gateid][gPassed] = 1;
SaveGates();
return 1;
}
Thanks in advance.
Re: Converting to dcmd -
radiobizza - 15.05.2013
Take:
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(setgatepass,11,cmdtext);
return 0;
}
dcmd_setgatepass
{
if(PlayerInfo[playerid][pAdmin] <= 0)
{
return SendClientMessage(playerid, COLOR_GREY," You're not authorized to use that command !");
}
new gateid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
return SendClientMessage(playerid, COLOR_GREY," USAGE: /setgatepass [gateid] [password]");
}
gateid = strvalEx(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
return SendClientMessage(playerid, COLOR_GREY," USAGE: /setgatepass [gateid] [password]");
}
if(strlen(tmp) > 20)
{
return SendClientMessage(playerid, COLOR_GREY," Gate password can't be longer than 20 characters !");
}
strmid(GateInfo[gateid][gPass], tmp, 0, strlen(tmp), 23);
new reveal[256];
format(reveal, sizeof(reveal)," Gate ID %d's password has been set to '%s' !", gateid, tmp);
SendClientMessage(playerid, COLOR_GREY, reveal);
GateInfo[gateid][gPassed] = 1;
SaveGates();
return 1;
}
Re: Converting to dcmd -
Stanford - 15.05.2013
Undefined TMPs and cmdtexts errors appeared appeared