Convertion to zcmd
#1

Any way to change this to zcmd?

Код:
if(strcmp(cmd,"/name",true)==0){
			if(PlayerInfo[playerid][power]>0 || PlayerInfo[playerid][premium]>0 || PlayerInfo[playerid][playerteam]==HITMAN || PlayerInfo[playerid][playerlvl]>=20){
				new tmp[256];
				tmp=strtok(cmdtext,idx);
				if(!strlen(tmp)){
					SendClientUsage(playerid, cmd, "[on/off]");
					return 1;
				}
				if(strcmp(tmp,"on",true)==0){
					PlayerTemp[playerid][hname]=0;
					GameTextForPlayer(playerid,"~g~ShowName ON",1000,1);
					for(new i=0;i<MAX_PLAYERS;i++) if(IsPlayerConnected(i)) ShowPlayerNameTagForPlayer(i,playerid,1);
					return 1;
				}
				if(strcmp(tmp,"off",true)==0){
					PlayerTemp[playerid][hname]=1;
					GameTextForPlayer(playerid,"~r~ShowName OFF",1000,1);
					for(new i=0;i<MAX_PLAYERS;i++) if(IsPlayerConnected(i) && PlayerInfo[i][power]==0) ShowPlayerNameTagForPlayer(i,playerid,0);
					return 1;
				}
			}
			else{
				SendClientError(playerid,"You can't use this command for now");
		    	return 1;
  			}

		}
