PDA

View Full Version : Remake this CMD to ZCMD


Louris
20/11/2012, 03:06 PM
if(playerDB[playerid][vip])
{
if(!strcmp(cmdtext, "/v ", true,3)){
if(cmdtext[2]==0){SendClientMessage(playerid,GREEN, "* Naudojimas: /v [tekstas]"); return 1;}
new zin[256];
format(zin,sizeof(zin),"VIP: %s",cmdtext[3]);
SendClientMessageToAll(GREEN,zin);
return 1;
}


How to make that CMD to zcmd?

Mustafa6155
20/11/2012, 03:09 PM
#include <zcmd>


//do /v make it to
CMD:v (playerid,params[])
if(cmdtext[2]==0){SendClientMessage(playerid,GREEN, "* Naudojimas: /v [tekstas]"); return 1;}
new zin[256];
format(zin,sizeof(zin),"VIP: %s",cmdtext[3]);
SendClientMessageToAll(GREEN,zin);
return 1;
}


If i helped u please +REP

Louris
20/11/2012, 03:13 PM
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 535) : error 017: undefined symbol "cmdtext"
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 535) : warning 215: expression has no effect
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 535) : error 001: expected token: ";", but found "]"
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 537) : error 021: symbol already defined: "format"
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 539) : error 010: invalid function or declaration
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 541) : warning 203: symbol is never used: "zin"

-=Dar[K]Lord=-
20/11/2012, 03:16 PM
CMD:v (playerid,params[])
{
if(params[2]==0){SendClientMessage(playerid,GREEN, "* Naudojimas: /v [tekstas]"); return 1;}
new zin[256];
format(zin,sizeof(zin),"VIP: %s",params[3]);
SendClientMessageToAll(GREEN,zin);
return 1;
}


or else if u use
sscanf


CMD:v (playerid,params[])
{
if(sscanf(params,"c",params))return SendClientMessage(playerid,GREEN, "* Naudojimas: /v [tekstas]");
new zin[256];
format(zin,sizeof(zin),"VIP: %s",params);
SendClientMessageToAll(GREEN,zin);
return 1;
}

Louris
20/11/2012, 03:18 PM
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 536) : error 017: undefined symbol "cmdtext"
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 536) : warning 215: expression has no effect
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 536) : error 001: expected token: ";", but found "]"
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 536) : error 029: invalid expression, assumed zero
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 536) : fatal error 107: too many error messages on one line

-=Dar[K]Lord=-
20/11/2012, 03:18 PM
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 536) : error 017: undefined symbol "cmdtext"
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 536) : warning 215: expression has no effect
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 536) : error 001: expected token: ";", but found "]"
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 536) : error 029: invalid expression, assumed zero
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 536) : fatal error 107: too many error messages on one line

edited it...

Edvin
20/11/2012, 03:19 PM
Are you using sscanf?

CMD:v( playerid, params[ ] )
{
new
lsText[ 128 ]
;
if ( sscanf( params, "s[128]", lsText ) )
return SendClientMessage(playerid,GREEN, "* Naudojimas: /v [tekstas]");
new zin[256];
format(zin,sizeof(zin),"VIP: %s",lsText);
SendClientMessageToAll(GREEN,zin);
return 1;
}

Konstantinos
20/11/2012, 03:19 PM
@Above users, it's params, not cmdtext. Also, it's not necessary to use sscanf for it. That's why there's 'isnull'.
Last, never use a cell of 256 in client/player message. The limit is only 128.
#define isnull(%1) \
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))


CMD:v( playerid, params[ ] )
{
if( playerDB[ playerid ][ vip ] )
{
if( isnull( params ) ) return SendClientMessage( playerid, GREEN, "* Naudojimas: /v [tekstas]" );
new
zin[ 128 ]
;
format( zin, sizeof( zin ), "VIP: %s", params );
SendClientMessageToAll( GREEN, zin );
}
return 1;
}

Louris
20/11/2012, 03:23 PM
Are you using sscanf?

CMD:v( playerid, params[ ] )
{
new
lsText[ 128 ]
;
if ( sscanf( params, "s[128]", lsText ) )
return SendClientMessage(playerid,GREEN, "* Naudojimas: /v [tekstas]");
new zin[256];
format(zin,sizeof(zin),"VIP: %s",lsText);
SendClientMessageToAll(GREEN,zin);
return 1;
}


Your script works. But, how to make VIP [NICK_NAME]: message?

Konstantinos
20/11/2012, 03:26 PM
CMD:v( playerid, params[ ] )
{
if( playerDB[ playerid ][ vip ] )
{
if( isnull( params ) ) return SendClientMessage( playerid, GREEN, "* Naudojimas: /v [tekstas]" );
new
zin[ 128 ],
name[ MAX_PLAYER_NAME ]
;
GetPlayerName( playerid, name, MAX_PLAYER_NAME );
format( zin, sizeof( zin ), "VIP [%s]: %s", name, params );
SendClientMessageToAll( GREEN, zin );
}
return 1;
}


PS: Wow, everyone ignores the 128 which is the limit. Waste of memory...

Louris
20/11/2012, 03:30 PM
CMD:v( playerid, params[ ] )
{
if( playerDB[ playerid ][ vip ] )
{
if( isnull( params ) ) return SendClientMessage( playerid, GREEN, "* Naudojimas: /v [tekstas]" );
new
zin[ 128 ],
name[ MAX_PLAYER_NAME ]
;
GetPlayerName( playerid, name, MAX_PLAYER_NAME );
format( zin, sizeof( zin ), "VIP [%s]: %s", name, params );
SendClientMessageToAll( GREEN, zin );
}
return 1;
}


PS: Wow, everyone ignores the 128 which is the limit. Waste of memory...
Thanks, your script work :) +Reputation.

vernz
20/11/2012, 03:33 PM
CMD:v(playerid,params[ ])
{
new lsText[128],name[MAX_PLAYER_NAME],zin[256];
if (sscanf(params,"s[128]",lsText)) return SendClientMessage(playerid,GREEN, "* Naudojimas: /v [tekstas]");
else
{
GetPlayerName(playerid,name,sizeof(name));
format(zin,sizeof(zin),"VIP [%s]: %s",name,lsText);
SendClientMessageToAll(GREEN,zin);
}
return 1;
}

EDIT: NVM didn't see the second page lol