BUILDIN_FUNC(warp)
{
int ret;
int x,y;
const char* str;
TBL_PC* sd;
sd = script_rid2sd(st);
if( sd == NULL )
return 0;
str = script_getstr(st,2);
x = script_getnum(st,3);
y = script_getnum(st,4);
if(strcmp(str,"Random")==0)
ret = pc_randomwarp(sd,CLR_TELEPORT);
else if(strcmp(str,"SavePoint")==0 || strcmp(str,"Save")==0)
ret = pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,CLR_TELEPORT);
else if(map_flag_gvg(sd->bl.m)){ //checking max_guildmenber
int count = 0; //guild menber count
for( i = c = 0; i < g->max_member && c < map[m].guild_max; i++ )
if( g->member[i].sd && g->member[i].sd->bl.m == m )
c++;
if (map[sd->bl.m].guild_max && count >= map[sd->bl.m].guild_max){
char output[256] = "There too much guildies in castle atm to be warped in";
clif_disp_message(sd->bl,output,strlen(output),SELF);
}
}
else
ret = pc_setpos(sd,mapindex_name2id(str),x,y,CLR_OUTSIGHT);
if( ret ) {
ShowError("buildin_warp: moving player '%s' to \"%s\",%d,%d failed.\n", sd->status.name, str, x, y);
script_reportsrc(st);
}
return 0;
}