Tess:
#include <a_samp>
#define narancssarga 0xFF9900AA
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[255];
cmd = strtok(cmdtext,idx);
new idx;
if(strcmp(cmd,\"/jelentes\",true)==0)
{
new tmp[255];
new sendername[MAX_PLAYER_NAME];
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid,narancssarga,\"HASZNÁLAT: /jelentes [Jelentésed]\");
new string[255];
GetPlayerName(playerid,sendername,20);
format(string,255,\"%s jelentése: %s\",sendername,cmdtext[10]);
Jelentes(string);
SendClientMessage(playerid,narancssarga ,\"*Köszönöm hogy jelentetted!*\");
return 1;
}
return 0;
}
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;
}
forward Jelentes(string[]);
public Jelentes(string[])
{
new entry[256];
format(entry, sizeof(entry), \"%s\\r\\n\",string);
new File:hFile;
hFile = fopen(\"jelentes.log\", io_append);
if (hFile)
{
fwrite(hFile, entry);
fclose(hFile);
}
}
#include <a_samp>
#define narancssarga 0xFF9900AA
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[255];
new idx;
cmd = strtok(cmdtext,idx);
if(strcmp(cmd,\"/jelentes\",true)==0)
{
new tmp[255];
new sendername[MAX_PLAYER_NAME];
tmp = strtok(cmdtext,idx);
if(!strlen(tmp)) return SendClientMessage(playerid,narancssarga,\"HASZNÁLAT: /jelentes [Jelentésed]\");
new string[255];
GetPlayerName(playerid,sendername,20);
format(string,255,\"%s jelentése: %s\",sendername,cmdtext[10]);
Jelentes(string);
SendClientMessage(playerid,narancssarga ,\"*Köszönöm hogy jelentetted!*\");
return 1;
}
return 0;
}
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;
}
forward Jelentes(string[]);
public Jelentes(string[])
{
new entry[256];
format(entry, sizeof(entry), \"%s\\r\\n\",string);
new File:hFile;
hFile = fopen(\"jelentes.log\", io_append);
if (hFile)
{
fwrite(hFile, entry);
fclose(hFile);
}
}
tessék