10.02.2017, 10:29
Hello everyone,
So, I've made a command, to store text, here's the usage: /addhit [TEXT].
I want to store the text in "hInfo[hintid][hText]", and I want to add a condition "if the text length is more than 'HINT_LEN' then send an error to the player.
I've made it, but unfortunately it's completely bugged, help:
So, I've made a command, to store text, here's the usage: /addhit [TEXT].
I want to store the text in "hInfo[hintid][hText]", and I want to add a condition "if the text length is more than 'HINT_LEN' then send an error to the player.
I've made it, but unfortunately it's completely bugged, help:
PHP Code:
CMD:addhint(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
if(sscanf(params, "s[50]", params)) return SendUsageMSG(playerid, "/addhint [TEXT]");
if(strlen(params) >= HINT_LEN) return SendErrorMSG(playerid, "The text you entered is too long.");
new hintid = -1;
for(new i = 0; i < MAX_HINTS; i++)
{
if(hInfo[i][hID] == -1)
{
hintid = i;
break;
}
}
if(hintid == -1) return SendErrorMSG(playerid, "Amount of hints has reached the maximum.");
hInfo[hintid][hID] = hintid;
hInfo[hintid][hText] = params[50];
SendAdminMSG(playerid, "Hint has been added.");
return 1;
}