Код:
if(strcmp(cmd,"/irc",true)==0){
	  	if(PlayerTemp[playerid][muted]==0){
	  	    if(ircenable==1){
			    new tmp[256];
			    new message[MAX_STRING];
			    tmp = strrest(cmdtext,idx);
		     	if(!strlen(tmp)){
					SendClientUsage(playerid, cmd, "[message]");
					return 1;
				}
				format(message,sizeof(message),"[(ToIRC) %s[%d]: %s]",PlayerName(playerid),playerid,tmp);
				SendClientMessage(playerid,COLOR_ADMIN_SPYREPORT,message);
				for(new i=0;i<MAX_PLAYERS;i++){
					    if(PlayerInfo[i][power]>0 || PlayerInfo[i][helper]>0) SendClientMessage(i, COLOR_ADMIN_SPYREPORT, message);
				}
				format(message, sizeof(message), "05(ToIRC) %s[%d]: %s]", PlayerName(playerid), playerid, tmp);
				IRC_GroupSay(gGroupID, IRC_CHANNEL, message);
		        //ircecho("irctalk %d %s %s",playerid,PlayerName(playerid),tmp);
			    return 1;
			}
			else{
				SendClientError(playerid,"IRC CHAT DISABLED");
		    	return 1;
		 	}
		}
		else{
		    SendClientError(playerid,"You have been muted");
		    return 1;
		 }
Код:
if(strcmp(cmd,"/jq",true)==0){
			new tmp[256];
			tmp=strtok(cmdtext,idx);
			if(!strlen(tmp)){
				SendClientUsage(playerid, cmd, "[on/off]");
				return 1;
			}
			if(strcmp(tmp,"on",true)==0){
				PlayerTemp[playerid][jqmessage]=1;
				InfoText(playerid,"join/quit messages turned on",5);
				return 1;
			}
			if(strcmp(tmp,"off",true)==0){
				PlayerTemp[playerid][jqmessage]=0;
				InfoText(playerid,"join/quit messages turned off",5);
				return 1;
			}
		}
Reply
#2

Note: Not tested, i was in a hurry

Ill edit the post later, bye :P

EDIT: ill edit /irc later and tell me if those commands under here work
pawn Код:
COMMAND:name(playerid, params[])
{
    if(PlayerInfo[playerid][power]>0 || PlayerInfo[playerid][premium]>0 || PlayerInfo[playerid][playerteam]==HITMAN || PlayerInfo[playerid][playerlvl]>=20)
    {
        if(!strlen(params))
        {
            SendClientUsage(playerid, params, "[on/off]");
            return 1;
        }
        if(strcmp(params,"on",true)==0)
        {
            PlayerTemp[playerid][hname]=0;
            GameTextForPlayer(playerid,"~g~ShowName ON",1000,1);
            for(new i=0;i<MAX_PLAYERS;i++) if(IsPlayerConnected(i)) ShowPlayerNameTagForPlayer(i,playerid,1);
        }
        if(strcmp(params,"off",true)==0)
        {
            PlayerTemp[playerid][hname]=1;
            GameTextForPlayer(playerid,"~r~ShowName OFF",1000,1);
            for(new i=0;i<MAX_PLAYERS;i++) if(IsPlayerConnected(i) && PlayerInfo[i][power]==0) ShowPlayerNameTagForPlayer(i,playerid,0);
        }
        else
        {
            SendClientError(playerid,"You can't use this command for now");
            return 1;
        }
    }
    return 1;
}
pawn Код:
COMMAND:jq(playerid, params[])
{
    if(!strlen(params))
    {
        SendClientUsage(playerid, params, "[on/off]");
        return 1;
    }
    if(strcmp(params,"on",true)==0)
    {
        PlayerTemp[playerid][jqmessage]=1;
        InfoText(playerid,"join/quit messages turned on",5);
        return 1;
    }
    else if(strcmp(params,"off",true)==0)
    {
        PlayerTemp[playerid][jqmessage]=0;
        InfoText(playerid,"join/quit messages turned off",5);
        return 1;
    }
}
Reply
#3

If you paid any attention to the zcmd release thread, you'd know that you can't call strlen on params, because params will never be at 0 length.
Reply
#4

I can make it that, do u use sscanf ? IT's a bit better xD
Reply
#5

4char: nvm
Reply
#6

Quote:
Originally Posted by System64
Посмотреть сообщение
I can make it that, do u use sscanf ? IT's a bit better xD
I use sscanf & zcmd (vortex gm)
Reply
#7

Quote:
Originally Posted by CyberGhost
Посмотреть сообщение
Note: Not tested, i was in a hurry

Ill edit the post later, bye :P

EDIT: ill edit /irc later and tell me if those commands under here work
pawn Код:
COMMAND:name(playerid, params[])
{
    if(PlayerInfo[playerid][power]>0 || PlayerInfo[playerid][premium]>0 || PlayerInfo[playerid][playerteam]==HITMAN || PlayerInfo[playerid][playerlvl]>=20)
    {
        if(!strlen(params))
        {
            SendClientUsage(playerid, params, "[on/off]");
            return 1;
        }
        if(strcmp(params,"on",true)==0)
        {
            PlayerTemp[playerid][hname]=0;
            GameTextForPlayer(playerid,"~g~ShowName ON",1000,1);
            for(new i=0;i<MAX_PLAYERS;i++) if(IsPlayerConnected(i)) ShowPlayerNameTagForPlayer(i,playerid,1);
        }
        if(strcmp(params,"off",true)==0)
        {
            PlayerTemp[playerid][hname]=1;
            GameTextForPlayer(playerid,"~r~ShowName OFF",1000,1);
            for(new i=0;i<MAX_PLAYERS;i++) if(IsPlayerConnected(i) && PlayerInfo[i][power]==0) ShowPlayerNameTagForPlayer(i,playerid,0);
        }
        else
        {
            SendClientError(playerid,"You can't use this command for now");
            return 1;
        }
    }
    return 1;
}
pawn Код:
COMMAND:jq(playerid, params[])
{
    if(!strlen(params))
    {
        SendClientUsage(playerid, params, "[on/off]");
        return 1;
    }
    if(strcmp(params,"on",true)==0)
    {
        PlayerTemp[playerid][jqmessage]=1;
        InfoText(playerid,"join/quit messages turned on",5);
        return 1;
    }
    else if(strcmp(params,"off",true)==0)
    {
        PlayerTemp[playerid][jqmessage]=0;
        InfoText(playerid,"join/quit messages turned off",5);
        return 1;
    }
}
didnt work mate :/ i appreciate ur effort tho
Reply
#8

Quote:
Originally Posted by Clueless
Посмотреть сообщение
Any way to change this to zcmd?

Код:
if(strcmp(cmd,"/name",true)==0){
			if(PlayerInfo[playerid][power]>0 || PlayerInfo[playerid][premium]>0 || PlayerInfo[playerid][playerteam]==HITMAN || PlayerInfo[playerid][playerlvl]>=20){
				new tmp[256];
				tmp=strtok(cmdtext,idx);
				if(!strlen(tmp)){
					SendClientUsage(playerid, cmd, "[on/off]");
					return 1;
				}
				if(strcmp(tmp,"on",true)==0){
					PlayerTemp[playerid][hname]=0;
					GameTextForPlayer(playerid,"~g~ShowName ON",1000,1);
					for(new i=0;i<MAX_PLAYERS;i++) if(IsPlayerConnected(i)) ShowPlayerNameTagForPlayer(i,playerid,1);
					return 1;
				}
				if(strcmp(tmp,"off",true)==0){
					PlayerTemp[playerid][hname]=1;
					GameTextForPlayer(playerid,"~r~ShowName OFF",1000,1);
					for(new i=0;i<MAX_PLAYERS;i++) if(IsPlayerConnected(i) && PlayerInfo[i][power]==0) ShowPlayerNameTagForPlayer(i,playerid,0);
					return 1;
				}
			}
			else{
				SendClientError(playerid,"You can't use this command for now");
		    	return 1;
  			}

		}
Код:
if(strcmp(cmd,"/irc",true)==0){
	  	if(PlayerTemp[playerid][muted]==0){
	  	    if(ircenable==1){
			    new tmp[256];
			    new message[MAX_STRING];
			    tmp = strrest(cmdtext,idx);
		     	if(!strlen(tmp)){
					SendClientUsage(playerid, cmd, "[message]");
					return 1;
				}
				format(message,sizeof(message),"[(ToIRC) %s[%d]: %s]",PlayerName(playerid),playerid,tmp);
				SendClientMessage(playerid,COLOR_ADMIN_SPYREPORT,message);
				for(new i=0;i<MAX_PLAYERS;i++){
					    if(PlayerInfo[i][power]>0 || PlayerInfo[i][helper]>0) SendClientMessage(i, COLOR_ADMIN_SPYREPORT, message);
				}
				format(message, sizeof(message), "05(ToIRC) %s[%d]: %s]", PlayerName(playerid), playerid, tmp);
				IRC_GroupSay(gGroupID, IRC_CHANNEL, message);
		        //ircecho("irctalk %d %s %s",playerid,PlayerName(playerid),tmp);
			    return 1;
			}
			else{
				SendClientError(playerid,"IRC CHAT DISABLED");
		    	return 1;
		 	}
		}
		else{
		    SendClientError(playerid,"You have been muted");
		    return 1;
		 }
Код:
if(strcmp(cmd,"/jq",true)==0){
			new tmp[256];
			tmp=strtok(cmdtext,idx);
			if(!strlen(tmp)){
				SendClientUsage(playerid, cmd, "[on/off]");
				return 1;
			}
			if(strcmp(tmp,"on",true)==0){
				PlayerTemp[playerid][jqmessage]=1;
				InfoText(playerid,"join/quit messages turned on",5);
				return 1;
			}
			if(strcmp(tmp,"off",true)==0){
				PlayerTemp[playerid][jqmessage]=0;
				InfoText(playerid,"join/quit messages turned off",5);
				return 1;
			}
		}
SOMEONE PLEASE? ITS IMPORTANT :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)