01.04.2014, 02:13
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;
}
:\ 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;
}