26.07.2010, 11:11
Well when I write a commad i have it doesn't appear(if it is a text) and doesn't do anything , I trayd to write a cmd I don't have and it didn't shown me the "SERVER:Unknown command!" message , why is that ?
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/spraycan", cmdtext, true, 10) == 0){
GivePlayerWeapon(playerid, 41, 70);
return 1;
}
return 0;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/spraycan", cmdtext, true, 10) == 0){
GivePlayerWeapon(playerid, 41, 70);
}
return 0;
}
warning 213: tag mismatch
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if (strcmp(cmd,"/spraycan", true) == 0)
{
GivePlayerWeapon(playerid, 41, 70);
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;
}
new cmd[256];
new idx;
cmd = strtok(cmdtext, idx);
if (strcmp("/kill", cmdtext, true, 10) == 0)
{
SetPlayerHealth(playerid, 0);
}