שלום.
אני הולך לתת לכם קוד של פונקצייה קלה מאוד, שהפונקצייה משמשת כ:
אם אתה רוצה לבטל את כל הפקודות במוד אתה משתמש בפונקצייה: Kickpossible();
אם אתה רוצה שהפקודות במוד לא יבטלו אתה משתמש בפונקצייה:Setpossible();
קל מאוד.
אני יתן לכם את כל הקוד, כסקריפט.
PHP Code:
#include a_samp
#define white 0xFFFFFFAA
new possible;
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[256], idx;
cmd = strtok(cmdtext,idx);
if(!possible) return SendClientMessage(playerid, white, "SERVER: Unknowen command.");
/*
usage:
Setpossible();
Kickpossible();
*/
return 0;
}
forward Setpossible(); public Setpossible() return possible = 1;
forward Kickpossible(); public Kickpossible() return possible = 0;
stock strtok(const string[], &index)
{
new length = strlen(string); while((index < length) && (string[index] <= ' ') && (string[index] > '\r')) index++;
new offset = index, result[30]; while((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)) && (string[index] > '\r')) result[index - offset] = string[index], index++;
result[index - offset] = EOS; return result;
}