small help
#1

can plz somehelp to get this in strcmp comand cuz my gm is is using srcmp so fs also should be strcmp but unfortuanatley its in zcmd so plz some help me to convert (will give rep++)

Код:
#
CMD:placegate( playerid, params[] )
#
{
#
        if( isnull( params) )
#
            return SendClientMessage( playerid, -1, "Syntax: /placegate [password]" );
#
           
#
        if( !strval( params ) )
#
            return SendClientMessage( playerid, -1, "You need to input numbers." );
#
           
#
        if( IsPlayerInAnyVehicle( playerid ) )
#
            return SendClientMessage( playerid, -1, "You need to exit your vehicle." );
#
 
#
        new Float:pPos[4];
#
        GetPlayerPos( playerid, pPos[0], pPos[1], pPos[2] );
#
        GetPlayerFacingAngle( playerid, pPos[3] );
#
        CreateGate( playerid, strval( params ), pPos[0], pPos[1], pPos[2], pPos[3] );
#
        SendClientMessage( playerid, -1, "You succesfully created a movable gate. Use /gopen or /gclose." );
#
 
#
        return 1;
#
}
i am getting error undefined symbol params while converting....
Reply
#2

Use sscanf instead, it works perfectly with zcmds,
download it from here: https://sampforum.blast.hk/showthread.php?tid=570927

PHP код:
#include <sscanf2>
CMD:placegate(playeridparams[]){
    new 
passwordFloat:pPos[4];
    if(
IsPlayerInAnyVehicle(playerid)) return SendClientMessageplayerid, -1"You need to exit your vehicle." );
    if(
sscanf(params"i"password)) return SendClientMessageplayerid, -1"Syntax: /placegate [password]" );
    
GetPlayerPosplayeridpPos[0], pPos[1], pPos[2] );
    
GetPlayerFacingAngleplayeridpPos[3] );
    
CreateGateplayeridstrvalparams ), pPos[0], pPos[1], pPos[2], pPos[3] );
    
SendClientMessageplayerid, -1"You succesfully created a movable gate. Use /gopen or /gclose." );
    return 
1;

Reply
#3

Do you have a stock or a callback that creates the CreateGate function?
Reply
#4

I know a little about strcmp. Did a little research. This is what I made

PHP код:
if(strcmp(cmd"/placegate"true) == 0)
    {
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))
        {
            
SendClientMessage(playeridCOLOR_GRAD2"Syntax: /placegate [password]");
            return 
1;
        }
        
        if( !
strval( string ) )
            return 
SendClientMessageplayerid, -1"You need to input numbers." );

        if( 
IsPlayerInAnyVehicleplayerid ) )
            return 
SendClientMessageplayerid, -1"You need to exit your vehicle." );

        new 
Float:pPos[4];
        
GetPlayerPosplayeridpPos[0], pPos[1], pPos[2] );
        
GetPlayerFacingAngleplayeridpPos[3] );
        
CreateGateplayeridstrvalpPos[0], pPos[1], pPos[2], pPos[3] );
        
SendClientMessageplayerid, -1"You succesfully created a movable gate. Use /gopen or /gclose." );
        return 
1;

    } 
Reply
#5

Quote:
Originally Posted by NealPeteros
Посмотреть сообщение
I know a little about strcmp. Did a little research. This is what I made

PHP код:
if(strcmp(cmd"/placegate"true) == 0)
    {
        
tmp strtok(cmdtextidx);
        if(!
strlen(tmp))
        {
            
SendClientMessage(playeridCOLOR_GRAD2"Syntax: /placegate [password]");
            return 
1;
        }
        
        if( !
strval( string ) )
            return 
SendClientMessageplayerid, -1"You need to input numbers." );
        if( 
IsPlayerInAnyVehicleplayerid ) )
            return 
SendClientMessageplayerid, -1"You need to exit your vehicle." );
        new 
Float:pPos[4];
        
GetPlayerPosplayeridpPos[0], pPos[1], pPos[2] );
        
GetPlayerFacingAngleplayeridpPos[3] );
        
CreateGateplayeridstrvalpPos[0], pPos[1], pPos[2], pPos[3] );
        
SendClientMessageplayerid, -1"You succesfully created a movable gate. Use /gopen or /gclose." );
        return 
1;
    } 
I'm just curious to why you want to use strcmp for your commands. It's inefficient and thus slower than other command processors like zcmd.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)