SA-MP Forums Archive
[HELP] A little help with the string - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] A little help with the string (/showthread.php?tid=268723)



[HELP] A little help with the string - MadalinX5 - 13.07.2011

Hello. I have a little problem with a command i am trying to make "/do". So far i did this:
Код:
	if(!strcmp(cmdtext,"/do ", true, 3))
    {
        if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /do [action]");
  		new string[128];
  		GetPlayerName(playerid, string, sizeof(string));
  		format(string,sizeof(string),"** %s (( %s ))", string, cmdtext[4]);
		ProxDetector(170.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  		return 1;
	}
But i want to reverse the 2 "%s"'s so instead of being "** Name ((Text))" I want it to be: "** Text ((Name))"
Can anyone tell me please how i can do that?


Re: [HELP] A little help with the string - freshOrange - 13.07.2011

pawn Код:
if(!strcmp(cmdtext,"/do ", true, 3))
    {
        if(!cmdtext[3])return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /do [action]");
        new string[128];
        GetPlayerName(playerid, string, sizeof(string));
        format(string,sizeof(string),"** %s (( %s ))", cmdtext[4], string);
        ProxDetector(170.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
        return 1;
    }
You mean like this?


Re: [HELP] A little help with the string - MadalinX5 - 13.07.2011

YES Thank you!


Re: [HELP] A little help with the string - freshOrange - 13.07.2011

No problem! It's completely safe to change them with places.


Re: [HELP] A little help with the string - MadalinX5 - 13.07.2011

But can you please explain why you changed Cmdtext with string?
Cmdtext was the text and string the name?