STRCMP convert to ZCMD -
donhu789 - 31.03.2014
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new idx;
new cmd[256];
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/help", true) == 0 || strcmp(cmd, "/about", true) == 0)
{
new dialogbox[1024];
strcat(dialogbox,"{ffcc00}Hello, dear player! We are happy to see you here! \nIt is a place where you can show everybody your imagination and creativity! \n");
strcat(dialogbox,"{00ff00}Create magnificent masterworks from cubes, or just build something more simple - the choice is yours!\n");
format(stringu, sizeof(stringu), "{ff00ff}To switch blocks, press button {ff0000}%s. \n{ff00ff}To put the block, press {ff0000}%s, {ff00ff} to destroy it, press {ff0000}%s. \n{ff00ff}To change the decoration rotation press {ff0000}%s.\n{ff00ff}To disable block selection press {ff0000}%s\n",BUTTON_SWITCH_T,BUTTON_PUT_T, BUTTON_DESTROY_T,BUTTON_ROTATE_T,BUTTON_DISABLE_T);
strcat(dialogbox,stringu);
format(stringu, sizeof(stringu), "{00ffff}That's all! Good luck and enjoy your game! If you need commands list, check /cmd.\n\n{ff00ff}Project is in development. Since 7 March 2013\nScripter and owner: %s aka %s\nSkype: %s\n\n",NICK,FULL_NAME,SKYPE);
strcat(dialogbox,stringu);
format(stringu,sizeof(stringu),"{ffff00}Special thanks for help and testing:\n{00ff00}%s\n\n{ffff00}And, ofcourse, many thanks to theese people for their tools and plugins:\n{ff0000}%s",CREDITS,CREDITS_2);
strcat(dialogbox,stringu);
SPD(playerid, DIALOGID+1000, DIALOG_STYLE_MSGBOX, "MWF-Express your creativity", dialogbox, "..::Ok::..", "");
return 1;
}
if(strcmp(cmd, "/cmd", true) == 0 || strcmp(cmd, "/c", true) == 0 || strcmp(cmd, "/command", true) == 0 || strcmp(cmd, "/commands", true) == 0 || strcmp(cmd, "/cmds", true) == 0)
{
new dialogbox[1024];
strcat(dialogbox,"{ff00ff}Server commands list:\n\n");
strcat(dialogbox,"{ffff00}/spawn - go to spawn place\n");
strcat(dialogbox,"{ffff00}/fly - get jetpack to fly\n{ffff00}/safe [distance] - to set a safe zone at your place\n\n{ffff00}/delsafe - to delete your safe zone\n");
strcat(dialogbox,"{ffff00}/label [text] - to set a label at your place\n{ffff00}/dellabel - to delete your label\n");
SPD(playerid, DIALOGID+1000, DIALOG_STYLE_LIST, "MWF-xpress your creativity", dialogbox, "..::Ok::..", "");
return 1;
}
if (!strcmp("/test", cmd, true))
{
new tmp[512];
tmp = strtok(cmdtext, idx);
PlayerPlaySound(playerid,strval(tmp),0,0,0);
return 1;
}
if (!strcmp("/switch", cmd, true))
{
ShowMPMenu(playerid, switchlist, "Switch blocks",cnames,9, 0xc8c6bf44, 0xDBC77E77 , 0xF4B81BAA);
return 1;
}
if (!strcmp("/spawn", cmd, true))
{
SetPlayerPos(playerid,BASE_PLACE_X, BASE_PLACE_Y, BASE_PLACE_Z+2);
Inform(playerid,"{00ff00}You have been successfully teleported to spawn!");
return 1;
}
if (!strcmp("/jet", cmd, true) || !strcmp("/jp", cmdtext, true) || !strcmp("/jetpack", cmdtext, true) || !strcmp("/fly", cmdtext, true))
{
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USEJETPACK);
return 1;
}
if (!strcmp("/safe", cmd, true))
{
new tmp[512];
tmp = strtok(cmdtext, idx);
if(strval(tmp)<=0 || strval(tmp)>15) return Warn(playerid,"{ff0000}USAGE: /safe [radius:1-15]");
if(IsPlayerInAnyDynamicArea(playerid)) return Warn(playerid,"{ff0000}You are in another safe area! Come to another place!");
new Float:x,Float:y,Float:z;
new ft[256];
new tt[100];
GetPlayerPos(playerid,x,y,z);
if(IsValidDynamicArea(Zone[playerid][0]))
{
DestroyDynamicArea(Zone[playerid][0]);
format(tt,sizeof(tt),"%d",Zone[playerid][1]);
dini_Unset(ZONESFILE,tt);
SAVED_ZONE[Zone[playerid][1]]=-1;
Zone[playerid][1]=-1;
Zone[playerid][0]=-1;
}
Zone[playerid][0]=CreateDynamicCircle(x,y,strval(tmp));
new d=0;
new idrd=0;
new zoneidx;
while (d==0)
{
idrd++;
if(SAVED_ZONE[idrd]!=-1) d=0;
else d=1, zoneidx=idrd;
}
format(tt,sizeof(tt),"%d",zoneidx);
Zone[playerid][1]=zoneidx;
SAVED_ZONE[zoneidx]=Zone[playerid][0];
format(ft,sizeof(ft),"%f %f %d",x,y,strval(tmp));
dini_Set(ZONESFILE,tt,ft);
new file[256];
GetPlayerName(playerid, pname, sizeof(pname));
format(file,sizeof(file),USERFILE,pname);
dini_IntSet(file,"SAFE_ZONE",zoneidx);
Inform(playerid,"You have just created a safe zone at this place! Only can build here now!");
return 1;
}
if (!strcmp("/delsafe", cmd, true))
{
new tt[100];
if(IsValidDynamicArea(Zone[playerid][0]))
{
DestroyDynamicArea(Zone[playerid][0]);
format(tt,sizeof(tt),"%d",Zone[playerid][1]);
dini_Unset(ZONESFILE,tt);
SAVED_ZONE[Zone[playerid][1]]=-1;
Zone[playerid][1]=-1;
Zone[playerid][0]=-1;
Inform(playerid,"{00ff00}You have just deleted your safe zone!");
}
else
{
Warn(playerid,"{ff0000}You don't have any safe zone created!");
}
return 1;
}
if (!strcmp("/label", cmd, true))
{
new tmp[1024];
sscanf(cmdtext, "{s[256]}p<->s[1024]", tmp);
if(strlen(tmp)<=0 || strlen(tmp)>50) return Warn(playerid,"{ff0000}USAGE: /label [text from 1 to 50 characters]");
new Float:x,Float:y,Float:z;
new ft[256];
new tt[100];
GetPlayerPos(playerid,x,y,z);
if(IsValidDynamic3DTextLabel(Label[playerid]))
{
DestroyDynamic3DTextLabel(Label[playerid]);
format(tt,sizeof(tt),"%d",Label_ID[playerid]);
dini_Unset(LABELSFILE,tt);
SAVED_LABEL[Label_ID[playerid]]=Text3D:-1;
Label_ID[playerid]=-1;
Label[playerid]=Text3D:-1;
}
Label[playerid]=CreateDynamic3DTextLabel(tmp,0xFFFFFFFF, x,y,z,500);
new d=0;
new idrd=0;
new zoneidx;
while (d==0)
{
idrd++;
if(SAVED_LABEL[idrd]!=Text3D:-1) d=0;
else d=1, zoneidx=idrd;
}
format(tt,sizeof(tt),"%d",zoneidx);
Label_ID[playerid]=zoneidx;
SAVED_LABEL[zoneidx]=Label[playerid];
format(ft,sizeof(ft),"%f %f %f %s",x,y,z,tmp);
dini_Set(LABELSFILE,tt,ft);
new file[256];
GetPlayerName(playerid, pname, sizeof(pname));
format(file,sizeof(file),USERFILE,pname);
dini_IntSet(file,"SAFE_LABEL",zoneidx);
Inform(playerid,"{00ff00}You have just created a text label at this place!");
return 1;
}
if (!strcmp("/dellabel", cmd, true))
{
new tt[100];
if(IsValidDynamic3DTextLabel(Label[playerid]))
{
DestroyDynamic3DTextLabel(Label[playerid]);
format(tt,sizeof(tt),"%d",Label_ID[playerid]);
dini_Unset(LABELSFILE,tt);
SAVED_LABEL[Label_ID[playerid]]=Text3D:-1;
Label_ID[playerid]=-1;
Label[playerid]=Text3D:-1;
Inform(playerid,"{00ff00}You have just deleted your text label!");
}
else
{
Warn(playerid,"{ff0000}You don't have any label created!");
}
return 1;
}
return Warn(playerid,"{ff0000}This command does not exist! {ffffff}Look at commands list! /cmd");
}
can anyone convert all of this for me to ZCMD because i did it but some cmds bugged please help
Re: STRCMP convert to ZCMD -
anou1 - 31.03.2014
Hi, show us what you did.
Then we will tell you what's wrong with your CMDs.
With this you will learn for the future.
Re: STRCMP convert to ZCMD -
donhu789 - 31.03.2014
:\ i delete it beacuase buggy so now i need your help
Re: STRCMP convert to ZCMD -
iFarbod - 31.03.2014
u must rewrite it under this template :
pawn Код:
CMD:yourcmdname(playerid, params[])
{
// code of ur cmd
return 1;
}
TIP: Use sscanf instead of strtok.
Re: STRCMP convert to ZCMD -
iFarbod - 31.03.2014
Spawning a jetpack on a player :
pawn Код:
CMD:jetpack(playerid, params[])
{
new targetid;
if(!IsPlayerAdmin(playerid)) return 0;
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_DANGER, "INVALID USAGE! Valid Usage : /jetpack [playerid]");
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
SendClientMessage(playerid, COLOR_PRIMARY, "An Admin given u a jetpack! Have fun!");
}
Re: STRCMP convert to ZCMD -
donhu789 - 31.03.2014
can you just help me convert all the commands into CMD ?
Re: STRCMP convert to ZCMD -
donhu789 - 31.03.2014
pawn Код:
CMD:label(playerid, params[])
{
new tmp[1024];
sscanf(cmd, "{s[256]}p<->s[1024]", tmp);
if(strlen(tmp)<=0 || strlen(tmp)>50) return Warn(playerid,"{ff0000}USAGE: /label [text from 1 to 50 characters]");
new Float:x,Float:y,Float:z;
new ft[256];
new tt[100];
GetPlayerPos(playerid,x,y,z);
if(IsValidDynamic3DTextLabel(Label[playerid]))
{
DestroyDynamic3DTextLabel(Label[playerid]);
format(tt,sizeof(tt),"%d",Label_ID[playerid]);
dini_Unset(LABELSFILE,tt);
SAVED_LABEL[Label_ID[playerid]]=Text3D:-1;
Label_ID[playerid]=-1;
Label[playerid]=Text3D:-1;
}
Label[playerid]=CreateDynamic3DTextLabel(tmp,0xFFFFFFFF, x,y,z,500);
new d=0;
new idrd=0;
new zoneidx;
while (d==0)
{
idrd++;
if(SAVED_LABEL[idrd]!=Text3D:-1) d=0;
else d=1, zoneidx=idrd;
}
format(tt,sizeof(tt),"%d",zoneidx);
Label_ID[playerid]=zoneidx;
SAVED_LABEL[zoneidx]=Label[playerid];
format(ft,sizeof(ft),"%f %f %f %s",x,y,z,tmp);
dini_Set(LABELSFILE,tt,ft);
new file[256];
GetPlayerName(playerid, pname, sizeof(pname));
format(file,sizeof(file),USERFILE,pname);
dini_IntSet(file,"SAFE_LABEL",zoneidx);
Inform(playerid,"{00ff00}You have just created a text label at this place!");
return 1;
}
problem = sscanf(cmd, "{s[256]}p<->s[1024]", tmp);
:\ C:\Documents and Settings\PhongLan\Desktop\New Folder (6)\gamemodes\UCW.pwn(266
: error 017: undefined symbol "cmd"
pawn Код:
CMD:safe(playerid, params[])
{
new idx;
new cmd[256];
new tmp[512];
tmp = strtok(cmd, idx);
if(strval(tmp)<=0 || strval(tmp)>15) return Warn(playerid,"{ff0000}USAGE: /safe [radius:1-15]");
if(IsPlayerInAnyDynamicArea(playerid)) return Warn(playerid,"{ff0000}You are in another safe area! Come to another place!");
new Float:x,Float:y,Float:z;
new ft[256];
new tt[100];
GetPlayerPos(playerid,x,y,z);
if(IsValidDynamicArea(Zone[playerid][0]))
{
DestroyDynamicArea(Zone[playerid][0]);
format(tt,sizeof(tt),"%d",Zone[playerid][1]);
dini_Unset(ZONESFILE,tt);
SAVED_ZONE[Zone[playerid][1]]=-1;
Zone[playerid][1]=-1;
Zone[playerid][0]=-1;
}
Zone[playerid][0]=CreateDynamicCircle(x,y,strval(tmp));
new d=0;
new idrd=0;
new zoneidx;
while (d==0)
{
idrd++;
if(SAVED_ZONE[idrd]!=-1) d=0;
else d=1, zoneidx=idrd;
}
format(tt,sizeof(tt),"%d",zoneidx);
Zone[playerid][1]=zoneidx;
SAVED_ZONE[zoneidx]=Zone[playerid][0];
format(ft,sizeof(ft),"%f %f %d",x,y,strval(tmp));
dini_Set(ZONESFILE,tt,ft);
new file[256];
GetPlayerName(playerid, pname, sizeof(pname));
format(file,sizeof(file),USERFILE,pname);
dini_IntSet(file,"SAFE_ZONE",zoneidx);
Inform(playerid,"You have just created a safe zone at this place! Only can build here now!");
return 1;
}
CMD:delsafe(playerid, params[])
{
new tt[100];
if(IsValidDynamicArea(Zone[playerid][0]))
{
DestroyDynamicArea(Zone[playerid][0]);
format(tt,sizeof(tt),"%d",Zone[playerid][1]);
dini_Unset(ZONESFILE,tt);
SAVED_ZONE[Zone[playerid][1]]=-1;
Zone[playerid][1]=-1;
Zone[playerid][0]=-1;
Inform(playerid,"{00ff00}You have just deleted your safe zone!");
}
else
{
Warn(playerid,"{ff0000}You don't have any safe zone created!");
}
return 1;
}
CMD:label(playerid, params[])
{
new tmp[1024];
sscanf(cmd, "{s[256]}p<->s[1024]", tmp);
if(strlen(tmp)<=0 || strlen(tmp)>50) return Warn(playerid,"{ff0000}USAGE: /label [text from 1 to 50 characters]");
new Float:x,Float:y,Float:z;
new ft[256];
new tt[100];
GetPlayerPos(playerid,x,y,z);
if(IsValidDynamic3DTextLabel(Label[playerid]))
{
DestroyDynamic3DTextLabel(Label[playerid]);
format(tt,sizeof(tt),"%d",Label_ID[playerid]);
dini_Unset(LABELSFILE,tt);
SAVED_LABEL[Label_ID[playerid]]=Text3D:-1;
Label_ID[playerid]=-1;
Label[playerid]=Text3D:-1;
}
Label[playerid]=CreateDynamic3DTextLabel(tmp,0xFFFFFFFF, x,y,z,500);
new d=0;
new idrd=0;
new zoneidx;
while (d==0)
{
idrd++;
if(SAVED_LABEL[idrd]!=Text3D:-1) d=0;
else d=1, zoneidx=idrd;
}
format(tt,sizeof(tt),"%d",zoneidx);
Label_ID[playerid]=zoneidx;
SAVED_LABEL[zoneidx]=Label[playerid];
format(ft,sizeof(ft),"%f %f %f %s",x,y,z,tmp);
dini_Set(LABELSFILE,tt,ft);
new file[256];
GetPlayerName(playerid, pname, sizeof(pname));
format(file,sizeof(file),USERFILE,pname);
dini_IntSet(file,"SAFE_LABEL",zoneidx);
Inform(playerid,"{00ff00}You have just created a text label at this place!");
return 1;
}
CMD:dellabel(playerid, params[])
{
new tt[100];
if(IsValidDynamic3DTextLabel(Label[playerid]))
{
DestroyDynamic3DTextLabel(Label[playerid]);
format(tt,sizeof(tt),"%d",Label_ID[playerid]);
dini_Unset(LABELSFILE,tt);
SAVED_LABEL[Label_ID[playerid]]=Text3D:-1;
Label_ID[playerid]=-1;
Label[playerid]=Text3D:-1;
Inform(playerid,"{00ff00}You have just deleted your text label!");
}
else
{
Warn(playerid,"{ff0000}You don't have any label created!");
}
return 1;
}
These commands won't Work went i type =.=
Re: STRCMP convert to ZCMD -
donhu789 - 31.03.2014
hello ?