//-------------------------[Ask]--------------------------------------------- if(strcmp(cmd, "/ask", true) == 0) { GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ask [question]"); return 1; } format(string, sizeof(string), "%s (id%d) asks %s", sendername, playerid, result); ABroadCast(COLOR_YELLOW,string,1); SendClientMessage(playerid, COLOR_GRAD2, "Your question has been sent, please wait a response"); }
//-------------------------[Answer]--------------------------------------------- if((strcmp(cmd, "/answer", true) == 0 || strcmp(cmd, "/ans", true) == 0)) { if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pRealAdmin] == 1) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /ans(wer) [playerid/PartOfName] [Answer]"); return 1; } if(IsStringAName(tmp)) { giveplayerid = GetPlayerID(tmp); } else { giveplayerid = strval(tmp); } if (!IsPlayerConnected(giveplayerid)) { SendClientMessage(playerid, COLOR_RED, "ERROR: That player is not connected!"); return 1; } GetPlayerName(playerid, sendername, sizeof(sendername)); GetPlayerName(giveplayerid, giveplayer, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[128]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ans(wer) [playerID/PartOfName] [Answer]"); return 1; } format(string, sizeof(string), "Admin %s (%d) has Answered to your question with the following answer:", sendername, playerid); SendClientMessage(giveplayerid, COLOR_YELLOW, string); format(string, sizeof(string), "%s", result); SendClientMessage(giveplayerid, COLOR_YELLOW, string); format(string, sizeof(string), "Admin %s has responded to %s [ID:%d]'s Question", sendername, giveplayer, giveplayerid); ABroadCast(COLOR_GREEN, string,1); } }
Originally Posted by mikeboy
"Pawno Stop Responding"
When I try to compile |
Originally Posted by lolumadd [cod5server.tk
]
Quote:
Im not going to create the code though because im lazy. Just make a command and split it (using the split function) into two. Then format the string so its like "Name asks: %s" then send it to all players, etc. |