Comandos compartidos -
Jeree10 - 01.10.2014
Hola bueno he empezado mi Rp de 0 con CMD y quisiera saber como hago comandos compartidos osea por ejemplo para el rol:
que se pueda usar /me o /ame para rol.
Como seria?
Dejo un cmd:
Код:
CMD:me(playerid, params[]){
if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "Por favor usa {DBED15}/me texto{FFFFFF}");
new string[128];
format(string, sizeof(string), "* %s %s.", GetPlayerNameEx(playerid), params);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
Re: Comandos compartidos -
roderjit - 01.10.2014
No entendн bien eso de "comando compartido"
Re: Comandos compartidos -
LiMPiTo - 01.10.2014
ї?ї?
pawn Код:
CMD:me(playerid, params[]){
if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "Por favor usa {DBED15}/me texto{FFFFFF}");
new string[128];
format(string, sizeof(string), "* %s %s.", GetPlayerNameEx(playerid), params);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
CMD:ame(playerid, params[]){
if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "Por favor usa {DBED15}/ame texto{FFFFFF}");
new string[128];
format(string, sizeof(string), "* %s %s.", GetPlayerNameEx(playerid), params);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
Re: Comandos compartidos -
roderjit - 01.10.2014
Pero explica un poco mejor quй es lo que quieres hacer >.<
Re: Comandos compartidos -
Jeree10 - 01.10.2014
Seria algo asн lo dejo en strcmp:
Код:
if(strcmp(cmd, "/gritar", true) == 0 || strcmp(cmd, "/g", true) == 0){
if(IsPlayerConnected(playerid)){
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' ')){
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))){
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result)){
SendClientMessage(playerid, COLOR_YELLOW, "{9B1ABA}[Comando]:{FFFFFF} (/g)ritar [local chat]");
return 1;
}
new jugador[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, jugador, sizeof(jugador));
if(PlayerInfo[playerid][IUSER] >= 0){
format(string, sizeof(string), "%s Grita: Ў %s !", jugador, result);
}
ProxDetector(30.0, playerid, string,Hablar,Hablar2,Hablar3,Hablar4,Hablar5);
printf("%s", string);
}
return 1;
}
Yo lo quiero pasar a cmd ya que no se usar strcmp
Re: Comandos compartidos -
roderjit - 01.10.2014
Quieres que al usar /me o /ame realice la misma acciуn ?
Re: Comandos compartidos -
Jeree10 - 01.10.2014
Claro.
Re: Comandos compartidos -
roderjit - 01.10.2014
Prueba asн:
pawn Код:
CMD:ame(playerid, params[]) return cmd_me(playerid, params);
CMD:me(playerid, params[])
{
if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "Por favor usa {DBED15}/me texto{FFFFFF}");
new string[128];
format(string, sizeof(string), "* %s %s.", GetPlayerNameEx(playerid), params);
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 1;
}
Re: Comandos compartidos -
Jeree10 - 01.10.2014
Gracias