SA-MP Forums Archive
Problema comando /me. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: Problema comando /me. (/showthread.php?tid=549461)



Problema comando /me. - Zarco - 06.12.2014

Buenas he creado el comando /me en strcmp, compila bien y todo pero al poner /me sin nada escrito sale un SendClientMessage que dice "Mi_nombre /me" en vez de poner "/me [accion]" y al poner "/me mi frase" sale "/me mi frase" no se corta el comando, no se si me he explicado bien, ahн os dejo el comando por si me podйis ayudar.

Код:
	new string[300], idx, cmd[150];
	
	if(strcmp(cmd, "/me", true) == 0){
	    if(IsPlayerConnected(playerid)){
			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, -1, "/me [accion]");
				return 1;
			}
     		format(string, sizeof(string), "* %s %s", NombreDP(playerid), result);
			ProxDetector(30.0, playerid, string, -1,-1,-1,-1,-1);
			printf("%s", string);
		}
  return 1;
 }



Respuesta: Problema comando /me. - jotajeda - 06.12.2014

pawn Код:
new string[300], idx, cmd[150];
            cmd = strtok(cmdtext, idx);
            if(strcmp(cmd, "/me", true) == 0)
            {
                if(IsPlayerConnected(playerid))
                {
                    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, -1, "/me [accion]");
                        return 1;
                    }
                    format(string, sizeof(string), "* %s %s", NombreDP(playerid), result);
                    ProxDetector(30.0, playerid, string, -1,-1,-1,-1,-1);
                    printf("%s", string);
                }
                return 1;
            }