rendered paste body#include <a_samp>
/*-----------STRTOK FUNCTION-----------*/
strtok( const string[], &index, const seperator[] = " " )
{
new
index2,
result[ 30 ];
index2 = strfind(string, seperator, false, index);
if(index2 == -1)
{
if(strlen(string) > index)
{
strmid(result, string, index, strlen(string), 30);
index = strlen(string);
}
return result; // This string is empty, probably, if index came to an end
}
if(index2 > (index + 29))
{
index2 = index + 29;
strmid(result, string, index, index2, 30);
index = index2;
return result;
}
strmid(result, string, index, index2, 30);
index = index2 + 1;
return result;
}
/*---------STRTOK FUNCTION END---------*/
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[30];
new idx;
cmd = strtok(cmdtext, idx);
if(strcmp(cmd, "/hola", true) == 0)
{
new tmp[30];
tmp = strtok(cmdtext, idx);
new otherplayer = strval(tmp);
if(IsPlayerConnected(otherplayer))
{
if(otherplayer == playerid)
{
SendClientMessage(playerid, 0xFFFF00AA, "¿Porque no hablas con otras personas en vez de hablarte a ti mismo?");
}
else
{
SendClientMessage(otherplayer, 0xFFFF00AA, "Holas =)");
}
}
else
{
SendClientMessage(playerid, 0xFFFF00AA, "Ese jugador no esta conectado");
}
return 1;
}
return 0;
}