|
楼主 |
发表于 2009-9-8 14:42:04
|
显示全部楼层
来自 中国–湖北–黄冈
public ChangeClass(id)
{
new menu = menu_create("Class Menu" , "Class_Handle");
menu_additem(menu ,"Dog", "1" , 0);
menu_additem(menu ,"Cat", "2" , 0);
menu_additem(menu ,"Horse", "3" , 0);
menu_additem(menu ,"Cow", "4" , 0);
menu_setprop(menu , MPROP_EXIT , MEXIT_ALL);
menu_display(id , menu , 0);
return PLUGIN_CONTINUE;
}
public Class_Handle(id , menu , item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu);
}
new szCommand[6] , szName[64]; new access , callback;
menu_item_getinfo(menu , item , access , szCommand , 5 , szName , 63 , callback);
new i = str_to_num(szCommand)
if(PlayerClass[id] != i)
{
PlayerClass[id] = i client_print(id,print_chat,"You are now a %s",CLASSES[i])
}
else
{
client_print(id,print_chat,"You are alredy a %s",CLASSES[i])
}
menu_destroy(menu);
return PLUGIN_CONTINUE
}
这里是关于玩家连接服务器的相关函数
我们可以用这个函数定义
当玩家进入服务器时,读取玩家的经验,等级等等相关数据
public client_connect(id)
{
// 如果是保存经验,才会读取数据
if(get_pcvar_num(SaveXP) == 1)
{
// 读取玩家的数据
LoadData(id)
}
}
|
|