SA-MP Forums Archive
Convertion to zcmd - 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: Convertion to zcmd (/showthread.php?tid=253091)



Convertion to zcmd - Clueless - 04.05.2011

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;
			}
		}



Re: Convertion to zcmd - Laronic - 04.05.2011

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;
    }
}



Re: Convertion to zcmd - Calgon - 04.05.2011

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.


Re: Convertion to zcmd - System64 - 04.05.2011

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


Re: Convertion to zcmd - SchurmanCQC - 04.05.2011

4char: nvm


Re: Convertion to zcmd - Clueless - 05.05.2011

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)


Re: Convertion to zcmd - Clueless - 05.05.2011

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


Re: Convertion to zcmd - Clueless - 09.05.2011

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 :/