sscanf to strcmp
#1

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 ]

Reply
#2

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

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

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 ]");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)