GTA Közösség - A magyar GTA fórum

San Andreas Multiplayer (SA-MP) => SA-MP: Szerverfejlesztés => Segítségkérés => A témát indította: anorennia - 2012. augusztus 06. - 17:58:01

Cím: cmdtext
Írta: anorennia - 2012. augusztus 06. - 17:58:01
Üdv.
Valaki meg tudná mondani, hogy lehet, olyat csinálni, vagy lehet e, hogy valaki xy koordinátán(rangeofpointban) van
és ha beírja, hogy cóla akkor az npc ami ott van válaszol, meg csinál valami és kap pl cólát ^^
Cím: cmdtext
Írta: Szilard - 2012. augusztus 06. - 18:21:16
Segítek elindulni. Nem teszteltem.
 
public OnPlayerText(playerid, text[])
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, 0.0, 0.0, 0.0))
{
new idx;
new tmp[256];
tmp = strtok(text, idx);
if ((strcmp(\"kóla\", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen(\"kóla\")))
{
   SendClientMessage(playerid, 0xAFAFAFAA, \"Tessék, válaszolok, itt a kóla!\");
}
}
return 1;
}
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;
}
Cím: cmdtext
Írta: anorennia - 2012. augusztus 06. - 18:25:02
Köszönöm, ment a plusz :)