static const Msgs[][2][50] = //[] is for the id, [2] is to declare a multidimensional array, [50] is the maxlength of the string
{
{"Together forever!", 1},
{"Long live!", 2},
{"Test Server", 3},
{"It's a great day!", 4}
};
//the second values (numerical ones) are the ids of the textdraw
CMD:findmsg(playerid, params[])
{
new msg[64];
if(sscanf(params, "s", msg))
{
SendClientMessage(playerid, -1, "USAGE: /findmsg [part of word]");
return 1;
}
return 1;
}
new string[128];
for(new i = 0; i < sizeof(Msgs); i++)
{
if(strfind(msg, Msgs[i], true) != -1)
{
return 1;
}
}
new textdrawid = -1;
for(new i, j = sizeof Msgs; i<j; i++)
{
if(!strfind(Msgs[i][0], msg, true)) continue;
textdrawid = Msgs[i][1];
break;
}
if(textdrawid == -1) // no similiar msg found
enum MSG_INFO
{
TEXT[50],
PlayerText:TXDID // or Text:
};
static const Msgs[][MSG_INFO] =
{
{"Together forever!", 1},
{"Long live!", 2},
{"Test Server", 3},
{"It's a great day!", 4}
};
PHP код:
PHP код:
|
static const Msgs[][50] =
{
{"Together forever!"},
{"Long live!"},
{"Test Server"},
{"It's a great day!"}
};
main(){
for(new x = 0; x < 4; x ++){
if(strfind(Msgs[x], "Long", true) != -1){ // Looking for Long Live! string, edit this line how you look for it
printf("String found: %s", Msgs[x]); // printing the found string for debugging purposes
switch(x) {
case 0: printf("CASE 1 : %s", Msgs[x]); // Together Forever! Won't be found
case 1: printf("CASE 2 : %s", Msgs[x]); // <-- Long Live! Will be found.
case 2: printf("CASE 3 : %s", Msgs[x]); // Test Server Won't be found
case 3: printf("CASE 4 : %s", Msgs[x]); // It's a great day! Won't be found
// Instead of printing the strings, use TextDrawSetString on the desired textdraw
}
}
}
return 1;
}
[15:26:16] String found: Long live!
[15:26:16] CASE 2 : Long live!