SA-MP Forums Archive
sscanf to strcmp - 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)
+--- Thread: sscanf to strcmp (/showthread.php?tid=404401)



sscanf to strcmp - ancezas - 02.01.2013

i have this script:
Код:
if(sscanf(params,"s[24]s[36]",vardas,priezastis))
and i whant to use it on strcmp

Код:
i tryed if( !strcmp(vardas, "0", true) )
but i have nothing

whole script without sscanf:


Код:
if(!strcmp(cmdtext, "/ban", true,4))
	{
	    if( !zInfo[ playerid ][ Admin ] ) return 0;
	    new
			vardas[ MAX_PLAYER_NAME ],
			priezastis[ 36 ]
		;
	    if( !strcmp(vardas, "0", true) )return SendClientMessage(playerid, -1,"Uћrakinti ћaidėjo profilį: [ /ban ћaidėjas prieћastis ]");
		else if(strlen(priezastis) > 36) return SendClientMessage(playerid, -1,"Prieћastis per ilga. Maksimaliai 36 simboliai.");
        new id = GetPlayeridMid(vardas);
		if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1,"Tokio prisijungusio ћaidėjo nėra.");
		//else if(!strcmp(ZaidejoVardas(zID),"AnceZas",true)) return SendClientMessage(playerid, -1,"Serverio pagr. Savininko profilio uћrakinti negalite.");
		new zV[MAX_PLAYER_NAME],msg[46];
		GetPlayerName(id,zV,MAX_PLAYER_NAME);
		format(msg,46,"Uћrakinote %s profilį.",zV);
		SendClientMessage(playerid, -1, msg);
		BanZaideja(id,ZaidejoVardas(playerid),priezastis);
		return 1;
	}
it's not working, when i tape /ban user test it's give me
Quote:

Uћrakinti ћaidėjo profilį: [ /ban ћaidėjas prieћastis ]




Re: sscanf to strcmp - park4bmx - 02.01.2013

Your trying to see if the players name matches the string "0" ?


Re: sscanf to strcmp - Jochemd - 02.01.2013

Better convert the rest of your strcmp commands to zcmd + sscanf instead of otherwise.


Re: sscanf to strcmp - ancezas - 02.01.2013

the original code:
Код:
if(sscanf(params,"s[24]s[36]",vardas,priezastis)) return ExplainMsg(playerid,"Uћrakinti ћaidėjo profilį: [ /ban ћaidėjas prieћastis ]");