All pastes #1351922 Raw Edit

NMC v0.20

public cpp v1 · immutable
#1351922 ·published 2009-03-03 13:38 UTC
rendered paste body
#include <a_samp>#pragma tabsize 0const Messege = 0xFFFF00AA;enum ColorInfo{	COLOR_name[64],	COLOR_cmd[32],	COLOR_hex}new Colors[][ColorInfo] ={//      {"色の名前","コマンド名",  色id      },	{"Black",   "black",       0xffffff00},//黒	{"Silver",  "silver",      0xfffafa00},//銀色	{"Gray",    "gray",        0xf8f8ff00},//灰色	{"White",   "white",       0xfffaf000},//白	{"Maroon",  "maroon",      0xfaf0e600},//赤茶色	{"Red",     "red",         0xfaebd700},//赤	{"Purple",  "purple",      0xffefd500},//紫	{"Fuchsia", "fuchsia",     0xffebcd00},//薄紫	{"Green",   "green",       0xffe4c400},//緑	{"Lime",    "lime",        0xffe4b500},//黄緑	{"Olive",   "olive",       0xffdead00},//黄土色	{"Yellow",  "yellow",      0xffdab900},//黄色	{"Navy",    "navy",        0xffe4e100},//藍色	{"Blue",    "blue",        0xfff0f500},//青	{"Teal",    "teal",        0xfff5ee00},//鴨羽色	{"Aqua",    "aqua",        0xfff5ee00},//水色	{"Orange",  "orange",      0xfff5ee00}//橙色};public OnFilterScriptInit(){	SendClientMessageToAll(Messege, "Reloading colors.amx...");	return 1;}public OnFilterScriptExit(){	SendClientMessageToAll(Messege, "unloaded colors.amx.");	return 1;}public OnPlayerCommandText(playerid, cmdtext[]){	new cmd[256];	new idx;		cmd = strtok(cmdtext, idx);	if (strcmp("/color", cmd, true) == 0)	{			cmd = strtok(cmdtext, idx);			if(!strlen(cmd))		{			SendClientMessage(playerid, Messege, " 使い方: /color [カラー名]");			return 1;		}				if(strlen(cmd))		{			// /color [色の名前]			for(new i = 0; i < sizeof(Colors); ++i) {				if(strcmp(Colors[i][COLOR_cmd], cmd, true) == 0) {					Color(playerid, Colors[i][COLOR_hex], Colors[i][COLOR_name]);					return 1;				}			}    			SendClientMessage(playerid, Messege, " 指定された色は見つかりませんでした。");			return 1;		}		return 1;	}	return 0;}stock Color(playerid, color, const title[]){	new message[256];	strcat(message, " 名前の色を");	strcat(message, title);	strcat(message, " に変更しました.");	SendClientMessageToAll(color, message);	SetPlayerColor(playerid, color);	return;}strtok(const string[], &index){	new length = strlen(string);	while ((index < length) && (string[index] <= ' '))	{		index++;	}	new offset = index;	new result[20];	while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))	{		result[index - offset] = string[index];		index++;	}	result[index - offset] = EOS;	return result;}