24.08.2010, 02:26
(
Last edited by pagaromx96; 24/08/2010 at 10:22 PM.
)
Quote:
si que se puede, seria realmente absurdo ya que en casos de comandos en los cuales no se necesitan parametros, usar dcmd no seria lo optimo.
|
bueno Erasrg aca tenes otro FS srcmp
yo no tube problema con este ni con el otro este es mas simple
pawn Code:
#include <a_samp>
#pragma tabsize 0
new COLOR[MAX_PLAYERS];
new TCOLOR[MAX_PLAYERS];
forward Cifrar(string[]);
stock strtok(const string[], &index,seperator=' ')
{
new length = strlen(string);
new offset = index;
new result[128];
while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
if ((index < length) && (string[index] == seperator))
{
index++;
}
return result;
}
stock Nombre(playerid) {
new nombre[255];
GetPlayerName(playerid, nombre, 255);
return nombre;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
TCOLOR[playerid] = 0;
COLOR[playerid] = 0;
return 1;
}
public OnPlayerText(playerid, text[])
{
if(TCOLOR[playerid] == 1)
{
if(text[0] != '#')
{
if( text[0] != '#')
{
new string[256];
format(string, sizeof(string),"%s: %s", Nombre(playerid), text);
SendClientMessageToAll(COLOR[playerid],string);
}
}
return 0;
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128];
new idx;
cmd = strtok(cmdtext,idx);
if(strcmp(cmd, "/azul", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
TCOLOR[playerid] = 1;
COLOR[playerid] = 0x2587CEAA;
SetPlayerColor(playerid, 0x2587CEAA);
SendClientMessage(playerid, 0x2587CEAA, "Activaste el color azul");
return 1;
}
}
if(strcmp(cmd, "/rosa", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
TCOLOR[playerid] = 1;
COLOR[playerid] = 0xFF66FFAA;
SetPlayerColor(playerid, 0xFF66FFAA);
SendClientMessage(playerid, 0xFF66FFAA, "Activaste el color rosa");
return 1;
}
}
if(strcmp(cmd, "/verde", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
TCOLOR[playerid] = 1;
COLOR[playerid] = 0x0DE018AA;
SetPlayerColor(playerid, 0x0DE018AA);
SendClientMessage(playerid, 0x0DE018AA, "Activaste el color verde");
return 1;
}
}
if(strcmp(cmd, "/rojo", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
TCOLOR[playerid] = 1;
COLOR[playerid] = 0xFF393FFF;
SetPlayerColor(playerid, 0xFF393FFF);
SendClientMessage(playerid, 0xFF393FFF, "Activaste el color rojo");
return 1;
}
}
if(strcmp(cmd, "/nocolor", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
TCOLOR[playerid] = 0;
COLOR[playerid] = 0;
return 1;
}
}
return 0;
}