21.07.2013, 03:02
What that's?
This just for fun, if player say "What?" or "What ?" or "?"
And this object will be Remove after 3sec
This just for fun, if player say "What?" or "What ?" or "?"
And this object will be Remove after 3sec
pawn Код:
#include <a_samp>
#define What? 3
public OnPlayerText(playerid, text[])
{
new idx;
new tmp[128];
tmp = strtok(text, idx);
if((strcmp("What?", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("What?")))
{
SetPlayerAttachedObject(playerid, What?, 3215, 1, 0.8249, 0.0689, -0.0099, -11.4000, 89.3999, 0.7999, 1.0000, 1.0000, 1.0000, 0, 0); // "Man3rf" by Willam_Joe (Skin:291)
SetTimerEx("RemoveWhat",3000,false,"i",playerid);
return 0;
}
if((strcmp("What ?", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("What ?")))
{
SetPlayerAttachedObject(playerid, What?, 3215, 1, 0.8249, 0.0689, -0.0099, -11.4000, 89.3999, 0.7999, 1.0000, 1.0000, 1.0000, 0, 0); // "Man3rf" by Willam_Joe (Skin:291)
SetTimerEx("RemoveWhat",3000,false,"i",playerid);
return 0;
}
if((strcmp("?", tmp, true, strlen(tmp)) == 0) && (strlen(tmp) == strlen("?")))
{
SetPlayerAttachedObject(playerid, What?, 3215, 1, 0.8249, 0.0689, -0.0099, -11.4000, 89.3999, 0.7999, 1.0000, 1.0000, 1.0000, 0, 0); // "Man3rf" by Willam_Joe (Skin:291)
SetTimerEx("RemoveWhat",3000,false,"i",playerid);
return 0;
}
return 1;
}
forward RemoveWhat(playerid);
public RemoveWhat(playerid)
{
RemovePlayerAttachedObject(playerid, What?);
return;
}
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;
}